Ejemplo n.º 1
0
/*****************************************************
**
**   GenericNakshatraDasaExpert   ---   getKPLords
**
******************************************************/
KpData GenericNakshatraDasaExpert::getKPLords( const double &len )
{
	KpData kp;

	// 0...27 - ASWINI = 0 etc
	Nakshatra nak = getNakshatra27( len );

	// index of the first lord for that Nakshatra in the sequence of lords, e.g. Vimsottari has Sun, Moon, Mars, Rahu, Jupiter, Saturn, Mercury, Ketu, Venus
	int lord_index = getDasaIndex4Nakshatra( nak );

	// elapsed portion in the Nakshatra (0...1)
	double nakshatraPortion = getNakshatraLongitude27( len ) / NAKSHATRA_LEN;

	// elapsed time in years
	double elapsed = nakshatraPortion * getDasaDuration( lord_index );

	// total length in years (e.g. 120 for Vimsottari)
	double total_len = getParamayus();

	//printf( "START ------  CAll 1 KP len %f lord_index %d, portion %f elapsed %f total_len %f\n", len, lord_index, nakshatraPortion, elapsed, total_len );
	getKPLordRecursive( lord_index, elapsed, total_len );
	kp.lord = getDasaLordByIndex( lord_index );
	//printf( "CAll 2 KP len %f lord_index %d KPLORD %d, elapsed %f total_len %f\n", len, lord_index, kp.lord, elapsed, total_len );

	getKPLordRecursive( lord_index, elapsed, total_len );
	kp.sublord = getDasaLordByIndex( lord_index );
	//printf( "CAll 3 KP len %f lord_index %d KPLORD %d, elapsed %f total_len %f\n\n", len, lord_index,  kp.sublord, elapsed, total_len );

	getKPLordRecursive( lord_index, elapsed, total_len );
	kp.subsublord = getDasaLordByIndex( lord_index );
	//printf( "FINISHED   ------  CAll 4 KP len %f lord_index %d KPLORD %d, elapsed %f total_len %f\n\n", len, lord_index,  kp.subsublord, elapsed, total_len );

	return kp;
}
Ejemplo n.º 2
0
/*****************************************************
**
**   GenericNakshatraDasaExpert   ---   getFirstLevel
**
******************************************************/
vector<Dasa*> GenericNakshatraDasaExpert::getFirstLevel()
{
	vector<Dasa*> ret, tret;
	double nportion;
	int total_length = 0;
	Nakshatra nak;

	nportion = getPortion( nak );
	int pindex = getDasaIndex4Nakshatra( nak );
	int pl = getDasaLordByIndex( pindex );

	double start_jd = horoscope->getJD() - nportion * getDasaDuration( pindex ) * getYearLength( true );
	double end_jd = start_jd + getParamayus() * getYearLength( true );

	while ( total_length < 100 )
	{
		Dasa d( dasaId, pl, start_jd, end_jd, (Dasa*)NULL );
		d.setLevel( -1 );
		tret = getNextLevel( &d );
		for ( unsigned j = 0; j < tret.size(); j++ )
		{
			tret[j]->setParent( (Dasa*)NULL );
			ret.push_back( tret[j] );
		}
		tret.clear();
		total_length += getParamayus();
		start_jd = end_jd;
		end_jd += getParamayus() * getYearLength( true );
	}
	return ret;
}
Ejemplo n.º 3
0
/*****************************************************
**
**   GenericNakshatraDasaExpert   ---   getSolarDasa
**
******************************************************/
vector<Dasa*> GenericNakshatraDasaExpert::getSolarDasa( const Horoscope *solarchart, const int &year )
{
	vector<Dasa*> ret;
	int currentdasa;
	double start_jd, end_jd;

	// lenght of generic dasas is in days. Solar Dasa shifts from e.g. 120 y to 365.25 days
	//const double duration_factor = 365.25 / (double)getParamayus();
	const double duration_factor = getYearLength( true ) / (double)getParamayus();

	const int birthnaks = getNakshatra27( horoscope->getVedicLongitude( OMOON ));
	const int numyears = year - getYearForJD( horoscope->getJD());
	int basedasa = ( birthnaks + numyears - 2 ) % 9;
	if ( basedasa < 0 ) basedasa += 9;
	assert( basedasa >= 0 && basedasa < 9 );

	start_jd = solarchart->getJD();

	for( int i = 0; i < 9; i++ )
	{
		currentdasa = ( basedasa + i ) % 9;
		//printf( "DASA %d basedasa %d numyears %d\n", currentdasa, basedasa, numyears );
		end_jd = start_jd + duration_factor * getDasaDuration( currentdasa );

		ret.push_back( new Dasa( dasaId, getDasaLordByIndex( currentdasa ), start_jd, end_jd, (Dasa*)NULL ));
		start_jd = end_jd;
	}
	return ret;
}
Ejemplo n.º 4
0
/*****************************************************
**
**   VimsottariBaseDasaExpert   ---   getTara
**
******************************************************/
int VimsottariBaseDasaExpert::getTara( const int &planet, const int &nak )
{
	const bool upwards = true;
	int tara = 0;
	int count = 0;
	int lordindex = ( nak + 7 ) % 9;

	//assert(( planet >= ISUN ) && ( planet <= IKETU ));
	assert(( nak >= 0 ) && ( nak < 27 ));

	while (( getDasaLordByIndex( lordindex ) != planet ) && ( count++ < 20 ))
	{
		if ( upwards ) {
			if (++lordindex > 8 ) lordindex = 0;
		}
		else {
			if (--lordindex < 0 ) lordindex = 8;
		}
		tara++;
	}

	assert( count < 20 );
	assert( tara < 9 );
	return tara;
}
Ejemplo n.º 5
0
/*****************************************************
**
**   GenericNakshatraDasaExpert   ---   getKPEventList
**
******************************************************/
vector<KPEvent> GenericNakshatraDasaExpert::getKPEventList( const double &startlen, const double &endlen,
        const double &startjd )
{
	vector<KPEvent> events;
	Nakshatra currentnak;
	int currentlord, i, j, antarlord, antardasatime;
	double dasastartlen, antarstartlen, dist;
	bool append;

	Nakshatra startnak = getNakshatra27( startlen );

	for ( i = 0; i < 32; i++ )
	{
		currentnak = (Nakshatra)(((int)startnak + i ) % 27 );
		currentlord = getDasaIndex4Nakshatra( currentnak );
		dasastartlen = red_deg( ( startnak + i ) * 13.33333333 );
		antarstartlen = dasastartlen;

		for ( j = 0; j < getNbLords(); j++ )
		{
			append = true;
			antarlord = ( currentlord  + j ) % getNbLords();
			antardasatime = getDasaDuration( antarlord ); // years

			if ( i == 0 ) // cut off at the beginning (antardasas before starting point)
			{
				dist = antarstartlen - startlen;
				if ( dist < -300 ) dist += 360;  // correct if 360-deg shift
				if ( dist < 0 ) append = false;
			}
			if ( i >= 28 )  // cut off at the end (if event belongs to next time interval)
			{
				dist = antarstartlen - endlen;
				if ( dist > 300 ) dist -= 360;
				if ( dist < -300 ) dist += 360;
				if ( dist > 0 ) append = false;     // could also be return ?
			}
			if ( append )
				events.push_back( KPEvent( getDasaLordByIndex( currentlord ), getDasaLordByIndex( antarlord ),
					antarstartlen + .0000001, startjd + i + (double)j/getNbLords(), i ));
			antarstartlen += 13.333333333 * (double)antardasatime / getParamayus();
		}
	}

	return events;
}
Ejemplo n.º 6
0
/*****************************************************
**
**   VimsottariBaseDasaExpert   ---   getMahaDasaLength 
**
******************************************************/
int VimsottariBaseDasaExpert::getMahaDasaLength( const int &dasa )
{
	//assert( dasa >= 0 && dasa < 9 );
	for( int i = 0; i < 9; i++ )
	{
		if (getDasaLordByIndex( i ) == dasa )
		{
			return getDasaDuration( i );
		}
	}
	assert( 0 );
	return -1;
}
Ejemplo n.º 7
0
/*****************************************************
**
**   GenericNakshatraDasaExpert   ---   getNextLevel
**
******************************************************/
vector<Dasa*> GenericNakshatraDasaExpert::getNextLevel( Dasa *dasa )
{
	assert( dasa );

	vector<Dasa*> ret;
	Dasa *parent;

	double start_jd = dasa->getStartJD();
	double end_jd = dasa->getEndJD();
	double dasa_len = end_jd - start_jd;
	double antar_len = 0;
	int lord = -1;
	for ( int i = 0; i < getNbLords(); i++ )
	{
		if ( getDasaLordByIndex( i ) == dasa->getDasaLord() )
		{
			lord = i;
			break;
		}
	}
	assert( lord != -1 );

	parent = dasa;
	//printf( "GenericNakshatraDasaExpert::getNextLevel level %d parent %ld dasa %ld\n", dasa->getLevel(), (long)parent, (long)dasa );

	for ( int i = 0; i < getNbLords(); i++ )
	{
		antar_len = ( dasa_len * getDasaDuration( lord )) / getParamayus();
		end_jd = start_jd + antar_len;


		ret.push_back( new Dasa( dasaId, getDasaLordByIndex( lord ), start_jd, end_jd, parent ));

		lord = ( lord + 1 ) % getNbLords();
		start_jd = end_jd;
	}
	return ret;
}
Ejemplo n.º 8
0
/*****************************************************
**
**   YoginiDasaExpert   ---   getExtraLordName
**
******************************************************/
wxString YoginiDasaExpert::getExtraLordName( Dasa *dasa, const TEXT_FORMAT format )
{
	assert( dasa );

	const wxString k_yogini[8] = { _( "Mangala" ), _( "Pingala" ), _( "Dhanya" ), _( "Bhramari" ),
		_( "Bhadrika" ), _( "Ulka" ), _( "Siddha" ), _( "Sankata" ) };

	int i = 0;
	for( i = 0; i < 8; i++ )
	{
		if ( getDasaLordByIndex( i ) == dasa->getDasaLord() )
		{
			break;
		}
	}
	assert( i >= 0 && i < 8 );
	if ( format == TF_LONG ) return k_yogini[i];
	else return wxString( k_yogini[i] ).Left( 3 );
}