Created the get_house() function
This commit is contained in:
parent
3a3e441e9e
commit
e886f8d194
@ -20,6 +20,33 @@ const signTypePair_t signType[] = {
|
|||||||
{ TYPE_MUTABLE, ELEMENT_WATER, SE_NEPTUNE, SE_JUPITER, SE_MERCURY, SE_VENUS, SE_MERCURY }, // Pisces
|
{ TYPE_MUTABLE, ELEMENT_WATER, SE_NEPTUNE, SE_JUPITER, SE_MERCURY, SE_VENUS, SE_MERCURY }, // Pisces
|
||||||
};
|
};
|
||||||
|
|
||||||
|
guint
|
||||||
|
get_house(gdouble position, gdouble cusps[])
|
||||||
|
{
|
||||||
|
guint i,
|
||||||
|
house = 0;
|
||||||
|
|
||||||
|
for (i = 1; i < 13; i++) {
|
||||||
|
int j = (i < 12) ? i + 1 : 1;
|
||||||
|
|
||||||
|
if (cusps[j] < cusps[i]) {
|
||||||
|
if ((position >= cusps[i]) || (position < cusps[j])) {
|
||||||
|
house = i;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((position >= cusps[i]) && (position < cusps[j])) {
|
||||||
|
house = i;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return house;
|
||||||
|
}
|
||||||
|
|
||||||
planetInfo_t *
|
planetInfo_t *
|
||||||
get_planet_info(int32 planetNo, double date, double cusps[])
|
get_planet_info(int32 planetNo, double date, double cusps[])
|
||||||
{
|
{
|
||||||
@ -28,7 +55,6 @@ get_planet_info(int32 planetNo, double date, double cusps[])
|
|||||||
double x2[6];
|
double x2[6];
|
||||||
char serr[AS_MAXCH];
|
char serr[AS_MAXCH];
|
||||||
planetInfo_t *ret = g_new0(planetInfo_t, 1);
|
planetInfo_t *ret = g_new0(planetInfo_t, 1);
|
||||||
int i;
|
|
||||||
|
|
||||||
iflgret = swe_calc(date, planetNo, iflag, x2, serr);
|
iflgret = swe_calc(date, planetNo, iflag, x2, serr);
|
||||||
|
|
||||||
@ -40,25 +66,7 @@ get_planet_info(int32 planetNo, double date, double cusps[])
|
|||||||
printf("warning: iflgret != iflag. %s\n", serr);
|
printf("warning: iflgret != iflag. %s\n", serr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->house = 0;
|
ret->house = get_house(x2[0], cusps);
|
||||||
|
|
||||||
for (i = 1; i < 13; i++) {
|
|
||||||
int j = (i < 12) ? i + 1 : 1;
|
|
||||||
|
|
||||||
if (cusps[j] < cusps[i]) {
|
|
||||||
if ((x2[0] >= cusps[i]) || (x2[0] < cusps[j])) {
|
|
||||||
ret->house = i;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((x2[0] >= cusps[i]) && (x2[0] < cusps[j])) {
|
|
||||||
ret->house = i;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret->position = x2[0];
|
ret->position = x2[0];
|
||||||
ret->sign = (int)ceilf(x2[0] / 30.0);
|
ret->sign = (int)ceilf(x2[0] / 30.0);
|
||||||
|
@ -68,6 +68,7 @@ typedef struct {
|
|||||||
signElement_t element;
|
signElement_t element;
|
||||||
} planetInfo_t;
|
} planetInfo_t;
|
||||||
|
|
||||||
|
guint get_house(gdouble position, gdouble cusps[]);
|
||||||
planetInfo_t *get_planet_info(int32 planetNo, double date, double cusps[]);
|
planetInfo_t *get_planet_info(int32 planetNo, double date, double cusps[]);
|
||||||
int set_location_and_time(double lon, double lat, double alt, int year, int month, int day, int hour, int min, double sec, double d_timezone, double *jd);
|
int set_location_and_time(double lon, double lat, double alt, int year, int month, int day, int hour, int min, double sec, double d_timezone, double *jd);
|
||||||
long int get_sign(double pos);
|
long int get_sign(double pos);
|
||||||
|
Loading…
Reference in New Issue
Block a user