A geometric triangle as defined by three Vector3s representing its three corners.
a - the first corner of the triangle. Default is a Vector3 at (0, 0, 0)
.
b - the second corner of the triangle. Default is a Vector3 at (0, 0, 0)
.
c - the final corner of the triangle. Default is a Vector3 at (0, 0, 0)
.
Creates a new Triangle.
The first corner of the triangle. Default is a Vector3 at (0, 0, 0)
.
The second corner of the triangle. Default is a Vector3 at (0, 0, 0)
.
The final corner of the triangle. Default is a Vector3 at (0, 0, 0)
.
Returns a new triangle with the same a, b and c properties as this one.
point - Vector3
target — the result will be copied into this Vector3.
Returns the closest point on the triangle to point.
point - Vector3 to check.
Returns true if the passed point, when projected onto the plane of the triangle, lies within the triangle.
Copies the values of the passed triangles's a, b and c properties to this triangle.
Returns true if the two triangles have identical a, b and c properties.
Return the area of the triangle.
point - Vector3
target — the result will be copied into this Vector3.
Return a barycentric coordinate
from the given vector.
Picture of barycentric coordinates
target — the result will be copied into this Vector3.
Calculate the midpoint of the triangle.
target — the result will be copied into this Vector3.
Calculate the normal vector of the triangle.
target — the result will be copied into this Plane.
Calculate a plane based on the triangle. .
point - The point on the triangle.
uv1 - The uv coordinate of the triangle's first vertex.
uv2 - The uv coordinate of the triangle's second vertex.
uv3 - The uv coordinate of the triangle's third vertex.
target — the result will be copied into this Vector2.
Returns the uv coordinates for the given point on the triangle.
box - Box to check for intersection against.
Determines whether or not this triangle intersects box.
direction - The direction to test.
Whether the triangle is oriented towards the given direction or not.
Sets the triangle's a, b and c properties to the passed vector3s.
Please note that this method only copies the values from the given objects.
attribute - BufferAttribute of vertex data
i0 - Integer index
i1 - Integer index
i2 - Integer index
Sets the triangle's vertices from the buffer attribute vertex data.
points - Array of Vector3s
i0 - Integer index
i1 - Integer index
i2 - Integer index
Sets the triangle's vectors to the vectors in the array.
For more info on how to obtain the source code of this module see this page.