Table of Contents

Class CGAlgorithmsDD

Namespace
NetTopologySuite.Algorithm
Assembly
NetTopologySuite.dll

Implements basic computational geometry algorithms using DD arithmetic.

public static class CGAlgorithmsDD
Inheritance
CGAlgorithmsDD
Inherited Members

Methods

Intersection(Coordinate, Coordinate, Coordinate, Coordinate)

Computes an intersection point between two lines using DD arithmetic. If the lines are parallel (either identical or separate) a null value is returned.

public static Coordinate Intersection(Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2)

Parameters

p1 Coordinate

An endpoint of line segment 1

p2 Coordinate

An endpoint of line segment 1

q1 Coordinate

An endpoint of line segment 2

q2 Coordinate

An endpoint of line segment 2

Returns

Coordinate

An intersection point if one exists, or null if lines are parallel.

OrientationIndex(Coordinate, Coordinate, Coordinate)

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

public static int OrientationIndex(Coordinate p1, Coordinate p2, Coordinate q)

Parameters

p1 Coordinate

The origin point of the vector

p2 Coordinate

The final point of the vector

q Coordinate

the point to compute the direction to

Returns

int
  • 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

OrientationIndex(double, double, double, double, double, double)

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

public static int OrientationIndex(double p1x, double p1y, double p2x, double p2y, double qx, double qy)

Parameters

p1x double

The x-ordinate of the origin point of the vector

p1y double

The y-ordinate of the origin point of the vector

p2x double

The x-ordinate of the final point of the vector

p2y double

The y-ordinate of the final point of the vector

qx double

The x-ordinate of the point to compute the direction to

qy double

The y-ordinate of the point to compute the direction to

Returns

int
  • 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

SignOfDet2x2(DD, DD, DD, DD)

Computes the sign of the determinant of the 2x2 matrix with the given entries.

public static int SignOfDet2x2(DD x1, DD y1, DD x2, DD y2)

Parameters

x1 DD
y1 DD
x2 DD
y2 DD

Returns

int
  • -1 if the determinant is negative,
  • 1 if the determinant is positive,
  • 0 if the determinant is 0.