COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
mathlib.cpp File Reference

mathlib source file More...

#include "math/mathlib.h"
Include dependency graph for mathlib.cpp:

Functions

double gaussian_random (double mean, double stdev)
 Normal Distribution random number. More...
 
quaternion q_drotate_between_rv (rvector from, rvector to)
 Create rotation quaternion from 2 row vectors. More...
 
quaternion q_change_around_rv (rvector around, double angle)
 Create rotation quaternion from row vector axis and angle. More...
 
quaternion q_irotate_for (rvector sourcea, rvector sourceb, rvector targeta, rvector targetb)
 Create irotate quaternion from two orthogonal vectors. More...
 
rvector rv_quaternion2axis (quaternion q)
 Quaternion to row vector axis and angle. More...
 
rmatrix rm_quaternion2dcm (quaternion q)
 Quaternion to row matrix Direction Cosine Matrix. More...
 
quaternion q_axis2quaternion_rv (rvector v)
 Row vector axis and angle to Quaternion. More...
 
double distance_rv (rvector p0, rvector p1, rvector p2)
 Distance from a line. More...
 
double area_rv (rvector p0, rvector p1, rvector p2)
 Area of a triangle. More...
 
rvector rv_normalto (rvector p0, rvector p1, rvector p2)
 Normal to a polygon. More...
 
ByteOrder local_byte_order ()
 Determine local byte order. More...
 
uint16_t uint16from (uint8_t *pointer, ByteOrder order)
 Memory to 16 bit unsigned integer. More...
 
int16_t int16from (uint8_t *pointer, ByteOrder order)
 Memory to 16 bit signed integer. More...
 
uint32_t uint32from (uint8_t *pointer, ByteOrder order)
 Memory to 32 bit unsigned integer. More...
 
int32_t int32from (uint8_t *pointer, ByteOrder order)
 Memory to 32 bit signed integer. More...
 
float floatfrom (uint8_t *pointer, ByteOrder order)
 Memory to 32 bit float. More...
 
double doublefrom (uint8_t *pointer, ByteOrder order)
 Memory to 64 bit float. More...
 
void uint32to (uint32_t value, uint8_t *pointer, ByteOrder order)
 32 bit unsigned integer to memory More...
 
void int32to (int32_t value, uint8_t *pointer, ByteOrder order)
 32 bit signed integer to memory More...
 
void uint16to (uint16_t value, uint8_t *pointer, ByteOrder order)
 16 bit unsigned integer to memory More...
 
void int16to (int16_t value, uint8_t *pointer, ByteOrder order)
 16 bit signed integer to memory More...
 
void floatto (float value, uint8_t *pointer, ByteOrder order)
 32 bit floating point to memory More...
 
void doubleto (double value, uint8_t *pointer, ByteOrder order)
 64 bit floating point to memory More...
 
void open_estimate (estimatorhandle *estimate, uint32_t size, uint32_t degree)
 Initialize estimator. More...
 
int16_t set_estimate (estimatorhandle *estimate, double independent, double dependent)
 Set estimator. More...
 
estimatorstruc get_estimate (estimatorhandle *estimate, double x)
 Get estimate. More...
 
void multisolve (vector< vector< double > > x, vector< double > y, vector< double > &a)
 Perform N equation solution. More...
 
double evaluate_poly (double x, vector< double > parms)
 Evaluate polynomial. More...
 
double evaluate_poly_slope (double x, vector< double > parms)
 Evaluate polynomial slope. More...
 
double evaluate_poly_accel (double x, vector< double > parms)
 Evaluate polynomial acceleration. More...
 
double evaluate_poly_jerk (double x, vector< double > parms)
 Evaluate polynomial jerk. More...
 
rvector rv_evaluate_poly (double x, vector< vector< double > > parms)
 Evaluate vector polynomial. More...
 
rvector rv_evaluate_poly_slope (double x, vector< vector< double > > parms)
 Evaluate vector polynomial slope. More...
 
rvector rv_evaluate_poly_accel (double x, vector< vector< double > > parms)
 Evaluate vector polynomial acceleration. More...
 
rvector rv_evaluate_poly_jerk (double x, vector< vector< double > > parms)
 Evaluate vector polynomial jerk. More...
 
gvector gv_evaluate_poly (double x, vector< vector< double > > parms)
 Evaluate vector polynomial. More...
 
gvector gv_evaluate_poly_slope (double x, vector< vector< double > > parms)
 Evaluate vector polynomial slope. More...
 
gvector gv_evaluate_poly_accel (double x, vector< vector< double > > parms)
 Evaluate vector polynomial acceleration. More...
 
gvector gv_evaluate_poly_jerk (double x, vector< vector< double > > parms)
 Evaluate vector polynomial jerk. More...
 
quaternion q_evaluate_poly (double x, vector< vector< double > > parms)
 Evaluate quaternion polynomial. More...
 
quaternion q_evaluate_poly_slope (double x, vector< vector< double > > parms)
 Evaluate quaternion polynomial slope. More...
 
quaternion q_evaluate_poly_accel (double x, vector< vector< double > > parms)
 Evaluate quaternion polynomial acceleration. More...
 
quaternion q_evaluate_poly_jerk (double x, vector< vector< double > > parms)
 Evaluate quaternion polynomial jerk. More...
 
vector< double > polyfit (vector< double > &x, vector< double > &y)
 Perform general order polynomial fit. More...
 
uvector rv_fitpoly (uvector x, uvector y, uint32_t order)
 Perform nth order polynomial fit. More...
 
gj_kernelgauss_jackson_kernel (int32_t order, double dvi)
 Create Gauss-Jackson Integration Kernel. More...
 
void gauss_jackson_dekernel (gj_kernel *gjk)
 Free Gauss-Jackson Integration Kernel. More...
 
gj_instancegauss_jackson_instance (gj_kernel *kern, int32_t axes, void(*calc_vd2)(double vi, double *vd0, double *vd2, int32_t axes))
 Initialize an Instance of a Gauss-Jackson Integrator. More...
 
gj_stepgauss_jackson_step (gj_kernel *kern)
 Initialize a Step of a Gauss-Jackson integrator. More...
 
void gauss_jackson_destep (gj_kernel *kern, gj_step *step)
 Destroy a Step of a Gauss-Jackson integrator. More...
 
int gauss_jackson_setstep (gj_instance *gji, double vi, double *vd0, double *vd1, double *vd2, int32_t istep)
 Set Independent and Dependent variables for Gauss-Jackson step. More...
 
int gauss_jackson_getstep (gj_instance *gji, double *vi, double *vd0, double *vd1, double *vd2, int32_t istep)
 Get Independent and Dependent variables for Gauss-Jackson step. More...
 
void gauss_jackson_preset (gj_instance *gji)
 Converge all axes of a Gauss-Jackson integrator prior to propagation. More...
 
void gauss_jackson_extrapolate (gj_instance *gji, double target)
 Propagate Gauss-Jackson integration. More...
 
double fixangle (double angle)
 Limit angle to range 0-2PI. More...
 
double actan (double y, double x)
 ArcTan, limited to range 0-2PI. More...
 
double fixprecision (double number, double prec)
 Limit precision. More...
 
uint16_t calc_crc16ccitt (uint8_t *buf, int size, bool lsb)
 Calculate CRC-16-CCITT. More...
 
rvector drotate (quaternion q, rvector v)
 Rotate a row vector using a quaternion. More...
 
rvector rotate_q (quaternion q, rvector v)
 
cvector drotate (quaternion q, cvector v)
 Rotate a cartesian vector using a quaternion. More...
 
cvector rotate_q (quaternion q, cvector v)
 
rvector irotate (quaternion q, rvector v)
 Indirectly rotate a row vector using a quaternion. More...
 
rvector transform_q (quaternion q, rvector v)
 
cvector irotate (quaternion q, cvector v)
 Indirectly rotate a cartesian vector using a quaternion. More...
 
quaternion q_change_between_cv (cvector from, cvector to)
 Create rotation quaternion from 2 vectors. More...
 
quaternion q_change_between_rv (rvector from, rvector to)
 
cmatrix cm_change_between_cv (cvector from, cvector to)
 Create rotation matrix from 2 vectors. More...
 
uint16_t calc_crc16ccitt_lsb (vector< uint8_t > buf)
 
uint16_t calc_crc16ccitt_msb (vector< uint8_t > buf)
 

Detailed Description

mathlib source file