Ejemplo n.º 1
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.º 2
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.º 3
0
void getTimeSpanInts( int &year, int &month, int &day, const double &length, const bool &vedic )
{
	double yeard, monthd, dayd;

	yeard = length/ getYearLength( vedic );
	year = (int)yeard;
	monthd = ( yeard - (double)year ) * 12;
	month = (int)monthd;
	dayd = ( monthd - (double)month ) * 30;
	dayd += .000000000001;
	day = (int)dayd;
}
Ejemplo n.º 4
0
void getDasaDurationInts( int &year, int &month, int &day, double length )
{
	double yeard, monthd, dayd;

	yeard = length/getYearLength( true );
	year = (int)yeard;
	monthd = ( yeard - (double)year ) * 12;
	month = (int)monthd;
	dayd = ( monthd - (double)month ) * 30;
	dayd += .00001;
	day = (int)dayd;
}
Ejemplo n.º 5
0
wxString getDasaDuration( const double &length )
{
	wxString buf;
// YEAR_LEN is 365.25;
#define MY_NULL .00000001
	int years, months, days, hours, minutes, seconds;
	double yeard, monthd, dayd, hourd, minuted, secondd;

	buf = wxT( " --- " );
	wxChar yd, md = 'M', dd;
	yd = ( config->lang == wxT( "de" ) ? 'J' : 'Y' );
	dd = ( config->lang == wxT( "de" ) ? 'T' : 'D' );

	yeard = length/getYearLength( true );
	years = (int)yeard;
	monthd = ( yeard - (double)years ) * 12;
	if ( ::fabs( monthd ) < MY_NULL )
	{
		buf.Printf( wxT( "%d%c" ), years, yd );
		//if ( years > 1 ) strcat( buf, "s" );
		return buf;
	}
	months = (int)monthd;
	dayd = ( monthd - (double)months ) * 30;
	dayd += .00001;
	if ( ::fabs( dayd ) < MY_NULL )
	{
		buf.Printf( wxT( "%d%c %d%c" ), years, yd, months, md );
		return buf;
	}
	days = (int)dayd;
	hourd = ( dayd - (double)days ) * 24;
	if ( years > 0 || months > 0 )
	{
		buf.Printf( wxT( "%d%c %d%c %d%c" ), years, yd, months, md, days, dd );
		return buf;
	}
	hours = (int)hourd;
	minuted = ( hourd - (double)hours ) * 60;
	minutes = (int)minuted;
	secondd = ( minuted - (double)minutes ) * 60;
	seconds = (int)secondd;
	buf.Printf( wxT( "%d%c %02d:%02d:%02d" ), days, dd, hours, minutes, seconds );

	return buf;
}
Ejemplo n.º 6
0
/*****************************************************
**
**   AshtottariDasaExpert   ---   getFirstLevel
**
******************************************************/
vector<Dasa*> AshtottariDasaExpert::getFirstLevel( const Horoscope *h, const int varga )
{
	vector<Dasa*> ret;

	int mnak = getNakshatra( h->getVedicLength( OMOON ), N28 );
	int startn = mnak - 5;
	if ( startn < 0 ) startn += 28;

	double nportion, portion;
	//if ( varga == 0 ) nportion = h->getNakshatraPortion();
	nportion = ::getNakshatraLength( h->getVedicLength( OMOON ), N28 ) / 13.33333333;

	int pindex;

	// Ardra, Punarvasu, Pusyami, Ashlesha
	if ( startn < 4 )
	{
		// Sun dasa
		pindex = 0;
		portion = ( startn + nportion ) / 4;
	}
	// Makha, P.Phalguni, U.Phalguni
	else if ( startn < 7 )
	{
		// Moon dasa
		pindex = 1;
		portion = ( startn - 4 + nportion ) / 4;
	}
	// Hasta, Chitta, Swati, Vishakha
	else if ( startn < 11 )
	{
		// Mars dasa
		pindex = 2;
		portion = ( startn - 7 + nportion ) / 4;
	}
	// Anuradha, Jyeshta, Moola
	else if ( startn < 14 )
	{
		// Mercury dasa
		pindex = 3;
		portion = ( startn - 11 + nportion ) / 4;
	}
	// P.Shadha, U.Shadha, Abhijit, Sravana
	else if ( startn < 18 )
	{
		// Saturn dasa
		pindex = 4;
		portion = ( startn - 14 + nportion ) / 4;
	}
	// Dhanista, Satabhish, P.Bhadra
	else if ( startn < 21 )
	{
		// Jupiter dasa
		pindex = 5;
		portion = ( startn - 18 + nportion ) / 4;
	}
	// U.Bhadra, Revati, Aswini, Bharani
	else if ( startn < 25 )
	{
		// Rahu dasa
		pindex = 6;
		portion = ( startn - 21 + nportion ) / 4;
	}
	// Krittika, Rohini, Mrigasira
	else if ( startn < 28 )
	{
		// Venus dasa
		pindex = 7;
		portion = ( startn - 25 + nportion ) / 4;
	}
	else
	{
		wxLogError( wxT( "Error Nakshatra index in Ashtottari is %d, exiting." ), startn );
		exit(1);
	}

	int dlord = dasa_lord[pindex];
	double start_jd = h->getJD() - portion * dasa_dur[pindex] * getYearLength( true );
	double end_jd;

	for ( int i = 0; i < 8; i++ )
	{
		end_jd = start_jd + dasa_dur[pindex] * getYearLength( true );
		ret.push_back( new DasaImpl( this, dlord, start_jd, end_jd, 0, 0 ));

		pindex = ( pindex + 1 ) % 8;
		dlord = dasa_lord[pindex];
		start_jd = end_jd;
	}

	return ret;
}