Package squidpony.squidmath
Class Voronoi.Triangle
java.lang.Object
squidpony.squidmath.Voronoi.Triangle
- All Implemented Interfaces:
Serializable
- Enclosing class:
- Voronoi
public static class Voronoi.Triangle extends Object implements Serializable
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description CoordDouble
a
CoordDouble
b
CoordDouble
c
CoordDouble
centroid
-
Constructor Summary
Constructors Constructor Description Triangle(CoordDouble a, CoordDouble b, CoordDouble c)
Constructor of the 2D triangle class used to create a new triangle instance from three 2D vectors describing the triangle's vertices. -
Method Summary
Modifier and Type Method Description boolean
contains(CoordDouble point)
Tests if a 2D point lies inside this 2D triangle.CoordDouble
getNonEdgeVertex(CoordDouble ea, CoordDouble eb)
CoordDouble
getNonEdgeVertex(Voronoi.Edge edge)
Returns the vertex of this triangle that is not part of the given edge.boolean
hasVertex(CoordDouble vertex)
Returns true if the given vertex is one of the vertices describing this triangle.boolean
isNeighbor(CoordDouble ea, CoordDouble eb)
boolean
isNeighbor(Voronoi.Edge edge)
Returns true if this triangle contains the given edge.boolean
isOrientedCCW()
Test if this triangle is oriented counterclockwise (CCW).boolean
isPointInCircumcircle(CoordDouble point)
Tests if a given point lies in the circumcircle of this triangle.String
toString()
-
Field Details
-
Constructor Details
-
Triangle
Constructor of the 2D triangle class used to create a new triangle instance from three 2D vectors describing the triangle's vertices.- Parameters:
a
- The first vertex of the triangleb
- The second vertex of the trianglec
- The third vertex of the triangle
-
-
Method Details
-
contains
Tests if a 2D point lies inside this 2D triangle. See Real-Time Collision Detection, chap. 5, p. 206.- Parameters:
point
- The point to be tested- Returns:
- Returns true iff the point lies inside this 2D triangle
-
isPointInCircumcircle
Tests if a given point lies in the circumcircle of this triangle. Let the triangle ABC appear in counterclockwise (CCW) order. Then when det > 0, the point lies inside the circumcircle through the three points a, b and c. If instead det < 0, the point lies outside the circumcircle. When det = 0, the four points are cocircular. If the triangle is oriented clockwise (CW) the result is reversed. See Real-Time Collision Detection, chap. 3, p. 34.- Parameters:
point
- The point to be tested- Returns:
- Returns true iff the point lies inside the circumcircle through the three points a, b, and c of the triangle
-
isOrientedCCW
Test if this triangle is oriented counterclockwise (CCW). Let A, B and C be three 2D points. If det > 0, C lies to the left of the directed line AB. Equivalently the triangle ABC is oriented counterclockwise. When det < 0, C lies to the right of the directed line AB, and the triangle ABC is oriented clockwise. When det = 0, the three points are colinear. See Real-Time Collision Detection, chap. 3, p. 32- Returns:
- Returns true iff the triangle ABC is oriented counterclockwise (CCW)
-
isNeighbor
Returns true if this triangle contains the given edge.- Parameters:
edge
- The edge to be tested- Returns:
- Returns true if this triangle contains the edge
-
isNeighbor
-
getNonEdgeVertex
Returns the vertex of this triangle that is not part of the given edge.- Parameters:
edge
- The edge- Returns:
- The vertex of this triangle that is not part of the edge
-
getNonEdgeVertex
-
hasVertex
Returns true if the given vertex is one of the vertices describing this triangle.- Parameters:
vertex
- The vertex to be tested- Returns:
- Returns true if the Vertex is one of the vertices describing this triangle
-
toString
-