Spacecraft Control Framework 1.0
Spacecraft Control Library
Public Member Functions | Static Public Member Functions | List of all members
ellipse_geometry Class Reference

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...
 

Detailed Description

Ellipse geometry class.

Constructor & Destructor Documentation

◆ ellipse_geometry() [1/5]

ellipse_geometry::ellipse_geometry ( )

◆ ellipse_geometry() [2/5]

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.

Parameters
AEllipse coefficient on x^2
BEllipse coefficient on xy
CEllipse coefficient on y^2
DEllipse coefficient on x
EEllipse coefficient on y
FEllipse constant term

References ellipse_coefficients::A, ellipse_coefficients::B, ellipse_coefficients::C, ellipse_coefficients::D, ellipse_coefficients::E, and ellipse_coefficients::F.

◆ ellipse_geometry() [3/5]

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.

Parameters
coeffsdata structure of ellipse coefficients

◆ ellipse_geometry() [4/5]

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.

Parameters
x0x-coordinate center of ellipse
y0y-coordinate center of ellipse
a1Semi-major axis
a2Semi-minor axis
phiAngle 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() [5/5]

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.

Parameters
paramsdata structure of ellipse grometry parameters

Member Function Documentation

◆ get_ellipse_params()

ellipse_geometry_struct ellipse_geometry::get_ellipse_params ( )

Retrieve ellipse geometric parameters.

Returns
Data structure with x-coordinate center, y-coordinate center, Semi-major axis, Semi-minor axis, Angle from x axis to semi-major axis (0,pi)

◆ get_ellipse_coeff()

ellipse_coefficients ellipse_geometry::get_ellipse_coeff ( )

Retrieve ellipse equation coefficients.

Returns
Data strucure with ellipse coefficients on x^2, xy, y^2, x, y, constant term

◆ get_ellipse_pts()

ellipse_points ellipse_geometry::get_ellipse_pts ( int  n,
double  th0 = 0 
)

Compute the (x,y) coordinates for n points around an ellipse.

Parameters
nNumber of points around ellipse to compute
th0Angle from semi-major axis for first point. Default 0.
Returns
Data structure with x-coordinate on ellipse at tangent line, y-coordinate on ellipse at tangent line, Radial distance from center to points around ellipse, dr/dtheta, dx/dtheta, dy/dtheta, Slope dy/dx for tangent line, Phase angle starting at th0

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.

◆ get_ellipse_point_on_tangent()

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

Parameters
alphaAngle that the tangent line makes with x-axis (rad)
Returns
Data stucture with x-coordinate on ellipse at tangent line, y-coordinate on ellipse at tangent line, b: Constant y-offset for tangent line (y=m*x+b), m: Slope dy/dx for tangent line (y=m*x+b)

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.

◆ get_ellipse_min_dist()

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.

Parameters
xpx-coordinate of point
ypy-coordinate of point
senseMinimum distance (-1) or maximum distance (1). Default is -1.
Returns
Datastructure with Distance from point on ellipse (x,y) to point (xp,yp), x-coord. on ellipse where distance to point is minimum, y-coord. on ellipse where distance to point is minimum, Flag indicating whether the point (x0,y0) is in the ellipse or not.

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.

◆ ellipsoid_to_ellipse()

ellipse_geometry_struct ellipse_geometry::ellipsoid_to_ellipse ( ml_matrix  M,
ml_matrix  p 
)

Compute parameters of ellipse, projection of ellipsoid onto XZ plane.

Parameters
M(3,3) matrix of principal axes directions
p(3,1) matrix of Semi-major axes, [a;b;c]
Returns
Data structure with Semi-major axis, Semi-minor axis, Angle from x axis to semi-major axis (0,pi) of ellipse projection

References ellipse_coefficients::A, ellipse_coefficients::B, ellipse_coefficients::C, ellipse_coefficients::D, ellipse_coefficients::E, and ellipse_coefficients::F.

◆ get_ellipse_with_index()

ellipse_geometry_struct ellipse_geometry::get_ellipse_with_index ( ellipse_geometry_struct_m  ellipse_geom_m,
int  index 
)
static

Get a specific ellipse_geometry_struct from ellipse_geometry_struct_m.

Parameters
ellispe_geom_mdata structure of matricex representing ellipse geometry data
indexindex number of the specific ellipse_geometry_struct to retrieve
Returns
Data structure with x-coordinate center, y-coordinate center, Semi-major axis, Semi-minor axis, Angle from x axis to semi-major axis (0,pi) for a specific ellipse

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.

◆ set_ellipse_with_index()

void ellipse_geometry::set_ellipse_with_index ( ellipse_geometry_struct_m ellipse_geom_m,
int  index,
double  x0,
double  y0,
double  a1,
double  a2,
double  phi 
)
static

set a set of ellipse_geometry parameters to a ellipse_geometry_struct_m

Parameters
ellispe_geom_mdata structure of matricex representing ellipse geometry data
indexindex number to add the parameters to
x0x-coordinate center of ellipse
y0y-coordinate center of ellipse
a1Semi-major axis
a2Semi-minor axis
phiAngle 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.