Spacecraft Control Framework 1.0
Spacecraft Control Library
|
Ellipse geometry class. More...
#include <sc_ellipse_geometry.h>
Public Member Functions | |
ellipse_geometry () | |
Constructor. More... | |
ellipse_geometry (double A, double B, double C, double D, double E, double F) | |
Constructor for Coefficients. More... | |
ellipse_geometry (ellipse_coefficients coeffs) | |
Constructor for Coefficients as a struct. More... | |
ellipse_geometry (double x0, double y0, double a1, double a2, double phi) | |
Constructor for Parameters. More... | |
ellipse_geometry (ellipse_geometry_struct params) | |
Constructor for Parameters. More... | |
ellipse_geometry_struct | get_ellipse_params () |
Retrieve ellipse geometric parameters. More... | |
ellipse_coefficients | get_ellipse_coeff () |
Retrieve ellipse equation coefficients. More... | |
ellipse_points | get_ellipse_pts (int n, double th0=0) |
Compute the (x,y) coordinates for n points around an ellipse. More... | |
ellipse_point_on_tangent | get_ellipse_point_on_tangent (double alpha) |
Compute point on ellipse where given tangent line touches. More... | |
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. More... | |
ellipse_geometry_struct | ellipsoid_to_ellipse (ml_matrix M, ml_matrix p) |
Compute parameters of ellipse, projection of ellipsoid onto XZ plane. More... | |
Static Public Member Functions | |
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. More... | |
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 More... | |
Ellipse geometry class.
ellipse_geometry::ellipse_geometry | ( | ) |
Constructor.
Default constructor.
References ellipse_coefficients::A, ellipse_geometry_struct::a1, ellipse_geometry_struct::a2, ellipse_coefficients::B, ellipse_coefficients::C, ellipse_coefficients::D, ellipse_coefficients::E, ellipse_coefficients::F, ellipse_geometry_struct::phi, ellipse_geometry_struct::x0, and ellipse_geometry_struct::y0.
ellipse_geometry::ellipse_geometry | ( | double | A, |
double | B, | ||
double | C, | ||
double | D, | ||
double | E, | ||
double | F | ||
) |
Constructor for Coefficients.
Creates an ellipse_geometry Object given the coefficients for the general equation of an ellipse A*x^2 + 2*B*x*y + C*y^2 + 2*D*x + 2*E*y + F = 0.
A | Ellipse coefficient on x^2 |
B | Ellipse coefficient on xy |
C | Ellipse coefficient on y^2 |
D | Ellipse coefficient on x |
E | Ellipse coefficient on y |
F | Ellipse constant term |
References ellipse_coefficients::A, ellipse_coefficients::B, ellipse_coefficients::C, ellipse_coefficients::D, ellipse_coefficients::E, and ellipse_coefficients::F.
ellipse_geometry::ellipse_geometry | ( | ellipse_coefficients | coeffs | ) |
Constructor for Coefficients as a struct.
Creates an ellipse_geometry Object given the coefficients for the general equation of an ellipse A*x^2 + 2*B*x*y + C*y^2 + 2*D*x + 2*E*y + F = 0.
coeffs | data structure of ellipse coefficients |
ellipse_geometry::ellipse_geometry | ( | double | x0, |
double | y0, | ||
double | a1, | ||
double | a2, | ||
double | phi | ||
) |
Constructor for Parameters.
Creates an ellipse_geometry Object given the geometric parameters of an ellipse A*x^2 + 2*B*x*y + C*y^2 + 2*D*x + 2*E*y + F = 0.
x0 | x-coordinate center of ellipse |
y0 | y-coordinate center of ellipse |
a1 | Semi-major axis |
a2 | Semi-minor axis |
phi | Angle from x axis to semi-major axis |
References ellipse_geometry_struct::a1, ellipse_geometry_struct::a2, ellipse_geometry_struct::phi, ellipse_geometry_struct::x0, and ellipse_geometry_struct::y0.
ellipse_geometry::ellipse_geometry | ( | ellipse_geometry_struct | params | ) |
Constructor for Parameters.
Creates an ellipse_geometry Object given the geometric parameters of an ellipse A*x^2 + 2*B*x*y + C*y^2 + 2*D*x + 2*E*y + F = 0.
params | data structure of ellipse grometry parameters |
ellipse_geometry_struct ellipse_geometry::get_ellipse_params | ( | ) |
Retrieve ellipse geometric parameters.
ellipse_coefficients ellipse_geometry::get_ellipse_coeff | ( | ) |
Retrieve ellipse equation coefficients.
ellipse_points ellipse_geometry::get_ellipse_pts | ( | int | n, |
double | th0 = 0 |
||
) |
Compute the (x,y) coordinates for n points around an ellipse.
n | Number of points around ellipse to compute |
th0 | Angle from semi-major axis for first point. Default 0. |
References ellipse_geometry_struct::a1, ellipse_geometry_struct::a2, ellipse_points::drdt, ellipse_points::dxdt, ellipse_points::dydt, ellipse_geometry_struct::phi, ellipse_points::r, ellipse_points::slope, ellipse_points::theta, ellipse_points::x, ellipse_geometry_struct::x0, ellipse_points::y, and ellipse_geometry_struct::y0.
ellipse_point_on_tangent ellipse_geometry::get_ellipse_point_on_tangent | ( | double | alpha | ) |
Compute point on ellipse where given tangent line touches.
Given a tangent line direction, compute point on ellipse where the tangent line touches.
Also compute the slope and offset for the equation: y = m*x+b
alpha | Angle that the tangent line makes with x-axis (rad) |
References ellipse_coefficients::A, ellipse_coefficients::B, ellipse_point_on_tangent::b, ellipse_coefficients::C, ellipse_coefficients::D, ellipse_coefficients::E, ellipse_coefficients::F, ellipse_point_on_tangent::m, sc_warn(), ellipse_point_on_tangent::x, and ellipse_point_on_tangent::y.
ellipse_min_dist ellipse_geometry::get_ellipse_min_dist | ( | double | xp, |
double | yp, | ||
int | sense = -1 |
||
) |
Compute the minimum distance from a point to a general 2D ellipse.
xp | x-coordinate of point |
yp | y-coordinate of point |
sense | Minimum distance (-1) or maximum distance (1). Default is -1. |
References ellipse_geometry_struct::a1, ellipse_geometry_struct::a2, ellipse_min_dist::d, ellipse_min_dist::in_ellipse, ellipse_geometry_struct::phi, ellipse_min_dist::x, ellipse_geometry_struct::x0, ellipse_min_dist::y, and ellipse_geometry_struct::y0.
ellipse_geometry_struct ellipse_geometry::ellipsoid_to_ellipse | ( | ml_matrix | M, |
ml_matrix | p | ||
) |
Compute parameters of ellipse, projection of ellipsoid onto XZ plane.
M | (3,3) matrix of principal axes directions |
p | (3,1) matrix of Semi-major axes, [a;b;c] |
References ellipse_coefficients::A, ellipse_coefficients::B, ellipse_coefficients::C, ellipse_coefficients::D, ellipse_coefficients::E, and ellipse_coefficients::F.
|
static |
Get a specific ellipse_geometry_struct from ellipse_geometry_struct_m.
ellispe_geom_m | data structure of matricex representing ellipse geometry data |
index | index number of the specific ellipse_geometry_struct to retrieve |
References ellipse_geometry_struct::a1, ellipse_geometry_struct_m::a1, ellipse_geometry_struct::a2, ellipse_geometry_struct_m::a2, ellipse_geometry_struct::phi, ellipse_geometry_struct_m::phi, ellipse_geometry_struct::x0, ellipse_geometry_struct_m::x0, ellipse_geometry_struct::y0, and ellipse_geometry_struct_m::y0.
|
static |
set a set of ellipse_geometry parameters to a ellipse_geometry_struct_m
ellispe_geom_m | data structure of matricex representing ellipse geometry data |
index | index number to add the parameters to |
x0 | x-coordinate center of ellipse |
y0 | y-coordinate center of ellipse |
a1 | Semi-major axis |
a2 | Semi-minor axis |
phi | Angle from x axis to semi-major axis |
References ellipse_geometry_struct_m::a1, ellipse_geometry_struct_m::a2, ellipse_geometry_struct_m::phi, ellipse_geometry_struct_m::x0, and ellipse_geometry_struct_m::y0.