Package toxi.geom.mesh2d
Class DelaunayTriangle
- All Implemented Interfaces:
Iterable<DelaunayVertex>
,Collection<DelaunayVertex>
,Set<DelaunayVertex>
A DelaunayTriangle is an immutable Set of exactly three Pnts.
All Set operations are available. Individual vertices can be accessed via
iterator() and also via triangle.get(index).
Note that, even if two triangles have the same vertex set, they are
*different* triangles. Methods equals() and hashCode() are consistent with
this rule.
- Author:
- Paul Chew Created December 2007. Replaced general simplices with geometric triangle.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDelaunayTriangle
(Collection<? extends DelaunayVertex> collection) DelaunayTriangle
(DelaunayVertex... vertices) -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(DelaunayVertex vertex) boolean
facetOpposite
(DelaunayVertex vertex) Report the facet opposite vertex.getVertexButNot
(DelaunayVertex... badVertices) Get arbitrary vertex of this triangle, but not any of the bad vertices.int
hashCode()
boolean
isNeighbor
(DelaunayTriangle triangle) True iff triangles are neighbors.iterator()
toString()
Methods inherited from class toxi.util.datatypes.ArraySet
containsAny, get, size
Methods inherited from class java.util.AbstractSet
removeAll
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
moreInfo
public static boolean moreInfo
-
-
Constructor Details
-
DelaunayTriangle
- Parameters:
collection
- a Collection holding the Simplex vertices- Throws:
IllegalArgumentException
- if there are not three distinct vertices
-
DelaunayTriangle
- Parameters:
vertices
- the vertices of the DelaunayTriangle.- Throws:
IllegalArgumentException
- if there are not three distinct vertices
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<DelaunayVertex>
- Specified by:
add
in interfaceSet<DelaunayVertex>
- Overrides:
add
in classArraySet<DelaunayVertex>
-
equals
- Specified by:
equals
in interfaceCollection<DelaunayVertex>
- Specified by:
equals
in interfaceSet<DelaunayVertex>
- Overrides:
equals
in classAbstractSet<DelaunayVertex>
-
facetOpposite
Report the facet opposite vertex.- Parameters:
vertex
- a vertex of this DelaunayTriangle- Returns:
- the facet opposite vertex
- Throws:
IllegalArgumentException
- if the vertex is not in triangle
-
getCircumcenter
- Returns:
- the triangle's circumcenter
-
getVertexButNot
Get arbitrary vertex of this triangle, but not any of the bad vertices.- Parameters:
badVertices
- one or more bad vertices- Returns:
- a vertex of this triangle, but not one of the bad vertices
- Throws:
NoSuchElementException
- if no vertex found
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<DelaunayVertex>
- Specified by:
hashCode
in interfaceSet<DelaunayVertex>
- Overrides:
hashCode
in classAbstractSet<DelaunayVertex>
-
isNeighbor
True iff triangles are neighbors. Two triangles are neighbors if they share a facet.- Parameters:
triangle
- the other DelaunayTriangle- Returns:
- true iff this DelaunayTriangle is a neighbor of triangle
-
iterator
- Specified by:
iterator
in interfaceCollection<DelaunayVertex>
- Specified by:
iterator
in interfaceIterable<DelaunayVertex>
- Specified by:
iterator
in interfaceSet<DelaunayVertex>
- Overrides:
iterator
in classArraySet<DelaunayVertex>
-
toString
- Overrides:
toString
in classAbstractCollection<DelaunayVertex>
-