LOST  0.0.1
LOST: Open-source Star Tracker
attitude-utils.cpp File Reference
#include "attitude-utils.hpp"
#include <math.h>
#include <assert.h>
#include <cmath>
#include <iostream>
#include "decimal.hpp"
#include "serialize-helpers.hpp"
Include dependency graph for attitude-utils.cpp:

Go to the source code of this file.

Namespaces

 lost
 LOST starting point.
 

Macros

#define _MATMUL_ENTRY(row, col)   At(row,0)*other.At(0,col) + At(row,1)*other.At(1,col) + At(row,2)*other.At(2,col)
 

Functions

Quaternion lost::SphericalToQuaternion (decimal ra, decimal dec, decimal roll)
 Return a quaternion that will reorient the coordinate axes so that the x-axis points at the given right ascension and declination, then roll the coordinate axes counterclockwise (i.e., the stars will appear to rotate clockwise). More...
 
Vec3 lost::SphericalToSpatial (decimal ra, decimal de)
 Convert from right ascension & declination to a 3d point on the unit sphere. More...
 
void lost::SpatialToSpherical (const Vec3 &vec, decimal *ra, decimal *de)
 Convert from a 3d point on the unit sphere to right ascension & declination. More...
 
decimal lost::RadToDeg (decimal rad)
 
decimal lost::DegToRad (decimal deg)
 
decimal lost::RadToArcSec (decimal rad)
 
decimal lost::ArcSecToRad (decimal arcSec)
 
decimal lost::DecimalModulo (decimal x, decimal mod)
 Given a decimal, find it "modulo" another decimal, in the true mathematical sense (not remainder). More...
 
Mat3 lost::QuaternionToDCM (const Quaternion &quat)
 Convert a quaternion to a rotation matrix (Direction Cosine Matrix) More...
 
Quaternion lost::DCMToQuaternion (const Mat3 &dcm)
 Convert a rotation matrix (Direction Cosine Matrix) to a quaternion representing the same rotation. More...
 
void lost::SerializeVec3 (SerializeContext *ser, const Vec3 &vec)
 Serialize a Vec3 to buffer. Takes up space according to SerializeLengthVec3. More...
 
Vec3 lost::DeserializeVec3 (DeserializeContext *des)
 
decimal lost::Angle (const Vec3 &vec1, const Vec3 &vec2)
 Calculate the inner angle, in radians, between two vectors. More...
 
decimal lost::AngleUnit (const Vec3 &vec1, const Vec3 &vec2)
 Calculate the inner angle, in radians, between two /unit/ vectors. More...
 

Variables

const Mat3 lost::kIdentityMat3
 3x3 identity matrix More...
 

Macro Definition Documentation

◆ _MATMUL_ENTRY

#define _MATMUL_ENTRY (   row,
  col 
)    At(row,0)*other.At(0,col) + At(row,1)*other.At(1,col) + At(row,2)*other.At(2,col)