@ -48,9 +48,9 @@
* @ moon_phase : the calculated Moon phase data
* @ aspect_list : ( element - type GsweAspectData ) : the list of calculated aspects
* @ aspect_revision : the revision of the aspect data
* @ mirrorpoint_list: ( element - type GsweMirror Data) : the list of calculated
* mirrorpoints ( antiscia )
* @ mirrorpoint_revision: the revision of the mirrorpoint data
* @ antiscia_list: ( element - type GsweAntiscia Data) : the list of calculated
* antiscia ( mirror points)
* @ antiscia_revision: the revision of the antiscia data
*/
struct _GsweMomentPrivate {
GsweTimestamp * timestamp ;
@ -67,8 +67,8 @@ struct _GsweMomentPrivate {
GsweMoonPhaseData moon_phase ;
GList * aspect_list ;
guint aspect_revision ;
GList * mirrorpoint _list;
guint mirrorpoint _revision;
GList * antiscia _list;
guint antiscia _revision;
} ;
enum {
@ -155,14 +155,14 @@ gswe_moment_init(GsweMoment *moment)
moment - > priv - > house_list = NULL ;
moment - > priv - > planet_list = NULL ;
moment - > priv - > aspect_list = NULL ;
moment - > priv - > mirrorpoint _list = NULL ;
moment - > priv - > antiscia _list = NULL ;
moment - > priv - > element_points = g_hash_table_new_full ( g_direct_hash , g_direct_equal , NULL , NULL ) ;
moment - > priv - > quality_points = g_hash_table_new_full ( g_direct_hash , g_direct_equal , NULL , NULL ) ;
moment - > priv - > house_revision = 0 ;
moment - > priv - > points_revision = 0 ;
moment - > priv - > moon_phase_revision = 0 ;
moment - > priv - > aspect_revision = 0 ;
moment - > priv - > mirrorpoint _revision = 0 ;
moment - > priv - > antiscia _revision = 0 ;
moment - > priv - > revision = 1 ;
}
@ -316,7 +316,7 @@ gswe_moment_get_timestamp(GsweMoment *moment)
*
* Sets the coordinates associated with @ moment . Emits the : : changed signal on
* @ moment . All values depending on the coordinates ( planetary and house cusp
* positions , aspects , mirrorpoints , so basically everything ) should be
* positions , aspects , antiscion , so basically everything ) should be
* re - fetched after changing it .
*/
void
@ -1038,46 +1038,45 @@ gswe_moment_get_planet_aspects(GsweMoment *moment, GswePlanet planet, GError **e
}
static gboolean
find_ mirror( gpointer mirror_p , GsweMirrorInfo * mirror_info , GsweMirrorData * mirror _data)
find_ antiscion( GsweAntiscionAxis * axis , GsweAntiscionInfo * antiscion_info , GsweAntiscionData * antiscion _data)
{
GsweMirror mirror = GPOINTER_TO_INT ( mirror_p ) ;
gdouble start_point ,
mirror _position,
axis _position,
planet_orb ;
if ( mirror = = GSWE_MIRROR _NONE) {
if ( * axis = = GSWE_ANTISCION_AXIS _NONE) {
return FALSE ;
}
planet_orb = fmin ( mirror _data- > planet1 - > planet_info - > orb , mirror _data- > planet2 - > planet_info - > orb ) ;
start_point = ( mirror _info- > start_sign - > sign_id - 1 ) * 30.0 ;
planet_orb = fmin ( antiscion _data- > planet1 - > planet_info - > orb , antiscion _data- > planet2 - > planet_info - > orb ) ;
start_point = ( antiscion _info- > start_sign - > sign_id - 1 ) * 30.0 ;
if ( mirror _info- > middle_axis = = TRUE ) {
if ( antiscion _info- > middle_axis = = TRUE ) {
start_point + = 15.0 ;
}
mirror_position = 2 * start_point - mirror _data- > planet1 - > position ;
axis_position = 2 * start_point - antiscion _data- > planet1 - > position ;
if ( mirror _position < 0 ) {
mirror _position + = 360.0 ;
if ( axis _position < 0 ) {
axis _position + = 360.0 ;
}
if ( ( mirror_data- > difference = fabs ( mirror_data - > planet2 - > position - mirror _position) ) < = planet_orb ) {
mirror_data- > mirror_info = mirror _info;
mirror_data- > mirror = mirror ;
if ( ( antiscion_data- > difference = fabs ( antiscion_data - > planet2 - > position - axis _position) ) < = planet_orb ) {
antiscion_data- > antiscion_info = antiscion _info;
antiscion_data- > axis = * axis ;
return TRUE ;
} else {
mirror _data- > difference = 0.0 ;
antiscion _data- > difference = 0.0 ;
}
return FALSE ;
}
static gint
find_ mirror_by_both_planets( GsweMirrorData * mirror , struct GsweAspectFinder * mirror _finder)
find_ antiscion_by_both_planets( GsweAntiscionData * antiscion , struct GsweAspectFinder * antiscion _finder)
{
if ( ( ( mirror - > planet1 - > planet_id = = mirror_finder- > planet1 ) & & ( mirror - > planet2 - > planet_id = = mirror _finder- > planet2 ) ) | | ( ( mirror - > planet1 - > planet_id = = mirror_finder- > planet2 ) & & ( mirror - > planet2 - > planet_id = = mirror _finder- > planet1 ) ) ) {
if ( ( ( antiscion - > planet1 - > planet_id = = antiscion_finder- > planet1 ) & & ( antiscion - > planet2 - > planet_id = = antiscion _finder- > planet2 ) ) | | ( ( antiscion - > planet1 - > planet_id = = antiscion_finder- > planet2 ) & & ( antiscion - > planet2 - > planet_id = = antiscion _finder- > planet1 ) ) ) {
return 0 ;
}
@ -1085,90 +1084,90 @@ find_mirror_by_both_planets(GsweMirrorData *mirror, struct GsweAspectFinder *mir
}
static void
gswe_moment_calculate_ mirrorpoints ( GsweMoment * moment )
gswe_moment_calculate_ antiscia ( GsweMoment * moment )
{
GList * oplanet ,
* iplanet ;
if ( moment - > priv - > mirrorpoint _revision = = moment - > priv - > revision ) {
if ( moment - > priv - > antiscia _revision = = moment - > priv - > revision ) {
return ;
}
gswe_moment_calculate_all_planets ( moment ) ;
g_list_free_full ( moment - > priv - > mirrorpoint _list, g_free ) ;
g_list_free_full ( moment - > priv - > antiscia _list, g_free ) ;
for ( oplanet = moment - > priv - > planet_list ; oplanet ; oplanet = oplanet - > next ) {
for ( iplanet = moment - > priv - > planet_list ; iplanet ; iplanet = iplanet - > next ) {
GswePlanetData * outer_planet = oplanet - > data ,
* inner_planet = iplanet - > data ;
Gswe MirrorData * mirror _data;
struct GsweAspectFinder mirror _finder;
Gswe AntiscionData * antiscion _data;
struct GsweAspectFinder antiscion _finder;
if ( outer_planet - > planet_id = = inner_planet - > planet_id ) {
continue ;
}
mirror _finder. planet1 = outer_planet - > planet_id ;
mirror _finder. planet2 = inner_planet - > planet_id ;
antiscion _finder. planet1 = outer_planet - > planet_id ;
antiscion _finder. planet2 = inner_planet - > planet_id ;
if ( g_list_find_custom ( moment - > priv - > mirrorpoint_list, & mirror_finder , ( GCompareFunc ) find_mirror _by_both_planets) ! = NULL ) {
if ( g_list_find_custom ( moment - > priv - > antiscia_list, & antiscion_finder , ( GCompareFunc ) find_antiscion _by_both_planets) ! = NULL ) {
continue ;
}
mirror_data = g_new0 ( GsweMirror Data, 1 ) ;
mirror _data- > planet1 = outer_planet ;
mirror _data- > planet2 = inner_planet ;
mirror_data- > mirror = GSWE_MIRROR _NONE;
antiscion_data = g_new0 ( GsweAntiscion Data, 1 ) ;
antiscion _data- > planet1 = outer_planet ;
antiscion _data- > planet2 = inner_planet ;
antiscion_data- > axis = GSWE_ANTISCION_AXIS _NONE;
( void ) g_hash_table_find ( gswe_ mirror_info_table, ( GHRFunc ) find_mirror , mirror _data) ;
( void ) g_hash_table_find ( gswe_ antiscion_info_table, ( GHRFunc ) find_antiscion , antiscion _data) ;
if ( mirror_data- > mirror = = GSWE_MIRROR _NONE) {
mirror_data- > mirror_info = g_hash_table_lookup ( gswe_mirror_info_table , GINT_TO_POINTER ( GSWE_MIRROR _NONE) ) ;
if ( antiscion_data- > axis = = GSWE_ANTISCION_AXIS _NONE) {
antiscion_data- > antiscion_info = g_hash_table_lookup ( gswe_antiscion_info_table , GINT_TO_POINTER ( GSWE_ANTISCION_AXIS _NONE) ) ;
}
moment - > priv - > mirrorpoint _list = g_list_prepend ( moment - > priv - > mirrorpoint_list, mirror _data) ;
moment - > priv - > antiscia _list = g_list_prepend ( moment - > priv - > antiscia_list, antiscion _data) ;
}
}
moment - > priv - > mirrorpoint _revision = moment - > priv - > revision ;
moment - > priv - > antiscia _revision = moment - > priv - > revision ;
}
/**
* gswe_moment_get_all_ mirrorpoints :
* gswe_moment_get_all_ antiscia :
* @ moment : The GsweMoment object to operate on .
*
* Get all found mirrorpoints between planets in @ moment .
* Get all found antiscia between planets in @ moment .
*
* Returns : ( element - type Gswe Mirror Data) ( transfer none ) : A # GList of
* # Gswe Mirror Data.
* Returns : ( element - type Gswe Antiscion Data) ( transfer none ) : A # GList of
* # Gswe Antiscion Data.
*/
GList *
gswe_moment_get_all_ mirrorpoints ( GsweMoment * moment )
gswe_moment_get_all_ antiscia ( GsweMoment * moment )
{
gswe_moment_calculate_ mirrorpoints ( moment ) ;
gswe_moment_calculate_ antiscia ( moment ) ;
return moment - > priv - > mirrorpoint _list;
return moment - > priv - > antiscia _list;
}
/**
* gswe_moment_get_all_planet_ mirrorpoints :
* gswe_moment_get_all_planet_ antiscia :
* @ moment : The GsweMoment object to operate on .
* @ planet : The planet whose mirrorpoint planets are requested .
* @ planet : The planet whose antiscion planets are requested .
* @ err : a # GError
*
* Get all the mirrorpoint planets on all registered mirror s for @ planet .
* Get all the antiscion planets on all registered axe s for @ planet .
*
* Returns : ( element - type Gswe Mirror Data) ( transfer container ) : a # GList of
* # Gswe MirrorData. The GsweMirror Data structures belong to @ moment ,
* but the GList should be freed using g_list_free ( ) . If no planet
* has any mirrorpoints , or the planet has not been added to @ moment ,
* returns NULL .
* Returns : ( element - type Gswe Antiscion Data) ( transfer container ) : a # GList of
* # Gswe AntiscionData. The GsweAntiscion Data structures belong to
* @ moment , but the GList should be freed using g_list_free ( ) . If no
* planet has any antiscia , or the planet has not been added to
* @ moment , returns NULL .
*/
GList *
gswe_moment_get_all_planet_ mirrorpoints ( GsweMoment * moment , GswePlanet planet , GError * * err )
gswe_moment_get_all_planet_ antiscia ( GsweMoment * moment , GswePlanet planet , GError * * err )
{
GList * ret = NULL ,
* mirror ;
* antiscion ;
if ( ! gswe_moment_has_planet ( moment , planet ) ) {
g_set_error ( err , GSWE_MOMENT_ERROR , GSWE_MOMENT_ERROR_NONADDED_PLANET , " Specified planet is not added to the moment object " ) ;
@ -1176,13 +1175,13 @@ gswe_moment_get_all_planet_mirrorpoints(GsweMoment *moment, GswePlanet planet, G
return NULL ;
}
gswe_moment_calculate_ mirrorpoints ( moment ) ;
gswe_moment_calculate_ antiscia ( moment ) ;
for ( mirror = moment - > priv - > mirrorpoint_list ; mirror ; mirror = mirror - > next ) {
Gswe MirrorData * mirror_data = mirror - > data ;
for ( antiscion = moment - > priv - > antiscia_list ; antiscion ; antiscion = g_list_next ( antiscion ) ) {
Gswe AntiscionData * antiscion_data = antiscion - > data ;
if ( ( mirror _data- > planet1 - > planet_id = = planet ) | | ( mirror _data- > planet2 - > planet_id = = planet ) ) {
ret = g_list_prepend ( ret , mirror _data) ;
if ( ( antiscion _data- > planet1 - > planet_id = = planet ) | | ( antiscion _data- > planet2 - > planet_id = = planet ) ) {
ret = g_list_prepend ( ret , antiscion _data) ;
}
}
@ -1190,30 +1189,30 @@ gswe_moment_get_all_planet_mirrorpoints(GsweMoment *moment, GswePlanet planet, G
}
/**
* gswe_moment_get_ mirror_all_mirrorpoints :
* gswe_moment_get_ axis_all_antiscia :
* @ moment : The GsweMoment object to operate on .
* @ mirror: The mirror on which you want to search for mirrored planets .
* @ axis: The axis on which you want to search for antiscion planets .
*
* Get all the mirrorpoint planets on the specified mirror @ mirror .
* Get all the antiscion planets on the specified axis @ axis .
*
* Returns : ( element - type Gswe Mirror Data) ( transfer container ) : a # GList of
* # Gswe MirrorData. The GsweMirror Data structures belong to @ moment ,
* Returns : ( element - type Gswe Antiscion Data) ( transfer container ) : a # GList of
* # Gswe AntiscionData. The GsweAntiscion Data structures belong to @ moment ,
* but the GList should be freed using g_list_free ( ) . If there are
* no mirrored planets on the given mirror , returns NULL .
* no antiscion planets on the given axis , returns NULL .
*/
GList *
gswe_moment_get_ mirror_all_mirrorpoints( GsweMoment * moment , GsweMirror mirror )
gswe_moment_get_ axis_all_antiscia( GsweMoment * moment , GsweAntiscionAxis axis )
{
GList * ret = NULL ,
* mirror _l;
* antiscion _l;
gswe_moment_calculate_ mirrorpoints ( moment ) ;
gswe_moment_calculate_ antiscia ( moment ) ;
for ( mirror_l = moment - > priv - > mirrorpoint_list ; mirror_l ; mirror_l = mirror_l - > next ) {
Gswe MirrorData * mirror_data = mirror _l- > data ;
for ( antiscion_l = moment - > priv - > antiscia_list ; antiscion_l ; antiscion_l = g_list_next ( antiscion_l ) ) {
Gswe AntiscionData * antiscion_data = antiscion _l- > data ;
if ( mirror_data- > mirror = = mirror ) {
ret = g_list_prepend ( ret , mirror _data) ;
if ( antiscion_data- > axis = = axis ) {
ret = g_list_prepend ( ret , antiscion _data) ;
}
}
@ -1221,25 +1220,25 @@ gswe_moment_get_mirror_all_mirrorpoints(GsweMoment *moment, GsweMirror mirror)
}
/**
* gswe_moment_get_ mirror_planet_mirrorpoints :
* gswe_moment_get_ axis_planet_antiscia :
* @ moment : the GsweMoment object to operate on
* @ mirror: the mirror on which you want to search for mirrored planets
* @ planet : the planet whose mirrorpoint planets are requested
* @ axis: the axis on which you want to search for antiscion planets
* @ planet : the planet whose antiscion planets are requested
* @ err : a # GError
*
* Get the mirrorpoint planets of @ planet as seen in @ mirror .
* Get the antiscion planets of @ planet as seen in @ axis .
*
* Returns : ( element - type Gswe Mirror Data) ( transfer container ) : a # GList of
* # Gswe MirrorData. The GsweMirror Data structires belong to @ moment ,
* Returns : ( element - type Gswe Antiscion Data) ( transfer container ) : a # GList of
* # Gswe AntiscionData. The GsweAntiscion Data structires belong to @ moment ,
* but the GList should be freed using g_list_free ( ) . If the planet
* has no mirrorpoints , or the planet has not been added to @ moment ,
* has no antiscia , or the planet has not been added to @ moment ,
* returns NULL .
*/
GList *
gswe_moment_get_ mirror_planet_mirrorpoints( GsweMoment * moment , GsweMirror mirror , GswePlanet planet , GError * * err )
gswe_moment_get_ axis_planet_antiscia( GsweMoment * moment , GsweAntiscionAxis axis , GswePlanet planet , GError * * err )
{
GList * ret = NULL ,
* mirror _l;
* antiscion _l;
if ( ! gswe_moment_has_planet ( moment , planet ) ) {
g_set_error ( err , GSWE_MOMENT_ERROR , GSWE_MOMENT_ERROR_NONADDED_PLANET , " Specified planet is not added to the moment object " ) ;
@ -1247,13 +1246,13 @@ gswe_moment_get_mirror_planet_mirrorpoints(GsweMoment *moment, GsweMirror mirror
return NULL ;
}
gswe_moment_calculate_ mirrorpoints ( moment ) ;
gswe_moment_calculate_ antiscia ( moment ) ;
for ( mirror_l = moment - > priv - > mirrorpoint_list ; mirror_l ; mirror_l = mirror_l - > next ) {
Gswe MirrorData * mirror_data = mirror _l- > data ;
for ( antiscion_l = moment - > priv - > antiscia_list ; antiscion_l ; antiscion_l = g_list_next ( antiscion_l ) ) {
Gswe AntiscionData * antiscion_data = antiscion _l- > data ;
if ( ( ( mirror _data- > planet1 - > planet_id = = planet ) | | ( mirror _data- > planet2 - > planet_id = = planet ) ) & & ( mirror_data- > mirror = = mirror ) ) {
ret = g_list_prepend ( ret , mirror _data) ;
if ( ( ( antiscion _data- > planet1 - > planet_id = = planet ) | | ( antiscion _data- > planet2 - > planet_id = = planet ) ) & & ( antiscion_data- > axis = = axis ) ) {
ret = g_list_prepend ( ret , antiscion _data) ;
}
}