Fix: correct ICRS camera orientation
This commit is contained in:
1 parent
e8deb1ff19
commit
b2ac642de7
7 files changed
+47
-27
No files matched your search
+8
-6
@@ -91,9 +91,11 @@ int catalog_load_csv(StarCatalog *catalog, const char *path)
|
||||
const double lat = latitude * PI / 180.0;
|
||||
const double cos_lat = cos(lat);
|
||||
Star *star = &catalog->stars[catalog->count++];
|
||||
/* Standard right-handed ICRS Cartesian axes: X is (RA, Dec) =
|
||||
* (0, 0), Y is (90, 0), and Z is the north celestial pole. */
|
||||
star->direction[0] = cos_lat * cos(lon);
|
||||
star->direction[1] = sin(lat);
|
||||
star->direction[2] = cos_lat * sin(lon);
|
||||
star->direction[1] = cos_lat * sin(lon);
|
||||
star->direction[2] = sin(lat);
|
||||
star->temperature_K = temperature;
|
||||
star->amplitude = amplitude;
|
||||
}
|
||||
@@ -170,10 +172,10 @@ int catalog_load_all_sky(StarCatalog *catalog, const char *directory)
|
||||
static void lon_lat_from_direction(const double direction[3], double *longitude,
|
||||
double *latitude)
|
||||
{
|
||||
*longitude = atan2(direction[2], direction[0]) * 180.0 / PI;
|
||||
*longitude = atan2(direction[1], direction[0]) * 180.0 / PI;
|
||||
if (*longitude < 0.0)
|
||||
*longitude += 360.0;
|
||||
*latitude = asin(fmax(-1.0, fmin(1.0, direction[1]))) * 180.0 / PI;
|
||||
*latitude = asin(fmax(-1.0, fmin(1.0, direction[2]))) * 180.0 / PI;
|
||||
}
|
||||
|
||||
static double dot(const double a[3], const double b[3])
|
||||
@@ -195,8 +197,8 @@ static void direction_from_lon_lat(double longitude, double latitude,
|
||||
const double lat = latitude * PI / 180.0;
|
||||
const double cos_lat = cos(lat);
|
||||
direction[0] = cos_lat * cos(lon);
|
||||
direction[1] = sin(lat);
|
||||
direction[2] = cos_lat * sin(lon);
|
||||
direction[1] = cos_lat * sin(lon);
|
||||
direction[2] = sin(lat);
|
||||
}
|
||||
|
||||
/* The minimum of a plane dot-product over a longitude/latitude rectangle is
|
||||
|
||||
Reference in new issue
Block a user