delaunay

## Class Pnt

• ```public class Pnt
extends Object```
• ### Constructor Summary

Constructors
Constructor and Description
`Pnt(double[] coords)`
Constructor.
```Pnt(double coordA, double coordB)```
Constructor.
```Pnt(double coordA, double coordB, double coordC)```
Constructor.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Pnt` `add(Pnt p)`
`double` `angle(Pnt p)`
Angle (in radians) between two Pnts (treated as vectors).
`Pnt` `bisector(Pnt point)`
Perpendicular bisector of two Pnts.
`static Pnt` `circumcenter(Pnt[] simplex)`
Circumcenter of a simplex.
`static double` `content(Pnt[] simplex)`
Determine the signed content (i.e., area or volume, etc.) of a simplex.
`double` `coord(int i)`
`static Pnt` `cross(Pnt[] matrix)`
Compute generalized cross-product of the rows of a matrix.
`static double` `determinant(Pnt[] matrix)`
Compute the determinant of a matrix (array of Pnts).
`int` `dimCheck(Pnt p)`
Check that dimensions match.
`int` `dimension()`
`double` `dot(Pnt p)`
Dot product.
`boolean` `equals(Object other)`
Equality.
`Pnt` `extend(double[] coords)`
`int` `hashCode()`
HashCode.
`boolean` `isInside(Pnt[] simplex)`
Test if this Pnt is inside a simplex.
`Pnt` `isOn(Pnt[] simplex)`
Test if this Pnt is on a simplex.
`Pnt` `isOutside(Pnt[] simplex)`
Test if this Pnt is outside of simplex.
`double` `magnitude()`
Magnitude (as a vector).
`static void` `main(String[] args)`
Main program (used for testing).
`int[]` `relation(Pnt[] simplex)`
Relation between this Pnt and a simplex (represented as an array of Pnts).
`Pnt` `subtract(Pnt p)`
Subtract.
`String` `toString()`
Create a String for this Pnt.
`static String` `toString(Pnt[] matrix)`
Create a String for a matrix.
`int` `vsCircumcircle(Pnt[] simplex)`
Test relation between this Pnt and circumcircle of a simplex.
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### Pnt

`public Pnt(double[] coords)`
Constructor.
Parameters:
`coords` - the coordinates
• #### Pnt

```public Pnt(double coordA,
double coordB)```
Constructor.
Parameters:
`coordA` -
`coordB` -
• #### Pnt

```public Pnt(double coordA,
double coordB,
double coordC)```
Constructor.
Parameters:
`coordA` -
`coordB` -
`coordC` -
• ### Method Detail

• #### toString

`public String toString()`
Create a String for this Pnt.
Overrides:
`toString` in class `Object`
Returns:
a String representation of this Pnt.
• #### equals

`public boolean equals(Object other)`
Equality.
Overrides:
`equals` in class `Object`
Parameters:
`other` - the other Object to compare to
Returns:
true iff the Pnts have the same coordinates
• #### hashCode

`public int hashCode()`
HashCode.
Overrides:
`hashCode` in class `Object`
Returns:
the hashCode for this Pnt
• #### coord

`public double coord(int i)`
Returns:
the specified coordinate of this Pnt
Throws:
`ArrayIndexOutOfBoundsException` - for bad coordinate
• #### dimension

`public int dimension()`
Returns:
this Pnt's dimension.
• #### dimCheck

`public int dimCheck(Pnt p)`
Check that dimensions match.
Parameters:
`p` - the Pnt to check (against this Pnt)
Returns:
the dimension of the Pnts
Throws:
`IllegalArgumentException` - if dimension fail to match
• #### extend

`public Pnt extend(double[] coords)`
Parameters:
`coords` - the new coordinates (added on the right end)
Returns:
a new Pnt with the additional coordinates
• #### dot

`public double dot(Pnt p)`
Dot product.
Parameters:
`p` - the other Pnt
Returns:
dot product of this Pnt and p
• #### magnitude

`public double magnitude()`
Magnitude (as a vector).
Returns:
the Euclidean length of this vector
• #### subtract

`public Pnt subtract(Pnt p)`
Subtract.
Parameters:
`p` - the other Pnt
Returns:
a new Pnt = this - p

`public Pnt add(Pnt p)`
Parameters:
`p` - the other Pnt
Returns:
a new Pnt = this + p
• #### angle

`public double angle(Pnt p)`
Angle (in radians) between two Pnts (treated as vectors).
Parameters:
`p` - the other Pnt
Returns:
the angle (in radians) between the two Pnts
• #### bisector

`public Pnt bisector(Pnt point)`
Perpendicular bisector of two Pnts. Works in any dimension. The coefficients are returned as a Pnt of one higher dimension (e.g., (A,B,C,D) for an equation of the form Ax + By + Cz + D = 0).
Parameters:
`point` - the other point
Returns:
the coefficients of the perpendicular bisector
• #### toString

`public static String toString(Pnt[] matrix)`
Create a String for a matrix.
Parameters:
`matrix` - the matrix (an array of Pnts)
Returns:
a String represenation of the matrix
• #### determinant

`public static double determinant(Pnt[] matrix)`
Compute the determinant of a matrix (array of Pnts). This is not an efficient implementation, but should be adequate for low dimension.
Parameters:
`matrix` - the matrix as an array of Pnts
Returns:
the determinnant of the input matrix
Throws:
`IllegalArgumentException` - if dimensions are wrong
• #### cross

`public static Pnt cross(Pnt[] matrix)`
Compute generalized cross-product of the rows of a matrix. The result is a Pnt perpendicular (as a vector) to each row of the matrix. This is not an efficient implementation, but should be adequate for low dimension.
Parameters:
`matrix` - the matrix of Pnts (one less row than the Pnt dimension)
Returns:
a Pnt perpendicular to each row Pnt
Throws:
`IllegalArgumentException` - if matrix is wrong shape
• #### content

`public static double content(Pnt[] simplex)`
Determine the signed content (i.e., area or volume, etc.) of a simplex.
Parameters:
`simplex` - the simplex (as an array of Pnts)
Returns:
the signed content of the simplex
• #### relation

`public int[] relation(Pnt[] simplex)`
Relation between this Pnt and a simplex (represented as an array of Pnts). Result is an array of signs, one for each vertex of the simplex, indicating the relation between the vertex, the vertex's opposite facet, and this Pnt.
```   -1 means Pnt is on same side of facet
0 means Pnt is on the facet
+1 means Pnt is on opposite side of facet```
Parameters:
`simplex` - an array of Pnts representing a simplex
Returns:
an array of signs showing relation between this Pnt and the simplex
Throws:
`IllegalArgumentException` - if the simplex is degenerate
• #### isOutside

`public Pnt isOutside(Pnt[] simplex)`
Test if this Pnt is outside of simplex.
Parameters:
`simplex` - the simplex (an array of Pnts)
Returns:
the simplex Pnt that "witnesses" outsideness (or null if not outside)
• #### isOn

`public Pnt isOn(Pnt[] simplex)`
Test if this Pnt is on a simplex.
Parameters:
`simplex` - the simplex (an array of Pnts)
Returns:
the simplex Pnt that "witnesses" on-ness (or null if not on)
• #### isInside

`public boolean isInside(Pnt[] simplex)`
Test if this Pnt is inside a simplex.
Parameters:
`simplex` - the simplex (an arary of Pnts)
Returns:
true iff this Pnt is inside simplex.
• #### vsCircumcircle

`public int vsCircumcircle(Pnt[] simplex)`
Test relation between this Pnt and circumcircle of a simplex.
Parameters:
`simplex` - the simplex (as an array of Pnts)
Returns:
-1, 0, or +1 for inside, on, or outside of circumcircle
• #### circumcenter

`public static Pnt circumcenter(Pnt[] simplex)`
Circumcenter of a simplex.
Parameters:
`simplex` - the simplex (as an array of Pnts)
Returns:
the circumcenter (a Pnt) of simplex
• #### main

`public static void main(String[] args)`
Main program (used for testing).