SAGA API  v9.5
geo_tools.h File Reference
#include "api_core.h"
#include "metadata.h"

Go to the source code of this file.

Classes

struct  SSG_Point
 
class  CSG_Point
 
class  CSG_Points
 
class  CSG_Lines
 
struct  SSG_Point_3D
 
class  CSG_Point_3D
 
class  CSG_Points_3D
 
struct  SSG_Point_4D
 
class  CSG_Point_4D
 
struct  SSG_Point_Int
 
class  CSG_Points_Int
 
struct  SSG_Rect
 
class  CSG_Rect
 
class  CSG_Rects
 
struct  SSG_Rect_Int
 
class  CSG_Rect_Int
 
class  CSG_Rects_Int
 
class  CSG_Distance_Weighting
 
class  CSG_Projection
 
class  CSG_Projections
 

Macros

#define SG_IS_BETWEEN(a, x, b)   (((a) <= (x) && (x) <= (b)) || ((b) <= (x) && (x) <= (a)))
 

Typedefs

typedef struct SSG_Point TSG_Point
 
typedef struct SSG_Point_3D TSG_Point_3D
 
typedef struct SSG_Point_4D TSG_Point_4D
 
typedef struct SSG_Point_Int TSG_Point_Int
 
typedef struct SSG_Rect TSG_Rect
 
typedef struct SSG_Rect_Int TSG_Rect_Int
 

Enumerations

enum  TSG_Intersection {
  INTERSECTION_None = 0, INTERSECTION_Identical, INTERSECTION_Overlaps, INTERSECTION_Contained,
  INTERSECTION_Contains
}
 
enum  TSG_Point_Type { TSG_Point_Type::SG_POINT_TYPE_2D = 0, TSG_Point_Type::SG_POINT_TYPE_3D, TSG_Point_Type::SG_POINT_TYPE_4D, TSG_Point_Type::SG_POINT_TYPE_2D_Int }
 
enum  TSG_Distance_Weighting { SG_DISTWGHT_None = 0, SG_DISTWGHT_IDW, SG_DISTWGHT_EXP, SG_DISTWGHT_GAUSS }
 
enum  ESG_CRS_Format {
  ESG_CRS_Format::WKT1, ESG_CRS_Format::WKT2, ESG_CRS_Format::PROJ, ESG_CRS_Format::ESRI,
  ESG_CRS_Format::CODE, ESG_CRS_Format::Undefined, ESG_CRS_Format::WKT = WKT1
}
 
enum  ESG_CRS_Type { ESG_CRS_Type::Geographic, ESG_CRS_Type::Geocentric, ESG_CRS_Type::Projection, ESG_CRS_Type::Undefined }
 
enum  ESG_Projection_Unit {
  ESG_Projection_Unit::Kilometer, ESG_Projection_Unit::Meter, ESG_Projection_Unit::Decimeter, ESG_Projection_Unit::Centimeter,
  ESG_Projection_Unit::Millimeter, ESG_Projection_Unit::Int_Nautical_Mile, ESG_Projection_Unit::Int_Inch, ESG_Projection_Unit::Int_Foot,
  ESG_Projection_Unit::Int_Yard, ESG_Projection_Unit::Int_Statute_Mile, ESG_Projection_Unit::Int_Fathom, ESG_Projection_Unit::Int_Chain,
  ESG_Projection_Unit::Int_Link, ESG_Projection_Unit::US_Inch, ESG_Projection_Unit::US_Foot, ESG_Projection_Unit::US_Yard,
  ESG_Projection_Unit::US_Chain, ESG_Projection_Unit::US_Statute_Mile, ESG_Projection_Unit::Indian_Yard, ESG_Projection_Unit::Indian_Foot,
  ESG_Projection_Unit::Indian_Chain, ESG_Projection_Unit::Undefined, ESG_Projection_Unit::First = Kilometer
}
 

Functions

SAGA_API_DLL_EXPORT CSG_ProjectionsSG_Get_Projections (void)
 
SAGA_API_DLL_EXPORT bool SG_Get_Projected (class CSG_Shapes *pSource, class CSG_Shapes *pTarget, const CSG_Projection &Target)
 
SAGA_API_DLL_EXPORT bool SG_Get_Projected (const CSG_Projection &Source, const CSG_Projection &Target, TSG_Point &Point)
 
SAGA_API_DLL_EXPORT bool SG_Get_Projected (const CSG_Projection &Source, const CSG_Projection &Target, TSG_Rect &Rectangle)
 
SAGA_API_DLL_EXPORT bool SG_Grid_Get_Geographic_Coordinates (CSG_Grid *pGrid, CSG_Grid *pLon, CSG_Grid *pLat)
 
SAGA_API_DLL_EXPORT bool SG_Is_Equal (double a, double b, double epsilon=0.)
 
SAGA_API_DLL_EXPORT bool SG_Is_Equal (const TSG_Point &A, const TSG_Point &B, double epsilon=0.)
 
SAGA_API_DLL_EXPORT bool SG_Is_Between (double x, double a, double b, double epsilon=0.)
 
SAGA_API_DLL_EXPORT bool SG_Is_Between (const TSG_Point &Point, const TSG_Point &Corner_A, const TSG_Point &Corner_B, double epsilon=0.)
 
SAGA_API_DLL_EXPORT double SG_Get_Length (double dx, double dy)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double bx, double by, bool bPolar)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance (const TSG_Point &A, const TSG_Point &B, bool bPolar)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double bx, double by)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance (const TSG_Point &A, const TSG_Point &B)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance (double ax, double ay, double az, double bx, double by, double bz)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance (const TSG_Point_3D &A, const TSG_Point_3D &B)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar (double aLon, double aLat, double bLon, double bLat, double a=6378137., double e=298.257223563, bool bDegree=true)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar (const TSG_Point &A, const TSG_Point &B, double a=6378137., double e=298.257223563, bool bDegree=true)
 
SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (double dx, double dy)
 
SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (double ax, double ay, double bx, double by)
 
SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (const TSG_Point &A)
 
SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction (const TSG_Point &A, const TSG_Point &B)
 
SAGA_API_DLL_EXPORT double SG_Get_Angle_Difference (double a, double b)
 
SAGA_API_DLL_EXPORT bool SG_is_Angle_Between (double Angle, double Angle_Min, double Angle_Max, bool bCheckRange=true)
 
SAGA_API_DLL_EXPORT bool SG_Get_Crossing (TSG_Point &Crossing, const TSG_Point &a1, const TSG_Point &a2, const TSG_Point &b1, const TSG_Point &b2, bool bExactMatch=true)
 
SAGA_API_DLL_EXPORT bool SG_Get_Crossing_InRegion (TSG_Point &Crossing, const TSG_Point &a, const TSG_Point &b, const TSG_Rect &Region)
 
SAGA_API_DLL_EXPORT bool SG_Is_Point_On_Line (const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch=false, double Epsilon=0.)
 
SAGA_API_DLL_EXPORT double SG_Get_Distance_To_Line (const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, bool bExactMatch=true)
 
SAGA_API_DLL_EXPORT double SG_Get_Nearest_Point_On_Line (const TSG_Point &Point, const TSG_Point &Line_A, const TSG_Point &Line_B, TSG_Point &Line_Point, bool bExactMatch=true)
 
SAGA_API_DLL_EXPORT bool SG_Get_Triangle_CircumCircle (TSG_Point Triangle[3], TSG_Point &Point, double &Radius)
 
SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area (TSG_Point *Points, int nPoints)
 
SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area (const CSG_Points &Points)
 

Detailed Description

Tools for geometric/geographic data types and related functions.

See also
CSG_Point
CSG_Rect
CSG_Projections

Definition in file geo_tools.h.

Macro Definition Documentation

◆ SG_IS_BETWEEN

#define SG_IS_BETWEEN (   a,
  x,
 
)    (((a) <= (x) && (x) <= (b)) || ((b) <= (x) && (x) <= (a)))

Definition at line 90 of file geo_tools.h.

Typedef Documentation

◆ TSG_Point

typedef struct SSG_Point TSG_Point

◆ TSG_Point_3D

typedef struct SSG_Point_3D TSG_Point_3D

◆ TSG_Point_4D

typedef struct SSG_Point_4D TSG_Point_4D

◆ TSG_Point_Int

typedef struct SSG_Point_Int TSG_Point_Int

◆ TSG_Rect

typedef struct SSG_Rect TSG_Rect

◆ TSG_Rect_Int

typedef struct SSG_Rect_Int TSG_Rect_Int

Enumeration Type Documentation

◆ ESG_CRS_Format

enum ESG_CRS_Format
strong
Enumerator
WKT1 
WKT2 
PROJ 
ESRI 
CODE 
Undefined 
WKT 

Definition at line 779 of file geo_tools.h.

◆ ESG_CRS_Type

enum ESG_CRS_Type
strong
Enumerator
Geographic 
Geocentric 
Projection 
Undefined 

Definition at line 785 of file geo_tools.h.

◆ ESG_Projection_Unit

enum ESG_Projection_Unit
strong
Enumerator
Kilometer 
Meter 
Decimeter 
Centimeter 
Millimeter 
Int_Nautical_Mile 
Int_Inch 
Int_Foot 
Int_Yard 
Int_Statute_Mile 
Int_Fathom 
Int_Chain 
Int_Link 
US_Inch 
US_Foot 
US_Yard 
US_Chain 
US_Statute_Mile 
Indian_Yard 
Indian_Foot 
Indian_Chain 
Undefined 
First 

Definition at line 791 of file geo_tools.h.

◆ TSG_Distance_Weighting

Enumerator
SG_DISTWGHT_None 
SG_DISTWGHT_IDW 
SG_DISTWGHT_EXP 
SG_DISTWGHT_GAUSS 

Definition at line 694 of file geo_tools.h.

◆ TSG_Intersection

Enumerator
INTERSECTION_None 
INTERSECTION_Identical 
INTERSECTION_Overlaps 
INTERSECTION_Contained 
INTERSECTION_Contains 

Definition at line 100 of file geo_tools.h.

◆ TSG_Point_Type

enum TSG_Point_Type
strong
Enumerator
SG_POINT_TYPE_2D 
SG_POINT_TYPE_3D 
SG_POINT_TYPE_4D 
SG_POINT_TYPE_2D_Int 

Definition at line 111 of file geo_tools.h.

Function Documentation

◆ SG_Get_Angle_Difference()

SAGA_API_DLL_EXPORT double SG_Get_Angle_Difference ( double  a,
double  b 
)

Definition at line 247 of file geo_functions.cpp.

References M_PI_180, and M_PI_360.

◆ SG_Get_Angle_Of_Direction() [1/4]

SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction ( const TSG_Point A)

Definition at line 235 of file geo_functions.cpp.

References A, and SG_Get_Angle_Of_Direction().

◆ SG_Get_Angle_Of_Direction() [2/4]

SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction ( const TSG_Point A,
const TSG_Point B 
)

Definition at line 241 of file geo_functions.cpp.

References A, B, and SG_Get_Angle_Of_Direction().

◆ SG_Get_Angle_Of_Direction() [3/4]

SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction ( double  ax,
double  ay,
double  bx,
double  by 
)

Definition at line 229 of file geo_functions.cpp.

References SG_Get_Angle_Of_Direction().

◆ SG_Get_Angle_Of_Direction() [4/4]

SAGA_API_DLL_EXPORT double SG_Get_Angle_Of_Direction ( double  dx,
double  dy 
)

Definition at line 216 of file geo_functions.cpp.

References M_PI_090, M_PI_180, and M_PI_360.

Referenced by SG_Get_Angle_Of_Direction().

◆ SG_Get_Crossing()

SAGA_API_DLL_EXPORT bool SG_Get_Crossing ( TSG_Point Crossing,
const TSG_Point a1,
const TSG_Point a2,
const TSG_Point b1,
const TSG_Point b2,
bool  bExactMatch = true 
)

◆ SG_Get_Crossing_InRegion()

SAGA_API_DLL_EXPORT bool SG_Get_Crossing_InRegion ( TSG_Point Crossing,
const TSG_Point a,
const TSG_Point b,
const TSG_Rect Region 
)

◆ SG_Get_Distance() [1/6]

SAGA_API_DLL_EXPORT double SG_Get_Distance ( const TSG_Point A,
const TSG_Point B 
)

Definition at line 124 of file geo_functions.cpp.

References A, and B.

◆ SG_Get_Distance() [2/6]

SAGA_API_DLL_EXPORT double SG_Get_Distance ( const TSG_Point A,
const TSG_Point B,
bool  bPolar 
)

Definition at line 109 of file geo_functions.cpp.

References A, B, SG_Get_Distance(), and SG_Get_Distance_Polar().

◆ SG_Get_Distance() [3/6]

SAGA_API_DLL_EXPORT double SG_Get_Distance ( const TSG_Point_3D A,
const TSG_Point_3D B 
)

Definition at line 145 of file geo_functions.cpp.

References A, and B.

◆ SG_Get_Distance() [4/6]

SAGA_API_DLL_EXPORT double SG_Get_Distance ( double  ax,
double  ay,
double  az,
double  bx,
double  by,
double  bz 
)

Definition at line 135 of file geo_functions.cpp.

◆ SG_Get_Distance() [5/6]

SAGA_API_DLL_EXPORT double SG_Get_Distance ( double  ax,
double  ay,
double  bx,
double  by 
)

Definition at line 115 of file geo_functions.cpp.

◆ SG_Get_Distance() [6/6]

◆ SG_Get_Distance_Polar() [1/2]

SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar ( const TSG_Point A,
const TSG_Point B,
double  a = 6378137.,
double  e = 298.257223563,
bool  bDegree = true 
)

Definition at line 203 of file geo_functions.cpp.

References A, B, and SG_Get_Distance_Polar().

◆ SG_Get_Distance_Polar() [2/2]

SAGA_API_DLL_EXPORT double SG_Get_Distance_Polar ( double  aLon,
double  aLat,
double  bLon,
double  bLat,
double  a = 6378137.,
double  e = 298.257223563,
bool  bDegree = true 
)

Definition at line 157 of file geo_functions.cpp.

References C, M_DEG_TO_RAD, and SG_Get_Square().

Referenced by SG_Get_Distance(), and SG_Get_Distance_Polar().

◆ SG_Get_Distance_To_Line()

SAGA_API_DLL_EXPORT double SG_Get_Distance_To_Line ( const TSG_Point Point,
const TSG_Point Line_A,
const TSG_Point Line_B,
bool  bExactMatch = true 
)

Definition at line 413 of file geo_functions.cpp.

References SG_Get_Nearest_Point_On_Line().

◆ SG_Get_Length()

SAGA_API_DLL_EXPORT double SG_Get_Length ( double  dx,
double  dy 
)

Definition at line 97 of file geo_functions.cpp.

◆ SG_Get_Nearest_Point_On_Line()

SAGA_API_DLL_EXPORT double SG_Get_Nearest_Point_On_Line ( const TSG_Point Point,
const TSG_Point Line_A,
const TSG_Point Line_B,
TSG_Point Line_Point,
bool  bExactMatch = true 
)

◆ SG_Get_Polygon_Area() [1/2]

SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area ( const CSG_Points Points)

Definition at line 534 of file geo_functions.cpp.

References CSG_Points::Get_Count().

◆ SG_Get_Polygon_Area() [2/2]

SAGA_API_DLL_EXPORT double SG_Get_Polygon_Area ( TSG_Point Points,
int  nPoints 
)

Definition at line 514 of file geo_functions.cpp.

References SSG_Point::x, and SSG_Point::y.

Referenced by CSG_TIN_Node::Get_Polygon_Area().

◆ SG_Get_Projected() [1/3]

◆ SG_Get_Projected() [2/3]

◆ SG_Get_Projected() [3/3]

◆ SG_Get_Projections()

SAGA_API_DLL_EXPORT CSG_Projections& SG_Get_Projections ( void  )

Definition at line 69 of file projections.cpp.

References gSG_Projections.

Referenced by SG_Initialize_Environment().

◆ SG_Get_Triangle_CircumCircle()

SAGA_API_DLL_EXPORT bool SG_Get_Triangle_CircumCircle ( TSG_Point  Triangle[3],
TSG_Point Point,
double &  Radius 
)

Definition at line 465 of file geo_functions.cpp.

References A, B, C, SG_Get_Crossing(), SSG_Point::x, and SSG_Point::y.

◆ SG_Grid_Get_Geographic_Coordinates()

◆ SG_is_Angle_Between()

SAGA_API_DLL_EXPORT bool SG_is_Angle_Between ( double  Angle,
double  Angle_Min,
double  Angle_Max,
bool  bCheckRange = true 
)

Definition at line 257 of file geo_functions.cpp.

References M_PI_360.

◆ SG_Is_Between() [1/2]

SAGA_API_DLL_EXPORT bool SG_Is_Between ( const TSG_Point Point,
const TSG_Point Corner_A,
const TSG_Point Corner_B,
double  epsilon = 0. 
)

Definition at line 83 of file geo_functions.cpp.

References SG_Is_Between(), SSG_Point::x, and SSG_Point::y.

◆ SG_Is_Between() [2/2]

SAGA_API_DLL_EXPORT bool SG_Is_Between ( double  x,
double  a,
double  b,
double  epsilon = 0. 
)

Definition at line 77 of file geo_functions.cpp.

Referenced by SG_Is_Between(), and SG_Is_Point_On_Line().

◆ SG_Is_Equal() [1/2]

SAGA_API_DLL_EXPORT bool SG_Is_Equal ( const TSG_Point A,
const TSG_Point B,
double  epsilon = 0. 
)

Definition at line 70 of file geo_functions.cpp.

References A, B, and SG_Is_Equal().

◆ SG_Is_Equal() [2/2]

SAGA_API_DLL_EXPORT bool SG_Is_Equal ( double  a,
double  b,
double  epsilon = 0. 
)

Definition at line 64 of file geo_functions.cpp.

Referenced by CSG_Rect::is_Equal(), SG_Is_Equal(), and SG_Is_Point_On_Line().

◆ SG_Is_Point_On_Line()

SAGA_API_DLL_EXPORT bool SG_Is_Point_On_Line ( const TSG_Point Point,
const TSG_Point Line_A,
const TSG_Point Line_B,
bool  bExactMatch = false,
double  Epsilon = 0. 
)