Instrument Neutral Distributed Interface INDI  1.9.5
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 
36 struct ExtendedAlignmentDatabaseEntry : public AlignmentDatabaseEntry
37 {
44  TelescopeAltitude(0) {}
45 
48  : AlignmentDatabaseEntry(Source),
53  {
54  }
55 
58  {
59  ObservationJulianDate = RHS.ObservationJulianDate;
60  RightAscension = RHS.RightAscension;
61  Declination = RHS.Declination;
62  TelescopeDirection = RHS.TelescopeDirection;
63  PrivateDataSize = RHS.PrivateDataSize;
64  CelestialAzimuth = RHS.CelestialAzimuth;
65  CelestialAltitude = RHS.CelestialAltitude;
66  TelescopeAzimuth = RHS.TelescopeAzimuth;
67  TelescopeAltitude = RHS.TelescopeAltitude;
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 
80  double CelestialAzimuth;
84  double CelestialAltitude;
88  double TelescopeAzimuth;
92  double TelescopeAltitude;
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
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::TelescopeDirection
TelescopeDirectionVector TelescopeDirection
Normalised vector giving telescope pointing direction. This is referred to elsewhere as the "apparent...
Definition: Common.h:191
AlignmentSubsystemForMathPlugins.h
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry::CelestialAltitude
double CelestialAltitude
Celestial Altitude of the Sync point at the time it was added to the list.
Definition: NearestMathPlugin.h:120
INDI::AlignmentSubsystem::AlignmentSubsystemForMathPlugins
This class encapsulates all the alignment subsystem classes that are useful to math plugin implementa...
Definition: AlignmentSubsystemForMathPlugins.h:16
INDI::AlignmentSubsystem::NearestMathPlugin
Definition: NearestMathPlugin.h:133
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::PrivateDataSize
int PrivateDataSize
This size in bytes of any private data.
Definition: Common.h:197
INDI::AlignmentSubsystem::NearestMathPlugin::NearestMathPlugin
NearestMathPlugin()
Definition: NearestMathPlugin.cpp:96
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry::operator=
const ExtendedAlignmentDatabaseEntry & operator=(const ExtendedAlignmentDatabaseEntry &RHS)
Override the assignment operator to provide a const version.
Definition: NearestMathPlugin.h:93
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry
Definition: NearestMathPlugin.h:72
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::AlignmentDatabaseEntry
AlignmentDatabaseEntry()
Default constructor.
Definition: Common.h:148
INDI::AlignmentSubsystem::InMemoryDatabase
This class provides the driver side API to the in memory alignment database.
Definition: InMemoryDatabase.h:23
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry::TelescopeAzimuth
double TelescopeAzimuth
Telescope Azimuth of Sync Point at the time it was added to the list.
Definition: NearestMathPlugin.h:124
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::PrivateData
std::unique_ptr< unsigned char > PrivateData
Private data associated with this sync point.
Definition: Common.h:194
INDI::AlignmentSubsystem::MathPlugin::pInMemoryDatabase
InMemoryDatabase * pInMemoryDatabase
Definition: MathPlugin.h:80
INDI::AlignmentSubsystem::NearestMathPlugin::TransformTelescopeToCelestial
virtual bool TransformTelescopeToCelestial(const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination)
Get the true celestial coordinates for the supplied telescope pointing direction.
Definition: NearestMathPlugin.cpp:241
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry::TelescopeAltitude
double TelescopeAltitude
Telescope Altitude of the Sync point at the time it was added to the list.
Definition: NearestMathPlugin.h:128
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry::CelestialAzimuth
double CelestialAzimuth
Celestial Azimuth of Sync Point at the time it was added to the list.
Definition: NearestMathPlugin.h:116
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::AlignmentSubsystem::ExtendedAlignmentDatabaseEntry::ExtendedAlignmentDatabaseEntry
ExtendedAlignmentDatabaseEntry()
Default constructor.
Definition: NearestMathPlugin.h:75
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::Declination
double Declination
Declination in decimal degrees.
Definition: Common.h:187
INDI::AlignmentSubsystem::NearestMathPlugin::~NearestMathPlugin
virtual ~NearestMathPlugin()
Definition: NearestMathPlugin.cpp:104
INDI::AlignmentSubsystem::NearestMathPlugin::TransformCelestialToTelescope
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.
Definition: NearestMathPlugin.cpp:169
INDI::AlignmentSubsystem::NearestMathPlugin::Initialise
virtual bool Initialise(InMemoryDatabase *pInMemoryDatabase)
Initialise or re-initialise the math plugin. Re-reading the in memory database as necessary.
Definition: NearestMathPlugin.cpp:112
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::RightAscension
double RightAscension
Right ascension in decimal hours. N.B. libnova works in decimal degrees so conversion is always neede...
Definition: Common.h:184
INDI::AlignmentSubsystem::AlignmentDatabaseEntry::ObservationJulianDate
double ObservationJulianDate
Definition: Common.h:180
ConvexHull.h
INDI::AlignmentSubsystem::TelescopeDirectionVector
Holds a nomalised direction vector (direction cosines)
Definition: Common.h:68