te::gm::Distance Class Reference

#include <GeometryFunctions.h>

Static Public Member Functions

static te::gm::GeometryVector AddProjectedCoordinates (const te::gm::GeometryVectorConst &geometryVector, double distance, bool &wasChanged)
 Detects and adds all the coordinates from given geometryVector which projected coordinates lies within any segment of the geometries and is within the given 'distance'. More...
 
static double CalculateDistance (const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
 Calculates the distance between c1 and c2. More...
 
static double CalculateSquaredDistance (const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
 Calculates the squared distance between c1 and c2, that is, the distance calculation without the final square root step. This is particularly useful when we just need to compare distance values, and not know the distance itself. More...
 
static double CalculateSquaredDistance (const te::gm::Point &p1, const te::gm::Point &p2)
 Calculates the squared distance between p1 and p2, that is, the distance calculation without the final square root step. This is particularly useful when we just need to compare distance values, and not know the distance itself. More...
 
static bool IsEqual (const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
 Checks if a coordinate c1 is exactly equal to the coordinate c2. More...
 
static bool IsEqual (const te::gm::Point &p1, const te::gm::Point &p2)
 Checks if a point p1 is exactly equal to the point p2. More...
 
static bool IsEqual (double x1, double y1, double x2, double y2)
 Checks if a coordinate (x1, x2) is exactly equal to the coordinate (x2, y2) More...
 
static bool IsOnLine (const te::gm::Coord2D &coordToCheck, const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
 Checks if the given coordToCheck lies within the line. More...
 
static bool IsWithinDistance (const te::gm::Coord2D &c1, const te::gm::Coord2D &c2, double distance)
 Checks in an optimized way if the given coordinates are within the given distance. The optimization is achieved by avoiding the calculation of the square root. More...
 
static bool IsWithinDistance (const te::gm::Point &p1, const te::gm::Point &p2, double distance)
 Checks in an optimized way if the given coordinates are within the given distance. The optimization is achieved by avoiding the calculation of the square root. More...
 
static double PerpendicularDistance (const te::gm::Coord2D &first, const te::gm::Coord2D &last, const te::gm::Coord2D &pin, te::gm::Coord2D &projectedCoordinate, bool &isOnSegment)
 Calculate the perpendicular distance of a point in a segment. More...
 
static double PerpendicularDistance (const te::gm::Point &first, const te::gm::Point &last, const te::gm::Point &pin, te::gm::Point &projectedPoint, bool &isOnSegment)
 Calculate the perpendicular distance of a point in a segment. More...
 
static double PerpendicularSquaredDistance (const te::gm::Coord2D &first, const te::gm::Coord2D &last, const te::gm::Coord2D &pin, te::gm::Coord2D &projectedCoordinate, bool &isOnSegment)
 Calculate the perpendicular squared distance of a point in a segment. More...
 
static double PerpendicularSquaredDistance (const te::gm::Point &first, const te::gm::Point &last, const te::gm::Point &pin, Point &projectedPoint, bool &isOnSegment)
 Calculate the perpendicular squared distance of a point in a segment. More...
 

Detailed Description

Definition at line 47 of file GeometryFunctions.h.

Member Function Documentation

◆ AddProjectedCoordinates()

static te::gm::GeometryVector te::gm::Distance::AddProjectedCoordinates ( const te::gm::GeometryVectorConst geometryVector,
double  distance,
bool &  wasChanged 
)
static

Detects and adds all the coordinates from given geometryVector which projected coordinates lies within any segment of the geometries and is within the given 'distance'.

Parameters
geometryVectorThe geometryVector to be processed.
distanceThe distance to be considered for the projected coordinates
Returns
The processed geometryVector

◆ CalculateDistance()

static double te::gm::Distance::CalculateDistance ( const te::gm::Coord2D c1,
const te::gm::Coord2D c2 
)
static

Calculates the distance between c1 and c2.

Parameters
c1The first coordinate
c2The second coordinate
Returns
The distance between the given coordinates

◆ CalculateSquaredDistance() [1/2]

static double te::gm::Distance::CalculateSquaredDistance ( const te::gm::Coord2D c1,
const te::gm::Coord2D c2 
)
static

Calculates the squared distance between c1 and c2, that is, the distance calculation without the final square root step. This is particularly useful when we just need to compare distance values, and not know the distance itself.

Parameters
c1The first coordinate
c2The second coordinate
Returns
The squared distance between the given coordinates

Referenced by te::gm::CoordDistanceOrderFunctor::operator()(), and te::gm::PointDistanceOrderFunctor::operator()().

◆ CalculateSquaredDistance() [2/2]

static double te::gm::Distance::CalculateSquaredDistance ( const te::gm::Point p1,
const te::gm::Point p2 
)
static

Calculates the squared distance between p1 and p2, that is, the distance calculation without the final square root step. This is particularly useful when we just need to compare distance values, and not know the distance itself.

Parameters
c1The first point
c2The second point
Returns
The squared distance between the given coordinates

◆ IsEqual() [1/3]

static bool te::gm::Distance::IsEqual ( const te::gm::Coord2D c1,
const te::gm::Coord2D c2 
)
static

Checks if a coordinate c1 is exactly equal to the coordinate c2.

Parameters
c1The first coordinate
c2The second coordinate
Returns
TRUE if the points are equal. FALSE otherwise

◆ IsEqual() [2/3]

static bool te::gm::Distance::IsEqual ( const te::gm::Point p1,
const te::gm::Point p2 
)
static

Checks if a point p1 is exactly equal to the point p2.

Parameters
p1The first point
p2The second point
Returns
TRUE if the points are equal. FALSE otherwise

◆ IsEqual() [3/3]

static bool te::gm::Distance::IsEqual ( double  x1,
double  y1,
double  x2,
double  y2 
)
static

Checks if a coordinate (x1, x2) is exactly equal to the coordinate (x2, y2)

Parameters
x1The X of the first coordinate
y1The Y of the first coordinate
x2The X of the second coordinate
y2The Y of the second coordinate
Returns
TRUE if the points are equal. FALSE otherwise

◆ IsOnLine()

static bool te::gm::Distance::IsOnLine ( const te::gm::Coord2D coordToCheck,
const te::gm::Coord2D c1,
const te::gm::Coord2D c2 
)
static

Checks if the given coordToCheck lies within the line.

Parameters
coordToCheckThe coordinate to be checked
c1First coordinate of the line segment
c2Last coordinate of the line segment
Returns
TRUE if the coordinate lies within the segment. FALSE otherwise

◆ IsWithinDistance() [1/2]

static bool te::gm::Distance::IsWithinDistance ( const te::gm::Coord2D c1,
const te::gm::Coord2D c2,
double  distance 
)
static

Checks in an optimized way if the given coordinates are within the given distance. The optimization is achieved by avoiding the calculation of the square root.

Parameters
c1The first coordinate
c2The second coordinate
distanceThe distance to be considered
Returns
TRUE if the coordinates are within the given distance. FALSE otherwise

◆ IsWithinDistance() [2/2]

static bool te::gm::Distance::IsWithinDistance ( const te::gm::Point p1,
const te::gm::Point p2,
double  distance 
)
static

Checks in an optimized way if the given coordinates are within the given distance. The optimization is achieved by avoiding the calculation of the square root.

Parameters
p1The first point
p2The second point
distanceThe distance to be considered
Returns
TRUE if the coordinates are within the given distance. FALSE otherwise

◆ PerpendicularDistance() [1/2]

static double te::gm::Distance::PerpendicularDistance ( const te::gm::Coord2D first,
const te::gm::Coord2D last,
const te::gm::Coord2D pin,
te::gm::Coord2D projectedCoordinate,
bool &  isOnSegment 
)
static

Calculate the perpendicular distance of a point in a segment.

Parameters
firstThe first segment coordinate.
lastThe last segment coordinate.
pinThe coordinate to be calculated.
pinterA intern coordinate calculated based on pin projected intersection with the segment.
Returns
The perpendicular distance.

◆ PerpendicularDistance() [2/2]

static double te::gm::Distance::PerpendicularDistance ( const te::gm::Point first,
const te::gm::Point last,
const te::gm::Point pin,
te::gm::Point projectedPoint,
bool &  isOnSegment 
)
static

Calculate the perpendicular distance of a point in a segment.

Parameters
firstThe first segment point.
lastThe last segment point.
pinThe point to be calculated.
pinterA intern point calculated based on pin projected intersection with the segment.
Returns
The perpendicular distance.

◆ PerpendicularSquaredDistance() [1/2]

static double te::gm::Distance::PerpendicularSquaredDistance ( const te::gm::Coord2D first,
const te::gm::Coord2D last,
const te::gm::Coord2D pin,
te::gm::Coord2D projectedCoordinate,
bool &  isOnSegment 
)
static

Calculate the perpendicular squared distance of a point in a segment.

Parameters
firstThe first segment coordinate.
lastThe last segment coordinate.
pinThe coordinate to be calculated.
pinterA intern coordinate calculated based on pin projected intersection with the segment.
Returns
The perpendicular distance.

◆ PerpendicularSquaredDistance() [2/2]

static double te::gm::Distance::PerpendicularSquaredDistance ( const te::gm::Point first,
const te::gm::Point last,
const te::gm::Point pin,
Point projectedPoint,
bool &  isOnSegment 
)
static

Calculate the perpendicular squared distance of a point in a segment.

Parameters
firstThe first segment point.
lastThe last segment point.
pinThe point to be calculated.
pinterA intern point calculated based on pin projected intersection with the segment.
Returns
The perpendicular distance.

The documentation for this class was generated from the following file: