SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
satdump::projection::Projection Class Reference

Extremely generic class to handle projections. More...

#include <projection.h>

Public Types

enum  proj_type_t { PROJ_INVALID = 0 , PROJ_STANDARD = 1 , PROJ_RAYTRACER = 2 , PROJ_THINPLATESPLINE = 3 }

Public Member Functions

proj_type_t getFwdType ()
 Get forward (Lat/Lon => X/Y) projection type.
proj_type_t getInvType ()
 Get inverse (X/Y => Lat/Lon) projection type.
bool init (bool fwd, bool inv)
 Initialize projection, to allow using it to perform the math :-) Disabling doesn't guarantee they won't be initialized internally if required to setup the other! You can use getFwdType/getInvType to check they're not invalid if required.
bool forward (geodetic::geodetic_coords_t pos, double &x, double &y, bool except=true)
 Run forward (Lat/Lon => X/Y) projection.
bool inverse (double x, double y, geodetic::geodetic_coords_t &pos, double *otime=nullptr, bool except=true)
 Run forward (X/Y => Lat/Lon) projection.
void to_json (nlohmann::json &j) const
void from_json (const nlohmann::json &j)

Public Attributes

int width = -1
int height = -1

Friends

void to_json (nlohmann::json &j, const Projection &v)
void from_json (const nlohmann::json &j, Projection &v)

Detailed Description

Extremely generic class to handle projections.

This basically abstracts absolutely everything down to a simple class that can be used in 2 lines of codes from a random projection JSON config. By default, all it will do is simply hide the JSON config internally (especially useful to allow manipulating projs in Lua!), but once init() is called, it allows actually performing the projection transform (meant for images).

Do note this is not really intended (in most cases) for high-performance scenarios, such as reprojections.

Member Function Documentation

◆ forward()

bool satdump::projection::Projection::forward ( geodetic::geodetic_coords_t pos,
double & x,
double & y,
bool except = true )

Run forward (Lat/Lon => X/Y) projection.

Parameters
posoutput geodetic position
xpixel position
ypixel position
exceptif false, doesn't throw exceptions
Returns
true on error

◆ getFwdType()

proj_type_t satdump::projection::Projection::getFwdType ( )
inline

Get forward (Lat/Lon => X/Y) projection type.

Returns
projection type

◆ getInvType()

proj_type_t satdump::projection::Projection::getInvType ( )
inline

Get inverse (X/Y => Lat/Lon) projection type.

Returns
projection type

◆ init()

bool satdump::projection::Projection::init ( bool fwd,
bool inv )

Initialize projection, to allow using it to perform the math :-) Disabling doesn't guarantee they won't be initialized internally if required to setup the other! You can use getFwdType/getInvType to check they're not invalid if required.

Parameters
fwdinit forward proj
invinit inverse proj
Returns
true if valid

◆ inverse()

bool satdump::projection::Projection::inverse ( double x,
double y,
geodetic::geodetic_coords_t & pos,
double * otime = nullptr,
bool except = true )

Run forward (X/Y => Lat/Lon) projection.

Parameters
xpixel position
ypixel position
posoutput geodetic position
otimepixel timestamp, MUST be set to -1 before passing to this function. No guarantee the underlaying projection supports this, must be checked before use
exceptif false, doesn't throw exceptions
Returns
true on error

The documentation for this class was generated from the following files:
  • src-core/projection/projection.h
  • src-core/projection/projection.cpp