Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.89 KB | None | 0 0
  1.  
  2.       // This loop loops trough each planet then looks if there is aspect with any other planet that is further away
  3.       // In natal horocopes the sun can make aspects with all planet. But planets that are further away, can't make a
  4.       // aspect with the sun. So the sun can make a aspect with pluto, but pluto can't make a aspect with the sun. This
  5.       // this loops does this in the right order
  6.       for ($i = 0; $i <= 9; $i++)
  7.       {
  8.         for ($j = $i + 1; $j <= 10; $j++)
  9.         {
  10.          
  11.           $planet_positions = swe_calc_ut($jd, $plnr, 0, $planet_positions, $serr);
  12.  
  13.       // To find a aspects, we need to know the distance between two planets. Substracting the two different planet
  14.           // positions will give you the remaining distance. Using ABS the value will always be positive.
  15.       // For example lets say the sun is at 91.986084 decimal degrees and Mercury is at 92.223671 this would result
  16.           // in a positive value as −0.237587, which is less then aspect + or - orb. So its a aspect.
  17.  
  18.           $da = Abs($planet_positions[$i] - $planet_positions[$j]);
  19.          
  20.       // We use radian degrees to find aspect, distance will not be more then 180 degrees
  21.       if ($da > 180)
  22.           {
  23.             $da = 360 - $da;
  24.           }
  25.  
  26.       define The orb of a aspect.  
  27.       $orb = 5;
  28.  
  29.           // Q = 1 by default, which means no aspect has been found yet.
  30.           $q = 1;
  31.  
  32.       // if da is less not bigger then orb, set q=2 mean conjunction
  33.           if ($da <= $orb)
  34.           {
  35.             $q = 2;
  36.           }
  37.           // if da is 60 degrees , set q=3 means sextile aspect
  38.           elseif (($da <= 60 + $orb) And ($da >= 60 - $orb))
  39.           {
  40.             $q = 3;
  41.           }
  42.           // if da is 90 degrees, set q=4 means square aspect
  43.           elseif (($da <= 90 + $orb) And ($da >= 90 - $orb))
  44.           {
  45.             $q = 4;
  46.           }
  47.           // if da is 120 degrees, set q=5 means trine aspect
  48.           elseif (($da <= 120 + $orb) And ($da >= 120 - $orb))
  49.           {
  50.             $q = 5;
  51.           }
  52.           // if da is 180 degrees, set q=6 means opposite aspect
  53.           elseif ($da >= 180 - $orb)
  54.           {
  55.             $q = 6;
  56.           }
  57.  
  58.       // if $q is more then one, a aspect has been found
  59.           if ($q > 1)
  60.           {
  61.         // What aspect?
  62.             if ($q == 2)
  63.             {
  64.               $aspect = "Conjunction";
  65.             }
  66.             elseif ($q == 3)
  67.             {
  68.               $aspect = "Sextile";
  69.             }
  70.             elseif ($q == 4)
  71.             {
  72.               $aspect = "Square";
  73.             }
  74.         elseif ($q == 5) {
  75.           $aspect = "trine";
  76.         }
  77.         elseif ($q == 6) {
  78.           $aspect = "opposite"
  79.         }
  80.         // Print line of aspect for example sun square moon....
  81.             $aspects[] = $planet_name[$i] . $aspect . $planet_name[$j] // string with aspect
  82.           }
  83.         }
  84.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement