Class RobustPredicates
Adaptive exact arithmetic geometric predicates.
Inheritance
Inherited Members
Namespace: UnityEngine.Experimental.U2D.TriangleNet
Syntax
public class RobustPredicates : IPredicates
Remarks
The adaptive exact arithmetic geometric predicates implemented herein are described in detail in the paper "Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates." by Jonathan Richard Shewchuk, see http://www.cs.cmu.edu/~quake/robust.html
The macros of the original C code were automatically expanded using the Visual Studio command prompt with the command "CL /P /C EXACT.C", see http://msdn.microsoft.com/en-us/library/8z9z0bx6.aspx
Constructors
RobustPredicates()
Declaration
public RobustPredicates()
Properties
Default
Gets the default configuration instance.
Declaration
public static RobustPredicates Default { get; }
Property Value
Type | Description |
---|---|
RobustPredicates |
Methods
CounterClockwise(Point, Point, Point)
Check, if the three points appear in counterclockwise order. The result is also a rough approximation of twice the signed area of the triangle defined by the three points.
Declaration
public double CounterClockwise(Point pa, Point pb, Point pc)
Parameters
Type | Name | Description |
---|---|---|
Point | pa | Point a. |
Point | pb | Point b. |
Point | pc | Point c. |
Returns
Type | Description |
---|---|
System.Double | Return a positive value if the points pa, pb, and pc occur in counterclockwise order; a negative value if they occur in clockwise order; and zero if they are collinear. |
Implements
FindCircumcenter(Point, Point, Point, ref Double, ref Double)
Find the circumcenter of a triangle.
Declaration
public Point FindCircumcenter(Point org, Point dest, Point apex, ref double xi, ref double eta)
Parameters
Type | Name | Description |
---|---|---|
Point | org | Triangle point. |
Point | dest | Triangle point. |
Point | apex | Triangle point. |
System.Double | xi | Relative coordinate of new location. |
System.Double | eta | Relative coordinate of new location. |
Returns
Type | Description |
---|---|
Point | Coordinates of the circumcenter |
Implements
Remarks
The result is returned both in terms of x-y coordinates and xi-eta (barycentric) coordinates. The xi-eta coordinate system is defined in terms of the triangle: the origin of the triangle is the origin of the coordinate system; the destination of the triangle is one unit along the xi axis; and the apex of the triangle is one unit along the eta axis. This procedure also returns the square of the length of the triangle's shortest edge.
FindCircumcenter(Point, Point, Point, ref Double, ref Double, Double)
Find the circumcenter of a triangle.
Declaration
public Point FindCircumcenter(Point org, Point dest, Point apex, ref double xi, ref double eta, double offconstant)
Parameters
Type | Name | Description |
---|---|---|
Point | org | Triangle point. |
Point | dest | Triangle point. |
Point | apex | Triangle point. |
System.Double | xi | Relative coordinate of new location. |
System.Double | eta | Relative coordinate of new location. |
System.Double | offconstant | Off-center constant. |
Returns
Type | Description |
---|---|
Point | Coordinates of the circumcenter (or off-center) |
Implements
InCircle(Point, Point, Point, Point)
Check if the point pd lies inside the circle passing through pa, pb, and pc. The points pa, pb, and pc must be in counterclockwise order, or the sign of the result will be reversed.
Declaration
public double InCircle(Point pa, Point pb, Point pc, Point pd)
Parameters
Type | Name | Description |
---|---|---|
Point | pa | Point a. |
Point | pb | Point b. |
Point | pc | Point c. |
Point | pd | Point d. |
Returns
Type | Description |
---|---|
System.Double | Return a positive value if the point pd lies inside the circle passing through pa, pb, and pc; a negative value if it lies outside; and zero if the four points are cocircular. |
Implements
NonRegular(Point, Point, Point, Point)
Return a positive value if the point pd is incompatible with the circle or plane passing through pa, pb, and pc (meaning that pd is inside the circle or below the plane); a negative value if it is compatible; and zero if the four points are cocircular/coplanar. The points pa, pb, and pc must be in counterclockwise order, or the sign of the result will be reversed.
Declaration
public double NonRegular(Point pa, Point pb, Point pc, Point pd)
Parameters
Type | Name | Description |
---|---|---|
Point | pa | Point a. |
Point | pb | Point b. |
Point | pc | Point c. |
Point | pd | Point d. |
Returns
Type | Description |
---|---|
System.Double | Return a positive value if the point pd lies inside the circle passing through pa, pb, and pc; a negative value if it lies outside; and zero if the four points are cocircular. |