コード例 #1
0
ファイル: Vimshottari.php プロジェクト: mykitty/jyotish
 /**
  * Get start period.
  * 
  * @return array
  */
 public function getStartPeriod()
 {
     $nakshatra = $this->getData()['panchanga']['nakshatra'];
     $N = Nakshatra::getInstance($nakshatra['key']);
     $result['graha'] = $N->nakshatraRuler;
     $result['total'] = $this->durationTotal * Astro::DURATION_YEAR_GREGORIAN * 86400;
     $duration = $this->durationGraha[$result['graha']] * Astro::DURATION_YEAR_GREGORIAN * 86400;
     $result['start'] = round($duration * (100 - $nakshatra['left']) / 100);
     return $result;
 }
コード例 #2
0
ファイル: AngaDefiner.php プロジェクト: kunjara/jyotish
 /**
  * Get Nakshatra. Ending Moment of asterism of the day, that is, the stellar 
  * mansion in which graha is located for an observer at the center of the Earth. 
  * 
  * @param bool $withLimit Time limit
  * @param bool $withAbhijit Take into account the Abhijit nakshatra
  * @param string $grahaKey Graha key (default: Ch)
  * @return array
  */
 public function getNakshatra($withLimit = false, $withAbhijit = false, $grahaKey = Graha::KEY_CH)
 {
     $this->checkData(__FUNCTION__);
     $unit = 360 / 27;
     if (array_key_exists($grahaKey, Graha::$graha)) {
         $lngGraha = $this->getData()['graha'][$grahaKey]['longitude'];
     } else {
         if (!isset($this->getData()['lagna'][$grahaKey]['longitude'])) {
             throw new Exception\InvalidArgumentException("Longitude value for the key '{$grahaKey}' is not defined.");
         } else {
             $lngGraha = $this->getData()['lagna'][$grahaKey]['longitude'];
         }
     }
     $nakshatraUnits = Math::partsToUnits($lngGraha, $unit);
     $nakshatra = [];
     $nakshatra['anga'] = Panchanga::ANGA_NAKSHATRA;
     if ($withAbhijit) {
         if ($nakshatraUnits['units'] == 21 || $nakshatraUnits['units'] == 22) {
             $Abhijit = Nakshatra::getInstance(28);
             $abhijitStart = Math::dmsToDecimal($Abhijit->nakshatraStart);
             $abhijitEnd = Math::dmsToDecimal($Abhijit->nakshatraEnd);
             if ($lngGraha < $abhijitStart) {
                 $nakshatra['key'] = 21;
                 $N = Nakshatra::getInstance($nakshatra['key']);
                 $nStart = Math::dmsToDecimal($N->nakshatraStart);
                 $unit = $abhijitStart - $nStart;
                 $left = $abhijitStart - $lngGraha;
             } elseif ($lngGraha >= $abhijitStart && $lngGraha < $abhijitEnd) {
                 $nakshatra['key'] = 28;
                 $unit = $abhijitEnd - $abhijitStart;
                 $left = $abhijitEnd - $lngGraha;
             } else {
                 $nakshatra['key'] = 22;
                 $N = Nakshatra::getInstance($nakshatra['key']);
                 $nEnd = Math::dmsToDecimal($N->nakshatraEnd);
                 $unit = $nEnd - $abhijitEnd;
                 $left = $nEnd - $lngGraha;
             }
             $nakshatra['ratio'] = $unit / Math::dmsToDecimal(Nakshatra::$arc);
         } else {
             $nakshatra['key'] = $nakshatraUnits['units'];
             $nakshatra['ratio'] = 1;
             $left = $unit - $nakshatraUnits['parts'];
         }
         $nakshatra['abhijit'] = true;
     } else {
         $nakshatra['key'] = $nakshatraUnits['units'];
         $nakshatra['ratio'] = 1;
         $nakshatra['abhijit'] = false;
         $left = $unit - $nakshatraUnits['parts'];
     }
     $nakshatra['left'] = $left * 100 / $unit;
     $nakshatra['name'] = Nakshatra::$nakshatra[$nakshatra['key']];
     if ($nakshatra['left'] < 100 && $nakshatra['left'] >= 75) {
         $nakshatra['pada'] = 1;
     } elseif ($nakshatra['left'] < 75 && $nakshatra['left'] >= 50) {
         $nakshatra['pada'] = 2;
     } elseif ($nakshatra['left'] < 50 && $nakshatra['left'] >= 25) {
         $nakshatra['pada'] = 3;
     } else {
         $nakshatra['pada'] = 4;
     }
     if ($withLimit) {
         $this->AngaDefiner = clone $this;
         $limit = $this->getAngaLimit($nakshatra);
         $nakshatra['end'] = $limit;
         $this->AngaDefiner = null;
     }
     return $nakshatra;
 }
コード例 #3
0
ファイル: Ashtottari.php プロジェクト: mykitty/jyotish
 /**
  * Constructor
  * 
  * @param null|array $options Options to set (optional)
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $nakshatras = Nakshatra::listNakshatra(true);
     $this->orderNakshatra = Math::shiftArray($nakshatras, 6, true);
 }