Exemple #1
0
 /**
  * Get bhava ruler (lord).
  * 
  * @return string
  */
 public function getRuler()
 {
     $rashi = $this->getEnvironment()['bhava'][$this->objectKey]['rashi'];
     $Rashi = Rashi::getInstance((int) $rashi);
     $ruler = $Rashi->rashiRuler;
     return $ruler;
 }
Exemple #2
0
 /**
  * Indu lagna calculation.
  * 
  * @return array
  * @see Kalidas. Uttara Kalamritam. Chapter 4, Verse 27.
  */
 public function getIL()
 {
     $this->checkData(__FUNCTION__);
     $kala = [Graha::KEY_SY => 30, Graha::KEY_CH => 16, Graha::KEY_MA => 6, Graha::KEY_BU => 8, Graha::KEY_GU => 10, Graha::KEY_SK => 12, Graha::KEY_SA => 1];
     $rashiRuler = function ($rashi) {
         $Rashi = Rashi::getInstance($rashi);
         return $Rashi->rashiRuler;
     };
     $ruler9FromLg = $rashiRuler($this->getData()['bhava'][9]['rashi']);
     $ruler9FromCh = $rashiRuler(Math::numberInCycle($this->getData()['graha'][Graha::KEY_CH]['rashi'], 9));
     $distance = ($kala[$ruler9FromLg] + $kala[$ruler9FromCh]) % 12;
     if ($distance == 0) {
         $distance = 12;
     }
     $rashiIL = Math::numberInCycle($this->getData()['graha'][Graha::KEY_CH]['rashi'], $distance);
     $degreeIL = $this->getData()['graha'][Graha::KEY_CH]['degree'];
     $lngIL = ($rashiIL - 1) * 30 + $degreeIL;
     return ['longitude' => $lngIL, 'rashi' => $rashiIL, 'degree' => $degreeIL];
 }
Exemple #3
0
 /**
  * Get varga rashi.
  * 
  * @param array $ganitaRashi
  * @return array
  * @see Maharishi Parashara. Brihat Parashara Hora Shastra. Chapter 6, Verse 17-21.
  */
 public function getVargaRashi(array $ganitaRashi)
 {
     $amshaSize = 30 / $this->vargaAmsha;
     $result = Math::partsToUnits($ganitaRashi['degree'], $amshaSize, 'floor');
     $vargaRashi = [];
     $vargaRashi['degree'] = $result['parts'] * 30 / $amshaSize;
     $rashiObject = Rashi::getInstance((int) $ganitaRashi['rashi']);
     $rashiBhava = $rashiObject->rashiBhava;
     switch ($rashiBhava) {
         case Rashi::BHAVA_CHARA:
             $vargaRashi['rashi'] = Math::numberInCycle(1 + $result['units']);
             break;
         case Rashi::BHAVA_STHIRA:
             $vargaRashi['rashi'] = Math::numberInCycle(9 + $result['units']);
             break;
         case Rashi::BHAVA_DVISVA:
             $vargaRashi['rashi'] = Math::numberInCycle(5 + $result['units']);
             break;
     }
     return $vargaRashi;
 }
Exemple #4
0
 /**
  * Get aspect by rashis.
  * 
  * @return array
  */
 public function isAspectedByRashi()
 {
     foreach (Rashi::$rashi as $key => $name) {
         if ($key == $this->objectKey) {
             continue;
         }
         $Rashi = Rashi::getInstance($key);
         $rashiDrishti = $Rashi->rashiDrishti;
         if (isset($rashiDrishti[$this->objectRashi])) {
             $isAspected['rashi'][$key] = $rashiDrishti[$this->objectRashi];
         }
     }
     $isAspected['graha'] = [];
     foreach (Graha::$graha as $key => $name) {
         $grahaRashi = $this->getEnvironment()['graha'][$key]['rashi'];
         if (array_key_exists($grahaRashi, $isAspected['rashi'])) {
             $isAspected['graha'][$key] = 1;
         }
     }
     return $isAspected;
 }
Exemple #5
0
 /**
  * Draw chakra.
  * 
  * @param \Jyotish\Base\Data $Data
  * @param int $x
  * @param int $y
  * @param null|array $options Options to set (optional)
  */
 public function drawChakra(\Jyotish\Base\Data $Data, $x, $y, array $options = null)
 {
     $this->setData($Data);
     $this->setOptions($options);
     $chakraStyle = 'Jyotish\\Draw\\Plot\\Chakra\\Style\\' . ucfirst($this->options['chakraStyle']);
     $this->Chakra = new $chakraStyle($Data);
     $bhavaPoints = $this->Chakra->getBhavaPoints($this->options['chakraSize'], $x, $y);
     foreach ($bhavaPoints as $number => $points) {
         if ($this->options['chakraStyle'] == Chakra::STYLE_NORTH) {
             $bhava = ' bhava' . $number;
             $rashi = ' rashi' . $Data->getData()['bhava'][$number]['rashi'];
         } else {
             $rashi = ' rashi' . $number;
             $Rashi = Rashi::getInstance($number);
             $Rashi->setEnvironment($Data);
             $bhava = ' bhava' . $Rashi->getBhava();
         }
         $this->options['attributes'] = ['class' => 'bhava' . $bhava . $rashi];
         $this->Renderer->drawPolygon($points, $this->options);
     }
     $this->drawRashiLabel($x, $y, $this->options);
     $this->drawBodyLabel($x, $y, $this->options);
 }
Exemple #6
0
 /**
  * Get varga rashi.
  * 
  * @param array $ganitaRashi
  * @return array
  * @see Maharishi Parashara. Brihat Parashara Hora Shastra. Chapter 6, Verse 24-26.
  */
 public function getVargaRashi(array $ganitaRashi)
 {
     $amshaSize = 30 / $this->vargaAmsha;
     $result = Math::partsToUnits($ganitaRashi['degree'], $amshaSize, 'floor');
     $vargaRashi = [];
     $vargaRashi['degree'] = $result['parts'] * 30 / $amshaSize;
     $rashiObject = Rashi::getInstance((int) $ganitaRashi['rashi']);
     $rashiBhuta = $rashiObject->rashiBhuta;
     switch ($rashiBhuta) {
         case Maha::BHUTA_AGNI:
             $vargaRashi['rashi'] = Math::numberInCycle(1 + $result['units']);
             break;
         case Maha::BHUTA_PRITVI:
             $vargaRashi['rashi'] = Math::numberInCycle(4 + $result['units']);
             break;
         case Maha::BHUTA_VAYU:
             $vargaRashi['rashi'] = Math::numberInCycle(7 + $result['units']);
             break;
         case Maha::BHUTA_JALA:
             $vargaRashi['rashi'] = Math::numberInCycle(10 + $result['units']);
             break;
     }
     return $vargaRashi;
 }
Exemple #7
0
 /**
  * Set naisargika (natural) relations.
  * 
  * @see Maharishi Parashara. Brihat Parashara Hora Shastra. Chapter 3, Verse 55.
  */
 protected function setGrahaRelation()
 {
     $relation = [];
     $friendsFromMt = [2, 4, 5, 8, 9, 12];
     $enemiesFromMt = [3, 6, 7, 10, 11];
     $rashiMool = $this->grahaMool['rashi'];
     $rashiUcha = $this->grahaUcha['rashi'];
     $friends = [];
     $R = Rashi::getInstance($rashiUcha);
     $gFriend = $R->rashiRuler;
     if ($this->objectKey != $gFriend) {
         $friends[] = $gFriend;
     }
     $getRelation = function ($distance) use($rashiMool) {
         $grahas = [];
         foreach ($distance as $step) {
             $r = Math::numberInCycle($rashiMool, $step);
             $R = Rashi::getInstance((int) $r);
             $gRuler = $R->rashiRuler;
             if ($this->objectKey == $gRuler) {
                 continue;
             }
             $grahas[] = $gRuler;
         }
         return $grahas;
     };
     $friends = array_unique(array_merge($friends, $getRelation($friendsFromMt)));
     $enemies = array_unique($getRelation($enemiesFromMt));
     foreach (Graha::$graha as $key => $name) {
         if ($this->objectKey == $key) {
             continue;
         }
         if (in_array($key, $friends) && in_array($key, $enemies)) {
             $relation[$key] = 0;
         } elseif (in_array($key, $friends)) {
             $relation[$key] = 1;
         } elseif (in_array($key, $enemies)) {
             $relation[$key] = -1;
         } else {
             $G = Graha::getInstance($key, $this->getOptions());
             $relation[$key] = $G->grahaRelation[$this->objectKey];
         }
     }
     $relation[$this->objectKey] = $this->optionRelationSame ? 1 : null;
     $this->grahaRelation = $relation;
 }
Exemple #8
0
 /**
  * Any rashi aspected by its lord gets additional strength and those rashis 
  * receiving the aspect of the benefic planets Guru and Buddha also get 
  * additional strength.
  * 
  * @return array
  */
 protected function balaDrishti()
 {
     $bala = [];
     foreach (Rashi::$rashi as $rKey => $rName) {
         $Rashi = Rashi::getInstance($rKey)->setEnvironment($this->Data);
         $ruler = $Rashi->rashiRuler;
         $rashiIsAspected = $Rashi->isAspectedByRashi()['graha'];
         $bala[$rKey] = 0;
         foreach ([$ruler, Graha::KEY_GU, Graha::KEY_BU] as $gKey) {
             if ($this->getData()['graha'][$gKey]['rashi'] == $rKey || array_key_exists($gKey, $rashiIsAspected)) {
                 $bala[$rKey] += 60;
             }
         }
     }
     return $bala;
 }
Exemple #9
0
 /**
  * Get rulers of bhavas.
  * 
  * @param array $bhavas
  * @param string $vargaKey Varga key (optional)
  * @return array
  */
 public function getBhavaRulers(array $bhavas, $vargaKey = Varga::KEY_D1)
 {
     $vargaKeyUcf = ucfirst($vargaKey);
     $data = $this->getVargaData($vargaKeyUcf);
     $rulers = [];
     foreach ($bhavas as $bhava) {
         $Rashi = Rashi::getInstance($data['bhava'][$bhava]['rashi']);
         $rulers[] = $Rashi->rashiRuler;
     }
     $rulers = array_unique($rulers);
     return $rulers;
 }
Exemple #10
0
 /**
  * Get rulers of bhavas.
  * 
  * @param array $bhavas
  * @return array
  */
 public function getBhavaRulers(array $bhavas)
 {
     foreach ($bhavas as $bhava) {
         $Rashi = Rashi::getInstance($this->getData()['bhava'][$bhava]['rashi']);
         $rulers[] = $Rashi->rashiRuler;
     }
     $rulers = array_unique($rulers);
     return $rulers;
 }
Exemple #11
0
 /**
  * Get ruler of the bhava, where graha is positioned.
  * 
  * @return string
  */
 public function getDispositor()
 {
     $rashi = $this->getEnvironment()['graha'][$this->objectKey]['rashi'];
     $Rashi = Rashi::getInstance($rashi);
     return $Rashi->rashiRuler;
 }