TwiceAsNice  2019-02-18
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
INDI::AlignmentSubsystem::BasicMathPlugin Class Referenceabstract

This class implements the common functionality for the built in and SVD math plugins. More...

#include <BasicMathPlugin.h>

Inheritance diagram for INDI::AlignmentSubsystem::BasicMathPlugin:
Inheritance graph
Collaboration diagram for INDI::AlignmentSubsystem::BasicMathPlugin:
Collaboration graph

Public Member Functions

 BasicMathPlugin ()
 Default constructor. More...
 
virtual ~BasicMathPlugin ()
 Virtual destructor. More...
 
virtual bool Initialise (InMemoryDatabase *pInMemoryDatabase)
 Override for the base class virtual function. More...
 
virtual bool TransformCelestialToTelescope (const double RightAscension, const double Declination, double JulianOffset, TelescopeDirectionVector &ApparentTelescopeDirectionVector)
 Override for the base class virtual function. More...
 
virtual bool TransformTelescopeToCelestial (const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination)
 Override for the base class virtual function. More...
 
- Public Member Functions inherited from INDI::AlignmentSubsystem::AlignmentSubsystemForMathPlugins
virtual ~AlignmentSubsystemForMathPlugins ()
 Virtual destructor. More...
 
- Public Member Functions inherited from INDI::AlignmentSubsystem::MathPlugin
 MathPlugin (MountAlignment_t ApproximateAlignment=ZENITH)
 Default constructor. More...
 
virtual ~MathPlugin ()
 Virtual destructor. More...
 
virtual MountAlignment_t GetApproximateMountAlignment ()
 Get the approximate alognment of the mount. More...
 
virtual void SetApproximateMountAlignment (MountAlignment_t ApproximateAlignment)
 Set the approximate alognment of the mount. More...
 
- Public Member Functions inherited from INDI::AlignmentSubsystem::TelescopeDirectionVectorSupportFunctions
virtual ~TelescopeDirectionVectorSupportFunctions ()
 Virtual destructor. More...
 
void AltitudeAzimuthFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, ln_hrz_posn &HorizontalCoordinates)
 Calculates an altitude and azimuth from the supplied normalised direction vector and declination. More...
 
void AltitudeAzimuthFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, lnh_hrz_posn &HorizontalCoordinates)
 Calculates an altitude and azimuth from the supplied normalised direction vector and declination. More...
 
void EquatorialCoordinatesFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, struct ln_equ_posn &EquatorialCoordinates)
 Calculates equatorial coordinates from the supplied telescope direction vector and declination. More...
 
void EquatorialCoordinatesFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, struct lnh_equ_posn &EquatorialCoordinates)
 Calculates equatorial coordinates from the supplied telescope direction vector and declination. More...
 
void LocalHourAngleDeclinationFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, struct ln_equ_posn &EquatorialCoordinates)
 Calculates a local hour angle and declination from the supplied telescope direction vector and declination. More...
 
void LocalHourAngleDeclinationFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, struct lnh_equ_posn &EquatorialCoordinates)
 Calculates a local hour angle and declination from the supplied telescope direction vector and declination. More...
 
void SphericalCoordinateFromTelescopeDirectionVector (const TelescopeDirectionVector TelescopeDirectionVector, double &AzimuthAngle, AzimuthAngleDirection_t AzimuthAngleDirection, double &PolarAngle, PolarAngleDirection_t PolarAngleDirection)
 Calculates a spherical coordinate from the supplied telescope direction vector. More...
 
const TelescopeDirectionVector TelescopeDirectionVectorFromAltitudeAzimuth (ln_hrz_posn HorizontalCoordinates)
 Calculates a normalised direction vector from the supplied altitude and azimuth. More...
 
const TelescopeDirectionVector TelescopeDirectionVectorFromAltitudeAzimuth (lnh_hrz_posn HorizontalCoordinates)
 Calculates a normalised direction vector from the supplied altitude and azimuth. More...
 
const TelescopeDirectionVector TelescopeDirectionVectorFromEquatorialCoordinates (struct ln_equ_posn EquatorialCoordinates)
 Calculates a telescope direction vector from the supplied equatorial coordinates. More...
 
const TelescopeDirectionVector TelescopeDirectionVectorFromEquatorialCoordinates (struct lnh_equ_posn EquatorialCoordinates)
 Calculates a telescope direction vector from the supplied equatorial coordinates. More...
 
const TelescopeDirectionVector TelescopeDirectionVectorFromLocalHourAngleDeclination (struct ln_equ_posn EquatorialCoordinates)
 Calculates a telescope direction vector from the supplied local hour angle and declination. More...
 
const TelescopeDirectionVector TelescopeDirectionVectorFromSphericalCoordinate (const double AzimuthAngle, AzimuthAngleDirection_t AzimuthAngleDirection, const double PolarAngle, PolarAngleDirection_t PolarAngleDirection)
 Calculates a telescope direction vector from the supplied spherical coordinate information. More...
 

Protected Member Functions

virtual void CalculateTransformMatrices (const TelescopeDirectionVector &Alpha1, const TelescopeDirectionVector &Alpha2, const TelescopeDirectionVector &Alpha3, const TelescopeDirectionVector &Beta1, const TelescopeDirectionVector &Beta2, const TelescopeDirectionVector &Beta3, gsl_matrix *pAlphaToBeta, gsl_matrix *pBetaToAlpha)=0
 Calculate tranformation matrices from the supplied vectors. More...
 
void Dump3 (const char *Label, gsl_vector *pVector)
 Print out a 3 vector to debug. More...
 
void Dump3x3 (const char *Label, gsl_matrix *pMatrix)
 Print out a 3x3 matrix to debug. More...
 
double Matrix3x3Determinant (gsl_matrix *pMatrix)
 Caluclate the determinant of the supplied matrix. More...
 
bool MatrixInvert3x3 (gsl_matrix *pInput, gsl_matrix *pInversion)
 Calculate the inverse of the supplied matrix. More...
 
void MatrixMatrixMultiply (gsl_matrix *pA, gsl_matrix *pB, gsl_matrix *pC)
 Multiply matrix A by matrix B and put the result in C. More...
 
void MatrixVectorMultiply (gsl_matrix *pA, gsl_vector *pB, gsl_vector *pC)
 Multiply matrix A by vector B and put the result in vector C. More...
 
bool RayTriangleIntersection (TelescopeDirectionVector &Ray, TelescopeDirectionVector &TriangleVertex1, TelescopeDirectionVector &TriangleVertex2, TelescopeDirectionVector &TriangleVertex3)
 Test if a ray intersects a triangle in 3d space. More...
 

Protected Attributes

gsl_matrix * pActualToApparentTransform
 
gsl_matrix * pApparentToActualTransform
 
ConvexHull ActualConvexHull
 
ConvexHull ApparentConvexHull
 
std::vector< TelescopeDirectionVectorActualDirectionCosines
 
- Protected Attributes inherited from INDI::AlignmentSubsystem::MathPlugin
MountAlignment_t ApproximateMountAlignment
 Describe the approximate alignment of the mount. More...
 
InMemoryDatabasepInMemoryDatabase
 

Additional Inherited Members

- Public Types inherited from INDI::AlignmentSubsystem::TelescopeDirectionVectorSupportFunctions
enum  AzimuthAngleDirection { CLOCKWISE, ANTI_CLOCKWISE }
 
enum  PolarAngleDirection { FROM_POLAR_AXIS, FROM_AZIMUTHAL_PLANE }
 
typedef enum INDI::AlignmentSubsystem::TelescopeDirectionVectorSupportFunctions::AzimuthAngleDirection AzimuthAngleDirection_t
 
typedef enum INDI::AlignmentSubsystem::TelescopeDirectionVectorSupportFunctions::PolarAngleDirection PolarAngleDirection_t
 

Detailed Description

This class implements the common functionality for the built in and SVD math plugins.

Constructor & Destructor Documentation

◆ BasicMathPlugin()

INDI::AlignmentSubsystem::BasicMathPlugin::BasicMathPlugin ( )

Default constructor.

◆ ~BasicMathPlugin()

INDI::AlignmentSubsystem::BasicMathPlugin::~BasicMathPlugin ( )
virtual

Virtual destructor.

Member Function Documentation

◆ CalculateTransformMatrices()

virtual void INDI::AlignmentSubsystem::BasicMathPlugin::CalculateTransformMatrices ( const TelescopeDirectionVector Alpha1,
const TelescopeDirectionVector Alpha2,
const TelescopeDirectionVector Alpha3,
const TelescopeDirectionVector Beta1,
const TelescopeDirectionVector Beta2,
const TelescopeDirectionVector Beta3,
gsl_matrix *  pAlphaToBeta,
gsl_matrix *  pBetaToAlpha 
)
protectedpure virtual

Calculate tranformation matrices from the supplied vectors.

Parameters
[in]Alpha1Pointer to the first coordinate in the alpha reference frame
[in]Alpha2Pointer to the second coordinate in the alpha reference frame
[in]Alpha3Pointer to the third coordinate in the alpha reference frame
[in]Beta1Pointer to the first coordinate in the beta reference frame
[in]Beta2Pointer to the second coordinate in the beta reference frame
[in]Beta3Pointer to the third coordinate in the beta reference frame
[in]pAlphaToBetaPointer to a matrix to receive the Alpha to Beta transformation matrix
[in]pBetaToAlphaPointer to a matrix to receive the Beta to Alpha transformation matrix

Implemented in INDI::AlignmentSubsystem::BuiltInMathPlugin, and INDI::AlignmentSubsystem::SVDMathPlugin.

◆ Dump3()

void INDI::AlignmentSubsystem::BasicMathPlugin::Dump3 ( const char *  Label,
gsl_vector *  pVector 
)
protected

Print out a 3 vector to debug.

Parameters
[in]LabelA label to identify the vector
[in]pVectorThe vector to print

◆ Dump3x3()

void INDI::AlignmentSubsystem::BasicMathPlugin::Dump3x3 ( const char *  Label,
gsl_matrix *  pMatrix 
)
protected

Print out a 3x3 matrix to debug.

Parameters
[in]LabelA label to identify the matrix
[in]pMatrixThe matrix to print

◆ Initialise()

bool INDI::AlignmentSubsystem::BasicMathPlugin::Initialise ( InMemoryDatabase pInMemoryDatabase)
virtual

Override for the base class virtual function.

See how many entries there are in the in memory database.

  • If just one use a hint to mounts approximate alignment, this can either be ZENITH, NORTH_CELESTIAL_POLE or SOUTH_CELESTIAL_POLE. The hint is used to make a dummy second entry. A dummy third entry is computed from the cross product of the first two. A transform matrix is then computed.
  • If two make the dummy third entry and compute a transform matrix.
  • If three compute a transform matrix.
  • If four or more compute a convex hull, then matrices for each triangular facet of the hull.

Reimplemented from INDI::AlignmentSubsystem::MathPlugin.

◆ Matrix3x3Determinant()

double INDI::AlignmentSubsystem::BasicMathPlugin::Matrix3x3Determinant ( gsl_matrix *  pMatrix)
protected

Caluclate the determinant of the supplied matrix.

Use gsl to compute the determinant of a 3x3 matrix.

Parameters
[in]pMatrixPointer to the 3x3 matrix
Returns
The determinant

◆ MatrixInvert3x3()

bool INDI::AlignmentSubsystem::BasicMathPlugin::MatrixInvert3x3 ( gsl_matrix *  pInput,
gsl_matrix *  pInversion 
)
protected

Calculate the inverse of the supplied matrix.

Use gsl to compute the inverse of a 3x3 matrix.

Parameters
[in]pInputPointer to the input matrix
[in]pInversionPointer to a matrix to receive the inversion
Returns
False if input matrix is singular (not invertable) otherwise true

◆ MatrixMatrixMultiply()

void INDI::AlignmentSubsystem::BasicMathPlugin::MatrixMatrixMultiply ( gsl_matrix *  pA,
gsl_matrix *  pB,
gsl_matrix *  pC 
)
protected

Multiply matrix A by matrix B and put the result in C.

Use gsl blas support to multiply two matrices together and put the result in a third.

For our purposes all the matrices should be 3 by 3.

◆ MatrixVectorMultiply()

void INDI::AlignmentSubsystem::BasicMathPlugin::MatrixVectorMultiply ( gsl_matrix *  pA,
gsl_vector *  pB,
gsl_vector *  pC 
)
protected

Multiply matrix A by vector B and put the result in vector C.

Use gsl blas support to multiply a matrix by a vector and put the result in another vector For our purposes the the matrix should be 3x3 and vector 3.

◆ RayTriangleIntersection()

bool INDI::AlignmentSubsystem::BasicMathPlugin::RayTriangleIntersection ( TelescopeDirectionVector Ray,
TelescopeDirectionVector TriangleVertex1,
TelescopeDirectionVector TriangleVertex2,
TelescopeDirectionVector TriangleVertex3 
)
protected

Test if a ray intersects a triangle in 3d space.

Parameters
[in]RayThe ray vector
[in]TriangleVertex1The first vertex of the triangle
[in]TriangleVertex2The second vertex of the triangle
[in]TriangleVertex3The third vertex of the triangle
Note
The order of the vertices determine whether the triangle is facing away from or towards the origin. Intersection with triangles facing the origin will be ignored.

◆ TransformCelestialToTelescope()

bool INDI::AlignmentSubsystem::BasicMathPlugin::TransformCelestialToTelescope ( const double  RightAscension,
const double  Declination,
double  JulianOffset,
TelescopeDirectionVector ApparentTelescopeDirectionVector 
)
virtual

Override for the base class virtual function.

Implements INDI::AlignmentSubsystem::MathPlugin.

◆ TransformTelescopeToCelestial()

bool INDI::AlignmentSubsystem::BasicMathPlugin::TransformTelescopeToCelestial ( const TelescopeDirectionVector ApparentTelescopeDirectionVector,
double &  RightAscension,
double &  Declination 
)
virtual

Override for the base class virtual function.

Implements INDI::AlignmentSubsystem::MathPlugin.

Member Data Documentation

◆ ActualConvexHull

ConvexHull INDI::AlignmentSubsystem::BasicMathPlugin::ActualConvexHull
protected

◆ ActualDirectionCosines

std::vector<TelescopeDirectionVector> INDI::AlignmentSubsystem::BasicMathPlugin::ActualDirectionCosines
protected

◆ ApparentConvexHull

ConvexHull INDI::AlignmentSubsystem::BasicMathPlugin::ApparentConvexHull
protected

◆ pActualToApparentTransform

gsl_matrix* INDI::AlignmentSubsystem::BasicMathPlugin::pActualToApparentTransform
protected

◆ pApparentToActualTransform

gsl_matrix* INDI::AlignmentSubsystem::BasicMathPlugin::pApparentToActualTransform
protected

The documentation for this class was generated from the following files: