Human design

by Curtis Chang

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<div id="vue-instance">
<h3>星座度數轉閘門</h3>
 <pre>星座:       <select v-model="selected">
  <option v-for="option in options" v-bind:value="option.value">
    {{ option.text }}
  </option>
</select>
</pre>
  <pre>度數:      <input  v-model="degree"></pre>
<pre>人類圖閘門:</pre>
<pre>{{gatesInfo}}</pre>

<hr>
<h3>閘門轉星座</h3>
<pre>閘門:       <input  v-model="input_gate"></pre>
<pre>星座:</pre>
<pre>{{ astroInfo }}</pre>

</div>

JavaScript

// human design
const gates           = 64
const gate_span       = 360/gates
const house_span      = 360/ 12
const gates_per_house = 30 / gate_span
const calibration     = 0.125/30        // astro sign calibration
const lbound_house    = 5
const lbound_degree   = gate_span * lbound_house
const lbound_gate     = 59
const options = [
      { text: 'Aries牧羊', value: 1},
      { text: 'Torus金牛', value: 2 },
      { text: 'Gemini雙子', value: 3 },
      { text: 'Cancer巨蝎', value: 4 },
      { text: 'Lion獅子', value: 5 },
      { text: 'Virgo處女', value: 6 },
      { text: 'Libra天秤', value: 7 },
      { text: 'Scorpio天蝎', value: 8 },
      { text: 'Sagitarius射手', value: 9},
      { text: 'Capricon魔羯', value: 10 },
      { text: 'Aquarius水瓶', value: 11 },
      { text: 'Pices雙魚', value: 12 }
    ]
const astro_signs     = options.map((e)=>{return e.text})
const gates_in_serial = [59,40,64,47,6,46,18,48,57,32,50,28,44,1,
43,14,34,9,5,26,11,10,58,38,54,61,60,41,19,13,49,30,55,37,63,22,36,
25,17,21,51,42,3,27,24,2,23,8,20,16,35,45,12,15,52,39,53,62,56,31,
33,7,4,29]


function degreesToRadians(degrees)
{
  return degrees * (Math.PI/180);
}

function radiansToDegrees(radian){
	return radian /(Math.PI / 180)
}

function getDecimal(a){
   return a- parseInt(a)
}
function getRadians(a){
   return degreesToRadians(getDecimal(a)) 
}

function getAstroSignByGate(_gate_number){
    let gate = Number(_gate_number.toString().split('.')[0]),
        line = Number(_gate_number.toString().split('.')[1]) || 0,
        gate_index = gates_in_serial.indexOf(gate),
        astro_span = gate_index / gates_per_house + (line/6) / gates_per_house+calibration,
        next_astro_span = (gate_index+1) / gates_per_house + (line/6) / gates_per_house+calibration,
        astro_num  = 6 + astro_span ,
        astro_sign = astro_signs[parseInt(astro_num)-1]
    
    console.log(`gate:${gate}, line:${line}, 'gate_index:${gate_index}, astro_span:${astro_span}, astro_num:${astro_num},...