Spacecraft Control Framework 1.0
Spacecraft Control Library
sc_star_catalog.h
Go to the documentation of this file.
1//
2// sc_star_catalog.h
3// SCControl
4//
5// Created by Stephanie Thomas on 11/17/15.
6//
7//
8
15#ifndef __SCControl__sc_star_catalog__
16#define __SCControl__sc_star_catalog__
17
18#include <stdio.h>
19#include <map>
20#include <vector>
21#include <string>
22#include <algorithm>
23using namespace std; // It may be a bad idea to put this in a header, but it works.
24
25#ifdef AS_OS_WINDOWS
26#include "matrixlib.h"
27#else
28#include <MatrixLib/MatrixLib.h>
29#endif
30
37class star
38{
39 private:
41 int hipparcos_id;
43 double right_ascension;
45 double declination;
47 double visual_magnitude;
48 double parallax;
50 double proper_motion_ascension;
52 double proper_motion_declination;
53 double radial_velocity;
54
55public:
56 star();
57 star(int id, double VM, double right_ascension, double declination);
58 void set_motion_terms(double parallax, double pm_ascension, double pm_declination, double radialV);
60 ml_matrix CalculateVector( double jd_now, double jd_catalog ) const;
62 ml_matrix UnitVector( void ) const;
64 int get_id() const;
66 double get_ascension() const;
68 double get_declination() const;
70 double get_magnitude() const;
71};
72
80{
81 friend class near_matrix;
82private:
84 map<int,star> star_map;
86 double julianDate;
87 string name;
88 void LoadStarMatrix(ml_matrix starData);
89 bool status;
90public:
93 star_catalog(ml_matrix starData,double date=2448347.75);
95 star_catalog(const char* fileName,double date=2448347.75);
97 void set_date(double newDate);
99 void set_name(string newName);
101 star* get_star(int id);
103 const double get_date();
105 const string get_name();
107 const int size();
109 const ml_matrix unit_vectors(double jd_now);
111 const ml_matrix visual_magnitude();
113 const ml_int_array hipparcos_ids();
115 int remove_stars(double angleTol);
117 bool is_valid() {return status;};
118};
119
121enum DotDirection { FORWARD=1, BACK=-1, NEUTRAL=0 };
123typedef struct star_dot {
124 double angle;
125 DotDirection dir = NEUTRAL;
126 int star_1;
127 int star_2;
128 int getFirst(void) {if(dir>=0) return star_1; else return star_2; };
129 int getSecond(void) {if(dir>=0) return star_2; else return star_1; };
131// think I can write an operator for comparison in find() algorithm
132bool operator== (const star_dot& i, const star_dot& j);
133bool operator== (const star_dot& i, int j);
134
140typedef struct star_triad {
141 int star_1;
142 int star_2;
143 int star_3;
145
154{
155private:
157 double q;
159 double slope;
161 ml_int_array k_vector;
163 vector<StarDot> dot_products;
164public:
165 near_matrix();
166 near_matrix(star_catalog catalog, double field_of_view);
167 near_matrix(ml_int_array ids, ml_matrix u_star, double field_of_view);
168 vector<StarDot> get_angle_range(double angle, double tol);
169 vector<StarDot> get_nearby_stars(int star_id);
170 int size();
171
172};
173
174
175#endif /* defined(__SCControl__sc_star_catalog__) */
Near matrix class.
Definition: sc_star_catalog.h:154
vector< StarDot > get_angle_range(double angle, double tol)
Use the k-vector to extract a subset of the stored dot products.
Definition: sc_star_catalog.cc:486
vector< StarDot > get_nearby_stars(int star_id)
Retrieve dot products stored for a specific star.
Definition: sc_star_catalog.cc:530
near_matrix()
Default constructor.
Definition: sc_star_catalog.cc:320
Star catalog.
Definition: sc_star_catalog.h:80
void set_name(string newName)
Set the catalog string name.
Definition: sc_star_catalog.cc:196
const int size()
Return the number of stars in the catalog.
Definition: sc_star_catalog.cc:233
const string get_name()
Get the catalog name.
Definition: sc_star_catalog.cc:225
const ml_matrix visual_magnitude()
Get the magnitudes for the full catalog.
Definition: sc_star_catalog.cc:259
const double get_date()
Get the catalog reference date.
Definition: sc_star_catalog.cc:217
void set_date(double newDate)
Set the catalog reference date.
Definition: sc_star_catalog.cc:189
const ml_matrix unit_vectors(double jd_now)
Get the unit vectors for the full catalog.
Definition: sc_star_catalog.cc:243
int remove_stars(double angleTol)
Remove stars that are too close together to resolve.
Definition: sc_star_catalog.cc:290
bool is_valid()
Check the catalog status.
Definition: sc_star_catalog.h:117
const ml_int_array hipparcos_ids()
Get the Hipparcos IDs.
Definition: sc_star_catalog.cc:274
star * get_star(int id)
Look up a star using its ID.
Definition: sc_star_catalog.cc:204
Star object.
Definition: sc_star_catalog.h:38
double get_declination() const
Star declination (rad)
Definition: sc_star_catalog.cc:99
ml_matrix UnitVector(void) const
Calculate the unit vector from the catalog right ascension and declination.
Definition: sc_star_catalog.cc:83
void set_motion_terms(double parallax, double pm_ascension, double pm_declination, double radialV)
Set the terms for stellar reduction.
Definition: sc_star_catalog.cc:55
double get_magnitude() const
Visual magnitude ()
Definition: sc_star_catalog.cc:104
ml_matrix CalculateVector(double jd_now, double jd_catalog) const
Calculate the star vector for a given date.
Definition: sc_star_catalog.cc:68
star()
Default constructor.
Definition: sc_star_catalog.cc:19
int get_id() const
Get the star's (Hipparcos) id.
Definition: sc_star_catalog.cc:89
double get_ascension() const
Star right ascnension (rad)
Definition: sc_star_catalog.cc:94
struct star_triad StarTriad
Star triad structure.
struct star_dot StarDot
Star dot product type.
DotDirection
Enumerate the direction of the dot product given a star pair.
Definition: sc_star_catalog.h:121
Star dot product type.
Definition: sc_star_catalog.h:123
Star triad structure.
Definition: sc_star_catalog.h:140