The DistanceDeterminationAlgorithm class houses the Distance Determination Algorithm.
More...
#include <distance.hpp>
|
| | SphericalDistanceDeterminationAlgorithm (decimal radius, Camera &&cam) |
| | Creates a SphericalDeterminationAlgorithm, which deduces the Position vector of a sattelite from Earth by modeling Earth as a sphere.
|
| |
| PositionVector | Run (const Points &p) override |
| | Obtains the position of the planet relative to the camera.
|
| |
|
| FunctionStage ()=default |
| | Constructs a new Stage.
|
| |
|
virtual | ~FunctionStage ()=default |
| | Destroys this.
|
| |
| void | DoAction () override |
| | Executes Run (with a stored input and storing the output)
|
| |
| Points & | GetResource () |
| | Returns the stored input of this.
|
| |
| PositionVector *& | GetProduct () |
| | Returns the stored output of this.
|
| |
| virtual Output | Run (Input input)=0 |
| | Runs this stage.
|
| |
|
| Vec3 | getCenter (Vec3 *spats) |
| | Returns the center of earth as a 3d Vector.
|
| |
| PreciseDecimal | getRadius (Vec3 *spats, Vec3 center) |
| | Returns the radius of the calculated "earth" (normalized)
|
| |
| PreciseDecimal | getDistance (PreciseDecimal r, PreciseDecimal c) |
| | Returns the scaled distance from earth.
|
| |
|
|
Camera | cam_ |
| | cam_ field instance describes the camera settings used for the photo taken
|
| |
| decimal | radius_ |
| | radius_ field instance describes the defined radius of earth.
|
| |
|
Points | resource |
| | The stored input for this.
|
| |
|
PositionVector * | product |
| | The pointer to the stored output for this.
|
| |
The DistanceDeterminationAlgorithm class houses the Distance Determination Algorithm.
This algorithm calculates the distance from Earth based on the pixels of Earth's Edge found in the image.
- Note
- This class assumes that Earth is a perfect sphere
◆ SphericalDistanceDeterminationAlgorithm()
| found::SphericalDistanceDeterminationAlgorithm::SphericalDistanceDeterminationAlgorithm |
( |
decimal |
radius, |
|
|
Camera && |
cam |
|
) |
| |
|
inline |
Creates a SphericalDeterminationAlgorithm, which deduces the Position vector of a sattelite from Earth by modeling Earth as a sphere.
- Parameters
-
| radius | The radius of Earth |
| cam | The camera used to capture the picture of Earth |
◆ getCenter()
| Vec3 found::SphericalDistanceDeterminationAlgorithm::getCenter |
( |
Vec3 * |
spats | ) |
|
|
protected |
Returns the center of earth as a 3d Vector.
- Parameters
-
| spats | The normalized spatial coordinates used to find the center |
- Returns
- The center of earth as a 3d Vector
CirclePt is a vector that points to a point on the plane. We also know the center vector should point to a point on the plane. So, we get (circlePt - center) * circleN = 0. This is equivalent to (center * circleN) = (circlePt * circleN)
We have (center - mid1/mid2) gives us the vector perpendicular to the mid1N/mid2N vector. Hence, (center - mid1)*mid1N = 0. This becomes (mid1N * center) = (mid1N * mid1). (This is the same for mid2) So we have: circleN * center = circleN * circlePt mid1N * center = mid1N * mid1 mid2N * center = mid2N * mid2 This becomes a systems of linear equation
◆ getDistance()
| PreciseDecimal found::SphericalDistanceDeterminationAlgorithm::getDistance |
( |
PreciseDecimal |
r, |
|
|
PreciseDecimal |
c |
|
) |
| |
|
protected |
Returns the scaled distance from earth.
- Parameters
-
| r | The normalized radius |
| c | The distance to the center of the small circle |
- Returns
- The distance from earth as a Scalar
◆ getRadius()
| PreciseDecimal found::SphericalDistanceDeterminationAlgorithm::getRadius |
( |
Vec3 * |
spats, |
|
|
Vec3 |
center |
|
) |
| |
|
protected |
Returns the radius of the calculated "earth" (normalized)
- Parameters
-
| spats | The normalized spatial coordinates |
| center | The center of the earth as a 3d Vector |
- Returns
- The radius of earth normalized
◆ Run()
| PositionVector found::SphericalDistanceDeterminationAlgorithm::Run |
( |
const Points & |
p | ) |
|
|
override |
Obtains the position of the planet relative to the camera.
- Parameters
-
| p | The points on the edge of Earth (in the image taken by the camera given to this) |
- Returns
- PositionVector The position vector of the Earth relative to the camera
- Precondition
- p must refer to points taken by the camera that was passed to this
- Postcondition
- If p.size() < 3, then the result is exactly the zero vector
◆ radius_
| decimal found::SphericalDistanceDeterminationAlgorithm::radius_ |
|
protected |
radius_ field instance describes the defined radius of earth.
Should be 6378.0 (km)
The documentation for this class was generated from the following files: