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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDelaunayTriangle(Collection<? extends DelaunayVertex> collection) DelaunayTriangle(DelaunayVertex... vertices) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(DelaunayVertex vertex) booleanfacetOpposite(DelaunayVertex vertex) Report the facet opposite vertex.getVertexButNot(DelaunayVertex... badVertices) Get arbitrary vertex of this triangle, but not any of the bad vertices.inthashCode()booleanisNeighbor(DelaunayTriangle triangle) True iff triangles are neighbors.iterator()toString()Methods inherited from class toxi.util.datatypes.ArraySet
containsAny, get, sizeMethods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArrayMethods 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:
addin interfaceCollection<DelaunayVertex>- Specified by:
addin interfaceSet<DelaunayVertex>- Overrides:
addin classArraySet<DelaunayVertex>
-
equals
- Specified by:
equalsin interfaceCollection<DelaunayVertex>- Specified by:
equalsin interfaceSet<DelaunayVertex>- Overrides:
equalsin 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:
hashCodein interfaceCollection<DelaunayVertex>- Specified by:
hashCodein interfaceSet<DelaunayVertex>- Overrides:
hashCodein 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:
iteratorin interfaceCollection<DelaunayVertex>- Specified by:
iteratorin interfaceIterable<DelaunayVertex>- Specified by:
iteratorin interfaceSet<DelaunayVertex>- Overrides:
iteratorin classArraySet<DelaunayVertex>
-
toString
- Overrides:
toStringin classAbstractCollection<DelaunayVertex>
-