COSMOS core
1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
|
Modules | |
Math library constants | |
Math library typedefs | |
Math library functions | |
COSMOS Math Support Library.
This library of mathematical operations and the accompanying set of type definitions provides support for all the mathematical computations necessary within COSMOS. Special emphasis is placed on the calculation and representation of Attitude, which requires vector and matrix operations, and the attendant variable types representing it.
The broad areas of support are:
Angular Conversion
Constants are defined to represent various multiples of Pi in double precision. Constants are also defined to provide conversion factors for conversion between Arc Seconds and Degrees. Finally, macros have been defined to allow conversion both ways between Radians and Degrees.
Byte Order Conversion
This set of functions and constants allows the automatic sensing and correction of various architecture byte orders. Constants are provided to represent the 2 possible orders. The function local_byte_order() is provided to determine the byte order locally. Finally various functions are provided to swap floating point and interger variables between local and other byte orders.
Matrix and Vector Math
Support for vectors and matrices up to rank and order 4 has been provided. Various vector types have been defined to support various conventions. Various matrix type are then built on top of these. Finally, a universal vector type is defined to allow quick conversion between types. Matrices are all considered to be Row Major, in that their data is stored internally by row first, and their first index always indicates row. Vectors are also considered to be rows, except that when they are submitted for multiplication by a matrix, they are first considered to have been transposed.
Coordinate System Attitude Conversion and Rotation
In support of rotations, types have been defined to support quaternions, direction cosine matrices, euler angles, and simple direction and magnitude. In the interest of conciseness, the following conventions have been adopted:
Due to the multiplicity of quaternion representations, a number of naming conventions are defined in parallel in COSMOS. These conventions are:
Universal Vector Type
A union has been defined that contains all vector and quaternion types. This allows for the quick equating of one to the other for easy switching between conventions. As an example, one can define a Vector/Scalar quaternion, and then use an equation that expects Scalar Last.