toxi.geom
Class Triangle
java.lang.Object
toxi.geom.Triangle
public class Triangle
- extends java.lang.Object
Method Summary |
Vec3D |
closedPoint(Vec3D p)
Deprecated. |
Vec3D |
closestPointOnSurface(Vec3D p)
Computes the the point closest to the current vector on the surface of
triangle abc. |
Vec3D |
computeCentroid()
|
Vec3D |
computeNormal()
|
boolean |
containsPoint(Vec3D p)
Checks if point vector is inside the triangle created by the points a, b
and c. |
static Triangle |
createEquilateralFrom(Vec3D a,
Vec3D b)
|
Vec3D |
getClosestVertexTo(Vec3D p)
Finds and returns the closest point on any of the triangle edges to the
point given. |
boolean |
isClockwiseInXY()
|
static boolean |
isClockwiseInXY(Vec3D a,
Vec3D b,
Vec3D c)
|
boolean |
isClockwiseInXZ()
|
static boolean |
isClockwiseInXZ(Vec3D a,
Vec3D b,
Vec3D c)
|
boolean |
isClockwiseInYZ()
|
static boolean |
isClockwiseInYZ(Vec3D a,
Vec3D b,
Vec3D c)
|
void |
set(Vec3D a2,
Vec3D b2,
Vec3D c2)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
a
public Vec3D a
b
public Vec3D b
c
public Vec3D c
normal
public Vec3D normal
centroid
public Vec3D centroid
Triangle
public Triangle()
Triangle
public Triangle(Vec3D a,
Vec3D b,
Vec3D c)
createEquilateralFrom
public static Triangle createEquilateralFrom(Vec3D a,
Vec3D b)
isClockwiseInXY
public static boolean isClockwiseInXY(Vec3D a,
Vec3D b,
Vec3D c)
isClockwiseInXZ
public static boolean isClockwiseInXZ(Vec3D a,
Vec3D b,
Vec3D c)
isClockwiseInYZ
public static boolean isClockwiseInYZ(Vec3D a,
Vec3D b,
Vec3D c)
closedPoint
@Deprecated
public Vec3D closedPoint(Vec3D p)
- Deprecated.
- See Also:
closestPointOnSurface(Vec3D)
closestPointOnSurface
public Vec3D closestPointOnSurface(Vec3D p)
- Computes the the point closest to the current vector on the surface of
triangle abc.
From Real-Time Collision Detection by Christer Ericson, published by
Morgan Kaufmann Publishers, Copyright 2005 Elsevier Inc
- Returns:
- closest point on triangle (result may also be one of a, b or c)
computeCentroid
public Vec3D computeCentroid()
computeNormal
public Vec3D computeNormal()
containsPoint
public boolean containsPoint(Vec3D p)
- Checks if point vector is inside the triangle created by the points a, b
and c. These points will create a plane and the point checked will have
to be on this plane in the region between a,b,c.
Note: The triangle must be defined in clockwise order a,b,c
- Returns:
- true, if point is in triangle.
getClosestVertexTo
public Vec3D getClosestVertexTo(Vec3D p)
- Finds and returns the closest point on any of the triangle edges to the
point given.
- Parameters:
p
- point to check
- Returns:
- closest point
isClockwiseInXY
public boolean isClockwiseInXY()
isClockwiseInXZ
public boolean isClockwiseInXZ()
isClockwiseInYZ
public boolean isClockwiseInYZ()
set
public void set(Vec3D a2,
Vec3D b2,
Vec3D c2)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object