Methods
(static) random() → {Triangle}
Returns a random Triangle of unit length.
- Source:
Returns:
A random triangle of unit radius.
- Type
- Triangle
area() → {number}
Returns the area of the triangle.
- Source:
Returns:
The area of the triangle.
- Type
- number
centroid() → {number}
Returns the centroid of the triangle.
- Source:
Returns:
The centroid of the triangle.
- Type
- number
closestPoint(point) → {Vec3}
Returns the closest point on the triangle to the specified point.
Parameters:
Name | Type | Description |
---|---|---|
point |
Vec3 | Array | The point to test. |
- Source:
Returns:
The closest point on the edge.
- Type
- Vec3
equals(that, epsilon) → {boolean}
Returns true if the vector components match those of a provided triangle.
An optional epsilon value may be provided.
Parameters:
Name | Type | Description |
---|---|---|
that |
Triangle | The vector to test equality with. |
epsilon |
number | The epsilon value. Optional. |
- Source:
Returns:
Whether or not the vector components match.
- Type
- boolean
intersect(origin, direction, ignoreBehind, ignoreBackface) → {Object|boolean}
Intersect the triangle and return intersection information.
Parameters:
Name | Type | Description |
---|---|---|
origin |
Vec3 | Array | The origin of the intersection ray |
direction |
Vec3 | Array | The direction of the intersection ray. |
ignoreBehind |
boolean | Whether or not to ignore intersections behind the origin of the ray. |
ignoreBackface |
boolean | Whether or not to ignore the backface of the triangle. |
- Source:
Returns:
The intersection information, or false if there is no intersection.
- Type
- Object | boolean
isInside(point) → {boolean}
Returns true if the point is inside the triangle. The point must be
coplanar.
Parameters:
Name | Type | Description |
---|---|---|
point |
Vec3 | Array | The point to test. |
- Source:
Returns:
Whether or not the point is inside the triangle.
- Type
- boolean
normal() → {number}
Returns the normal of the triangle.
- Source:
Returns:
The normal of the triangle.
- Type
- number
radius() → {number}
Returns the radius of the bounding sphere of the triangle.
- Source:
Returns:
The radius of the bounding sphere.
- Type
- number
toString() → {String}
Returns a string representation of the vector.
- Source:
Returns:
The string representation of the vector.
- Type
- String