A geometric triangle as defined by three vectors representing its three corners.
Constructs a new triangle.
a
The first corner of the triangle.
Default is (0,0,0).
b
The second corner of the triangle.
Default is (0,0,0).
c
The third corner of the triangle.
Default is (0,0,0).
The first corner of the triangle.
The second corner of the triangle.
The third corner of the triangle.
Returns a new triangle with copied values from this instance.
Returns: A clone of this instance.
Returns the closest point on the triangle to the given point.
p
The point to compute the closest point for.
target
The target vector that is used to store the method's result.
Returns: The closest point on the triangle.
Returns true if the given point, when projected onto the plane of the triangle, lies within the triangle.
point
The point in 3D space to test.
Returns: Whether the given point, when projected onto the plane of the triangle, lies within the triangle or not.
Copies the values of the given triangle to this instance.
triangle
The triangle to copy.
Returns: A reference to this triangle.
Returns true if this triangle is equal with the given one.
triangle
The triangle to test for equality.
Returns: Whether this triangle is equal with the given one.
Computes the area of the triangle.
Returns: The triangle's area.
Computes a barycentric coordinates from the given vector. Returns null if the triangle is degenerate.
point
A point in 3D space.
target
The target vector that is used to store the method's result.
Returns: The barycentric coordinates for the given point
Computes the value barycentrically interpolated for the given point on the triangle. Returns null if the triangle is degenerate.
point
Position of interpolated point.
v1
Value to interpolate of first vertex.
v2
Value to interpolate of second vertex.
v3
Value to interpolate of third vertex.
target
The target vector that is used to store the method's result.
Returns: The interpolated value.
Computes the midpoint of the triangle.
target
The target vector that is used to store the method's result.
Returns: The triangle's midpoint.
Computes the normal of the triangle.
target
The target vector that is used to store the method's result.
Returns: The triangle's normal.
Computes a plane the triangle lies within.
target
The target vector that is used to store the method's result.
Returns: The plane the triangle lies within.
Returns true if this triangle intersects with the given box.
box
The box to intersect.
Returns: Whether this triangle intersects with the given box or not.
Returns true if the triangle is oriented towards the given direction.
direction
The (normalized) direction vector.
Returns: Whether the triangle is oriented towards the given direction or not.
Sets the triangle's vertices by copying the given values.
a
The first corner of the triangle.
b
The second corner of the triangle.
c
The third corner of the triangle.
Returns: A reference to this triangle.
Sets the triangle's vertices by copying the given attribute values.
attribute
A buffer attribute with 3D points data.
i0
The attribute index representing the first corner of the triangle.
i1
The attribute index representing the second corner of the triangle.
i2
The attribute index representing the third corner of the triangle.
Returns: A reference to this triangle.
Sets the triangle's vertices by copying the given array values.
points
An array with 3D points.
i0
The array index representing the first corner of the triangle.
i1
The array index representing the second corner of the triangle.
i2
The array index representing the third corner of the triangle.
Returns: A reference to this triangle.
Returns true if the given point, when projected onto the plane of the triangle, lies within the triangle.
point
The point in 3D space to test.
a
The first corner of the triangle.
b
The second corner of the triangle.
c
The third corner of the triangle.
Returns: Whether the given point, when projected onto the plane of the triangle, lies within the triangle or not.
Computes a barycentric coordinates from the given vector. Returns null if the triangle is degenerate.
point
A point in 3D space.
a
The first corner of the triangle.
b
The second corner of the triangle.
c
The third corner of the triangle.
target
The target vector that is used to store the method's result.
Returns: The barycentric coordinates for the given point
Computes the value barycentrically interpolated for the given attribute and indices.
attr
The attribute to interpolate.
i1
Index of first vertex.
i2
Index of second vertex.
i3
Index of third vertex.
barycoord
The barycoordinate value to use to interpolate.
target
The target vector that is used to store the method's result.
Returns: The interpolated attribute value.
Computes the value barycentrically interpolated for the given point on the triangle. Returns null if the triangle is degenerate.
point
Position of interpolated point.
p1
The first corner of the triangle.
p2
The second corner of the triangle.
p3
The third corner of the triangle.
v1
Value to interpolate of first vertex.
v2
Value to interpolate of second vertex.
v3
Value to interpolate of third vertex.
target
The target vector that is used to store the method's result.
Returns: The interpolated value.
Computes the normal vector of a triangle.
a
The first corner of the triangle.
b
The second corner of the triangle.
c
The third corner of the triangle.
target
The target vector that is used to store the method's result.
Returns: The triangle's normal.
Returns true if the triangle is oriented towards the given direction.
a
The first corner of the triangle.
b
The second corner of the triangle.
c
The third corner of the triangle.
direction
The (normalized) direction vector.
Returns: Whether the triangle is oriented towards the given direction or not.