Class JavaTriangle2D
- java.lang.Object
-
- science.aist.imaging.api.domain.AbstractSurface<T,L>
-
- science.aist.imaging.api.domain.AbstractJavaPolygon<JavaPoint2D,JavaLine2D>
-
- science.aist.imaging.api.domain.twodimensional.JavaPolygon2D
-
- science.aist.imaging.api.domain.twodimensional.JavaTriangle2D
-
- All Implemented Interfaces:
Serializable
,Triangle<JavaPoint2D>
public class JavaTriangle2D extends JavaPolygon2D implements Triangle<JavaPoint2D>
2D triangle class implementation based on https://github.com/jdiemke/delaunay-triangulator/blob/master/library/src/main/java/io/github/jdiemke/triangulation/Triangle2D.java
- Since:
- 1.0
- Author:
- Johannes Diemke, Christoph Praschl
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected JavaPoint2D
a
protected JavaPoint2D
b
protected JavaPoint2D
c
-
Fields inherited from class science.aist.imaging.api.domain.AbstractJavaPolygon
points
-
-
Constructor Summary
Constructors Constructor Description JavaTriangle2D(JavaPoint2D a, JavaPoint2D b, JavaPoint2D c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(JavaPoint2D point)
Tests if a 2D point lies inside this 2D triangle.protected JavaLine2D
createLine(JavaPoint2D p1, JavaPoint2D p2)
boolean
equals(Object o)
JavaPoint2D
getNoneEdgeVertex(JavaLine2D edge)
Returns the vertex of this triangle that is not part of the given edge.int
hashCode()
boolean
hasVertex(JavaPoint2D vertex)
Returns true if the given vertex is one of the vertices describing this triangle.boolean
isNeighbour(JavaLine2D edge)
Returns true if this triangle contains the given edge.boolean
isOrientedCCW()
Test if this triangle is oriented counterclockwise (CCW).boolean
isPointInCircumcircle(JavaPoint2D point)
Tests if a given point lies in the circumcircle of this triangle.String
toString()
-
Methods inherited from class science.aist.imaging.api.domain.twodimensional.JavaPolygon2D
calculateInnerDepth, calculateNormalvector, createPoint, getIntersection, getPolygonFromUnsortedPointCloud, isInConvexHull, isInConvexHull, sort
-
Methods inherited from class science.aist.imaging.api.domain.AbstractJavaPolygon
calculateContour, getPoints, getSize, isEmpty
-
Methods inherited from class science.aist.imaging.api.domain.AbstractSurface
getIntersection
-
-
-
-
Field Detail
-
a
protected JavaPoint2D a
-
b
protected JavaPoint2D b
-
c
protected JavaPoint2D c
-
-
Constructor Detail
-
JavaTriangle2D
public JavaTriangle2D(JavaPoint2D a, JavaPoint2D b, JavaPoint2D c)
-
-
Method Detail
-
contains
public boolean contains(JavaPoint2D point)
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
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classJavaPolygon2D
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classJavaPolygon2D
-
isPointInCircumcircle
public boolean isPointInCircumcircle(JavaPoint2D point)
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
public boolean 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)
-
isNeighbour
public boolean isNeighbour(JavaLine2D edge)
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
-
getNoneEdgeVertex
public JavaPoint2D getNoneEdgeVertex(JavaLine2D edge)
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
-
hasVertex
public boolean hasVertex(JavaPoint2D vertex)
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
-
createLine
protected JavaLine2D createLine(JavaPoint2D p1, JavaPoint2D p2)
- Overrides:
createLine
in classJavaPolygon2D
-
-