Spacecraft Control Framework 1.0
Spacecraft Control Library
sc_ellipse_geometry.h
Go to the documentation of this file.
1/*
2 * sc_ellipse_geometry.h
3 * SCControl
4 *
5 * Created by Alice Cao on 9/25/11.
6 * Copyright 2011 Princeton Satellite Systems. All rights reserved.
7*/
8
14#ifndef SCControl_ellipse_geometry_h
15#define SCControl_ellipse_geometry_h
16
17#ifdef AS_OS_WINDOWS
18#include "matrixlib.h"
19#else
20#include <MatrixLib/MatrixLib.h>
21#endif
22
23
26 double x0;
27 double y0;
28 double a1;
29 double a2;
30 double phi;
31};
32
35 ml_matrix x0;
36 ml_matrix y0;
37 ml_matrix a1;
38 ml_matrix a2;
39 ml_matrix phi;
40};
41
44 double A;
45 double B;
46 double C;
47 double D;
48 double E;
49 double F;
50};
51
54 ml_matrix x;
55 ml_matrix y;
56 ml_matrix r;
57 ml_matrix drdt;
58 ml_matrix dxdt;
59 ml_matrix dydt;
60 ml_matrix slope;
61 ml_matrix theta;
62};
63
66 ml_matrix x;
67 ml_matrix y;
68 ml_matrix b;
69 double m;
70};
71
74 double d;
75 double x;
76 double y;
78};
79
83{
84
85private:
86
87 // ellipse geometry variables
88 ellipse_geometry_struct ellipse_geom_data;
89
90 // ellipse coefficients
91 ellipse_coefficients ellipse_coeff;
92
93 // coeff to params
94 void set_coeffs();
95
96 // params to coeff
97 void set_params();
98
99
100public:
101
104
106 ellipse_geometry(double A, double B, double C, double D, double E, double F);
107
110
112 ellipse_geometry(double x0, double y0, double a1, double a2, double phi);
113
116
119
122
124 ellipse_points get_ellipse_pts(int n, double th0=0);
125
128
130 ellipse_min_dist get_ellipse_min_dist(double xp, double yp, int sense=-1);
131
133 ellipse_geometry_struct ellipsoid_to_ellipse(ml_matrix M, ml_matrix p);
134
137
139 static void set_ellipse_with_index(ellipse_geometry_struct_m &ellipse_geom_m, int index, double x0, double y0, double a1, double a2, double phi);
140
141
142};
143
144#endif
Ellipse geometry class.
Definition: sc_ellipse_geometry.h:83
ellipse_min_dist get_ellipse_min_dist(double xp, double yp, int sense=-1)
Compute the minimum distance from a point to a general 2D ellipse.
Definition: sc_ellipse_geometry.cc:360
ellipse_geometry_struct get_ellipse_params()
Retrieve ellipse geometric parameters.
Definition: sc_ellipse_geometry.cc:205
static void set_ellipse_with_index(ellipse_geometry_struct_m &ellipse_geom_m, int index, double x0, double y0, double a1, double a2, double phi)
set a set of ellipse_geometry parameters to a ellipse_geometry_struct_m
Definition: sc_ellipse_geometry.cc:568
ellipse_geometry_struct ellipsoid_to_ellipse(ml_matrix M, ml_matrix p)
Compute parameters of ellipse, projection of ellipsoid onto XZ plane.
Definition: sc_ellipse_geometry.cc:468
ellipse_points get_ellipse_pts(int n, double th0=0)
Compute the (x,y) coordinates for n points around an ellipse.
Definition: sc_ellipse_geometry.cc:227
ellipse_point_on_tangent get_ellipse_point_on_tangent(double alpha)
Compute point on ellipse where given tangent line touches.
Definition: sc_ellipse_geometry.cc:294
static ellipse_geometry_struct get_ellipse_with_index(ellipse_geometry_struct_m ellipse_geom_m, int index)
Get a specific ellipse_geometry_struct from ellipse_geometry_struct_m.
Definition: sc_ellipse_geometry.cc:524
ellipse_coefficients get_ellipse_coeff()
Retrieve ellipse equation coefficients.
Definition: sc_ellipse_geometry.cc:213
ellipse_geometry()
Constructor.
Definition: sc_ellipse_geometry.cc:20
structure for storing ellipse coefficients
Definition: sc_ellipse_geometry.h:43
double E
Ellipse coefficient on y.
Definition: sc_ellipse_geometry.h:48
double C
Ellipse coefficient on y^2.
Definition: sc_ellipse_geometry.h:46
double A
Ellipse coefficient on x^2.
Definition: sc_ellipse_geometry.h:44
double F
Ellipse constant term.
Definition: sc_ellipse_geometry.h:49
double B
Ellipse coefficient on xy.
Definition: sc_ellipse_geometry.h:45
double D
Ellipse coefficient on x.
Definition: sc_ellipse_geometry.h:47
structure for storing ellipse parameters in ml_matrix form
Definition: sc_ellipse_geometry.h:34
ml_matrix phi
(1,N) matrix of angles from x axes to semi-major axes (0,pi)
Definition: sc_ellipse_geometry.h:39
ml_matrix a1
(1,N) matrix of semi-major axes
Definition: sc_ellipse_geometry.h:37
ml_matrix y0
(1,N) matrix of (1,N) matrix of y-coordinate centers of ellipses
Definition: sc_ellipse_geometry.h:36
ml_matrix a2
(1,N) matrix of semi-minor axes
Definition: sc_ellipse_geometry.h:38
ml_matrix x0
(1,N) matrix of x-coordinate centers of ellipses
Definition: sc_ellipse_geometry.h:35
structure for storing ellipse parameters
Definition: sc_ellipse_geometry.h:25
double x0
x-coordinate center of ellipse
Definition: sc_ellipse_geometry.h:26
double a2
semi-minor axis
Definition: sc_ellipse_geometry.h:29
double phi
angle from x axis to semi-major axis (0,pi)
Definition: sc_ellipse_geometry.h:30
double a1
semi-major axis
Definition: sc_ellipse_geometry.h:28
double y0
y-coordinate center of ellipse
Definition: sc_ellipse_geometry.h:27
structure for storing minimum distance
Definition: sc_ellipse_geometry.h:73
double y
y-coord.
Definition: sc_ellipse_geometry.h:76
double d
Distance from point on ellipse (x,y) to point (xp,yp)
Definition: sc_ellipse_geometry.h:74
bool in_ellipse
Flag indicating whether the point (x0,y0) is in the ellipse or not.
Definition: sc_ellipse_geometry.h:77
double x
x-coord.
Definition: sc_ellipse_geometry.h:75
structure for storing point on tangent line
Definition: sc_ellipse_geometry.h:65
ml_matrix y
y-coordinate on ellipse at tangent line
Definition: sc_ellipse_geometry.h:67
ml_matrix x
x-coordinate on ellipse at tangent line
Definition: sc_ellipse_geometry.h:66
double m
Slope dy/dx for tangent line (y=m*x+b)
Definition: sc_ellipse_geometry.h:69
ml_matrix b
Constant y-offset for tangent line (y=m*x+b)
Definition: sc_ellipse_geometry.h:68
structure for storing points around an ellipse
Definition: sc_ellipse_geometry.h:53
ml_matrix dydt
dy/dtheta
Definition: sc_ellipse_geometry.h:59
ml_matrix dxdt
dx/dtheta
Definition: sc_ellipse_geometry.h:58
ml_matrix y
y-coordinate on ellipse at tangent line
Definition: sc_ellipse_geometry.h:55
ml_matrix theta
Phase angle starting at th0.
Definition: sc_ellipse_geometry.h:61
ml_matrix slope
Slope dy/dx for tangent line (y=m*x+b)
Definition: sc_ellipse_geometry.h:60
ml_matrix r
Radial distance from center to points around ellipse.
Definition: sc_ellipse_geometry.h:56
ml_matrix drdt
dr/dtheta
Definition: sc_ellipse_geometry.h:57
ml_matrix x
x-coordinate on ellipse at tangent line
Definition: sc_ellipse_geometry.h:54