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.
 
PositionVector Run (const Points &p) override
 Obtains the position of the planet relative to the camera.
 
- Public Member Functions inherited from found::FunctionStage< Points, PositionVector >
 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.
 
- Public Member Functions inherited from found::Stage< Input, Output >
virtual Output Run (Input input)=0
 Runs this stage.
 

Protected Member Functions

Vec3 getCenter (const Vec3 &a, const Vec3 &b, const Vec3 &c)
 Returns the center of earth as a 3d Vector.
 
PositionVector Run (const Vec3 &a, const Vec3 &b, const Vec3 &c)
 Returns the position of the planet relative to the camera.
 

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.
 
Vec3 center_
 Calculated center vector.
 
decimal r_
 Calculated radius.
 
- Protected Attributes inherited from found::FunctionStage< 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

Member Function Documentation

◆ getCenter()

Vec3 found::SphericalDistanceDeterminationAlgorithm::getCenter ( const Vec3 a,
const Vec3 b,
const Vec3 c 
)
protected

Returns the center of earth as a 3d Vector.

Parameters
aThe first point on the edge of Earth
bThe second point on the edge of Earth
cThe third point on the edge of Earth
Returns
The center of earth as a 3d Vector
Precondition
spats.size() >= 3
a, b and c are normalized, projected points from the camera

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

◆ Run() [1/2]

PositionVector found::SphericalDistanceDeterminationAlgorithm::Run ( const Points &  p)
override

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

◆ Run() [2/2]

PositionVector found::SphericalDistanceDeterminationAlgorithm::Run ( const Vec3 a,
const Vec3 b,
const Vec3 c 
)
protected

Returns the position of the planet relative to the camera.

Parameters
aThe first point on the edge of Earth
bThe second point on the edge of Earth
cThe third point on the edge of Earth
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
p.size() >= 3
a, b and c are normalized, projected points from the camera

Member Data Documentation

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