GEOS  3.9.1dev
Public Types | Static Public Member Functions | Static Protected Member Functions | List of all members
geos::algorithm::CGAlgorithmsDD Class Reference

Implements basic computational geometry algorithms using extended precision float-point arithmetic. More...

#include <CGAlgorithmsDD.h>

Public Types

enum  { CLOCKWISE = -1, COLLINEAR = 0, COUNTERCLOCKWISE = 1 }
 
enum  { RIGHT = -1, LEFT = 1, STRAIGHT = 0, FAILURE = 2 }
 

Static Public Member Functions

static int orientationIndex (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q)
 Returns the index of the direction of the point q relative to a vector specified by p1-p2. More...
 
static int orientationIndex (double p1x, double p1y, double p2x, double p2y, double qx, double qy)
 
static int orientationIndexFilter (double pax, double pay, double pbx, double pby, double pcx, double pcy)
 
static int orientation (double x)
 
static geom::Coordinate intersection (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q1, const geom::Coordinate &q2)
 
static int signOfDet2x2 (double dx1, double dy1, double dx2, double dy2)
 
static DD detDD (double x1, double y1, double x2, double y2)
 
static DD detDD (const DD &x1, const DD &y1, const DD &x2, const DD &y2)
 
static geom::Coordinate circumcentreDD (const geom::Coordinate &a, const geom::Coordinate &b, const geom::Coordinate &c)
 Computes the circumcentre of a triangle. More...
 

Static Protected Member Functions

static int signOfDet2x2 (const DD &x1, const DD &y1, const DD &x2, const DD &y2)
 

Detailed Description

Implements basic computational geometry algorithms using extended precision float-point arithmetic.

Definition at line 38 of file CGAlgorithmsDD.h.

Member Enumeration Documentation

anonymous enum
Enumerator
CLOCKWISE 
COLLINEAR 
COUNTERCLOCKWISE 

Definition at line 42 of file CGAlgorithmsDD.h.

anonymous enum
Enumerator
RIGHT 
LEFT 
STRAIGHT 
FAILURE 

Definition at line 48 of file CGAlgorithmsDD.h.

Member Function Documentation

static geom::Coordinate geos::algorithm::CGAlgorithmsDD::circumcentreDD ( const geom::Coordinate a,
const geom::Coordinate b,
const geom::Coordinate c 
)
static

Computes the circumcentre of a triangle.

The circumcentre is the centre of the circumcircle, the smallest circle which encloses the triangle. It is also the common intersection point of the perpendicular bisectors of the sides of the triangle, and is the only point which has equal distance to all three vertices of the triangle.

The circumcentre does not necessarily lie within the triangle. For example, the circumcentre of an obtuse isosceles triangle lies outside the triangle.

This method uses geos::math::DD extended-precision arithmetic to provide more accurate results than circumcentre(Coordinate, Coordinate, Coordinate).

Parameters
aa vertex of the triangle
ba vertex of the triangle
ca vertex of the triangle
Returns
the circumcentre of the triangle
static DD geos::algorithm::CGAlgorithmsDD::detDD ( double  x1,
double  y1,
double  x2,
double  y2 
)
static
static DD geos::algorithm::CGAlgorithmsDD::detDD ( const DD x1,
const DD y1,
const DD x2,
const DD y2 
)
static
static geom::Coordinate geos::algorithm::CGAlgorithmsDD::intersection ( const geom::Coordinate p1,
const geom::Coordinate p2,
const geom::Coordinate q1,
const geom::Coordinate q2 
)
static

If the lines are parallel (either identical or separate) a null value is returned.

Parameters
p1an endpoint of line segment 1
p2an endpoint of line segment 1
q1an endpoint of line segment 2
q2an endpoint of line segment 2
Returns
an intersection point if one exists, or null if the lines are parallel
static int geos::algorithm::CGAlgorithmsDD::orientation ( double  x)
inlinestatic

Definition at line 96 of file CGAlgorithmsDD.h.

static int geos::algorithm::CGAlgorithmsDD::orientationIndex ( const geom::Coordinate p1,
const geom::Coordinate p2,
const geom::Coordinate q 
)
static

Returns the index of the direction of the point q relative to a vector specified by p1-p2.

Parameters
p1the origin point of the vector
p2the final point of the vector
qthe point to compute the direction to
Returns
1 if q is counter-clockwise (left) from p1-p2
-1 if q is clockwise (right) from p1-p2
0 if q is collinear with p1-p2
static int geos::algorithm::CGAlgorithmsDD::orientationIndex ( double  p1x,
double  p1y,
double  p2x,
double  p2y,
double  qx,
double  qy 
)
static
static int geos::algorithm::CGAlgorithmsDD::orientationIndexFilter ( double  pax,
double  pay,
double  pbx,
double  pby,
double  pcx,
double  pcy 
)
static

A filter for computing the orientation index of three coordinates.

If the orientation can be computed safely using standard DP arithmetic, this routine returns the orientation index. Otherwise, a value i > 1 is returned. In this case the orientation index must be computed using some other more robust method.

The filter is fast to compute, so can be used to avoid the use of slower robust methods except when they are really needed, thus providing better average performance.

Uses an approach due to Jonathan Shewchuk, which is in the public domain.

static int geos::algorithm::CGAlgorithmsDD::signOfDet2x2 ( double  dx1,
double  dy1,
double  dx2,
double  dy2 
)
static
static int geos::algorithm::CGAlgorithmsDD::signOfDet2x2 ( const DD x1,
const DD y1,
const DD x2,
const DD y2 
)
staticprotected

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