FOUND
Loading...
Searching...
No Matches
found::SphericalDistanceDeterminationAlgorithm Class Reference

The DistanceDeterminationAlgorithm class houses the Distance Determination Algorithm. More...

#include <distance.hpp>

Inheritance diagram for found::SphericalDistanceDeterminationAlgorithm:
Collaboration diagram for found::SphericalDistanceDeterminationAlgorithm:

Public Member Functions

 SphericalDistanceDeterminationAlgorithm (decimal radius, Camera &&cam)
 Creates a SphericalDeterminationAlgorithm, which deduces the Position vector of a sattelite from Earth by modeling Earth as a sphere.
 
 ~SphericalDistanceDeterminationAlgorithm ()
 
PositionVector Run (const Points &p) override
 Obtains the position of the planet relative to the camera.
 
- Public Member Functions inherited from found::DistanceDeterminationAlgorithm
 DistanceDeterminationAlgorithm ()=default
 
virtual ~DistanceDeterminationAlgorithm ()
 
- Public Member Functions inherited from found::Stage< Points, PositionVector >
 Stage ()=default
 Constructs a new Stage.
 
virtual ~Stage ()=default
 Destroys this.
 
void DoAction () override
 Executes Run (with a stored input and storing the output)
 
PointsGetResource ()
 Returns the stored input of this.
 
PositionVector *& GetProduct ()
 Returns the stored output of this.
 

Protected Member Functions

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.
 

Protected Attributes

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.
 
- Protected Attributes inherited from found::Stage< Points, PositionVector >
Points resource
 The stored input for this.
 
PositionVectorproduct
 The pointer to the stored output for this.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ 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
radiusThe radius of Earth
camThe camera used to capture the picture of Earth

◆ ~SphericalDistanceDeterminationAlgorithm()

found::SphericalDistanceDeterminationAlgorithm::~SphericalDistanceDeterminationAlgorithm ( )
inline

Member Function Documentation

◆ getCenter()

Vec3 found::SphericalDistanceDeterminationAlgorithm::getCenter ( Vec3 spats)
protected

Returns the center of earth as a 3d Vector.

Parameters
spatsThe 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
rThe normalized radius
cThe 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
spatsThe normalized spatial coordinates
centerThe center of the earth as a 3d Vector
Returns
The radius of earth normalized

◆ Run()

PositionVector found::SphericalDistanceDeterminationAlgorithm::Run ( const Points p)
overridevirtual

Obtains the position of the planet relative to the camera.

Parameters
pThe 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

Implements found::Stage< Points, PositionVector >.

Member Data Documentation

◆ cam_

Camera found::SphericalDistanceDeterminationAlgorithm::cam_
protected

cam_ field instance describes the camera settings used for the photo taken

◆ 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: