Instrument Neutral Distributed Interface INDI  2.0.2
NearestMathPlugin.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2021 Jasem Mutlaq. All rights reserved.
3 
4  AstroTrac Mount Driver.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9  .
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14  .
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 *******************************************************************************/
20 
21 #pragma once
22 
24 #include "ConvexHull.h"
25 
26 namespace INDI
27 {
28 namespace AlignmentSubsystem
29 {
30 
37 {
44  TelescopeAltitude(0) {}
45 
48  : AlignmentDatabaseEntry(Source),
53  {
54  }
55 
58  {
68  if (0 != PrivateDataSize)
69  {
70  PrivateData.reset(new unsigned char[PrivateDataSize]);
71  memcpy(PrivateData.get(), RHS.PrivateData.get(), PrivateDataSize);
72  }
73 
74  return *this;
75  }
76 
93 
94 
95 };
96 
98 {
99  public:
101  virtual ~NearestMathPlugin();
102 
104 
105  virtual bool TransformCelestialToTelescope(const double RightAscension, const double Declination,
106  double JulianOffset,
107  TelescopeDirectionVector &ApparentTelescopeDirectionVector);
108 
109  virtual bool TransformTelescopeToCelestial(const TelescopeDirectionVector &ApparentTelescopeDirectionVector,
110  double &RightAscension, double &Declination);
111 
112  private:
113 
114  std::vector<ExtendedAlignmentDatabaseEntry> ExtendedAlignmentPoints;
115 
124  double SphereUnitDistance(double theta1, double theta2, double phi1, double phi2);
125 
134  ExtendedAlignmentDatabaseEntry GetNearestPoint(const double Azimuth, const double Altitude, bool isCelestial);
135 };
136 
137 } // namespace AlignmentSubsystem
138 } // namespace INDI
This class encapsulates all the alignment subsystem classes that are useful to math plugin implementa...
This class provides the driver side API to the in memory alignment database.
InMemoryDatabase * pInMemoryDatabase
Definition: MathPlugin.h:83
virtual bool Initialise(InMemoryDatabase *pInMemoryDatabase)
Initialise or re-initialise the math plugin. Re-reading the in memory database as necessary.
virtual bool TransformTelescopeToCelestial(const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination)
Get the true celestial coordinates for the supplied telescope pointing direction.
virtual bool TransformCelestialToTelescope(const double RightAscension, const double Declination, double JulianOffset, TelescopeDirectionVector &ApparentTelescopeDirectionVector)
Get the alignment corrected telescope pointing direction for the supplied celestial coordinates.
Namespace to encapsulate INDI client, drivers, and mediator classes.
Entry in the in memory alignment database.
Definition: Common.h:152
double RightAscension
Right ascension in decimal hours. N.B. libnova works in decimal degrees so conversion is always neede...
Definition: Common.h:190
TelescopeDirectionVector TelescopeDirection
Normalised vector giving telescope pointing direction. This is referred to elsewhere as the "apparent...
Definition: Common.h:197
double Declination
Declination in decimal degrees.
Definition: Common.h:193
int PrivateDataSize
This size in bytes of any private data.
Definition: Common.h:203
std::unique_ptr< unsigned char > PrivateData
Private data associated with this sync point.
Definition: Common.h:200
double CelestialAzimuth
Celestial Azimuth of Sync Point at the time it was added to the list.
const ExtendedAlignmentDatabaseEntry & operator=(const ExtendedAlignmentDatabaseEntry &RHS)
Override the assignment operator to provide a const version.
double TelescopeAzimuth
Telescope Azimuth of Sync Point at the time it was added to the list.
ExtendedAlignmentDatabaseEntry(const ExtendedAlignmentDatabaseEntry &Source)
Copy constructor.
double TelescopeAltitude
Telescope Altitude of the Sync point at the time it was added to the list.
double CelestialAltitude
Celestial Altitude of the Sync point at the time it was added to the list.
Holds a nomalised direction vector (direction cosines)
Definition: Common.h:69