[name]

A geometric triangle as defined by three [page:Vector3 Vector3s] representing its three corners.

Constructor

[name]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )

[page:Vector3 a] - the first corner of the triangle. Default is a [page:Vector3] at `(0, 0, 0)`.
[page:Vector3 b] - the second corner of the triangle. Default is a [page:Vector3] at `(0, 0, 0)`.
[page:Vector3 c] - the final corner of the triangle. Default is a [page:Vector3] at `(0, 0, 0)`.

Creates a new [name].

Properties

[property:Vector3 a]

The first corner of the triangle. Default is a [page:Vector3] at `(0, 0, 0)`.

[property:Vector3 b]

The second corner of the triangle. Default is a [page:Vector3] at `(0, 0, 0)`.

[property:Vector3 c]

The final corner of the triangle. Default is a [page:Vector3] at `(0, 0, 0)`.

Methods

[method:Triangle clone]()

Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c] properties as this one.

[method:Vector3 closestPointToPoint]( [param:Vector3 point], [param:Vector3 target] )

[page:Vector3 point] - [page:Vector3]
[page:Vector3 target] — the result will be copied into this Vector3.

Returns the closest point on the triangle to [page:Vector3 point].

[method:Boolean containsPoint]( [param:Vector3 point] )

[page:Vector3 point] - [page:Vector3] to check.

Returns true if the passed point, when projected onto the plane of the triangle, lies within the triangle.

[method:this copy]( [param:Triangle triangle] )

Copies the values of the passed triangles's [page:.a a], [page:.b b] and [page:.c c] properties to this triangle.

[method:Boolean equals]( [param:Triangle triangle] )

Returns true if the two triangles have identical [page:.a a], [page:.b b] and [page:.c c] properties.

[method:Float getArea]()

Return the area of the triangle.

[method:Vector3 getBarycoord]( [param:Vector3 point], [param:Vector3 target] )

[page:Vector3 point] - [page:Vector3]
[page:Vector3 target] — the result will be copied into this Vector3.

Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate] from the given vector.

[link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates]

[method:Vector3 getMidpoint]( [param:Vector3 target] )

[page:Vector3 target] — the result will be copied into this Vector3.

Calculate the midpoint of the triangle.

[method:Vector3 getNormal]( [param:Vector3 target] )

[page:Vector3 target] — the result will be copied into this Vector3.

Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle.

[method:Plane getPlane]( [param:Plane target] )

[page:Plane target] — the result will be copied into this Plane.

Calculate a [page:Plane plane] based on the triangle. .

[method:Vector2 getUV]( [param:Vector3 point], [param:Vector2 uv1], [param:Vector2 uv2], [param:Vector2 uv3], [param:Vector2 target] )

[page:Vector3 point] - The point on the triangle.
[page:Vector2 uv1] - The uv coordinate of the triangle's first vertex.
[page:Vector2 uv2] - The uv coordinate of the triangle's second vertex.
[page:Vector2 uv3] - The uv coordinate of the triangle's third vertex.
[page:Vector2 target] — the result will be copied into this Vector2.

Returns the uv coordinates for the given point on the triangle.

[method:Boolean intersectsBox]( [param:Box3 box] )

[page:Box3 box] - Box to check for intersection against.

Determines whether or not this triangle intersects [page:Box3 box].

[method:Boolean isFrontFacing]( [param:Vector3 direction] )

[page:Vector3 direction] - The direction to test.

Whether the triangle is oriented towards the given direction or not.

[method:this set]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] ) [param:Triangle this]

Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to the passed [page:Vector3 vector3s].
Please note that this method only copies the values from the given objects.

[method:this setFromAttributeAndIndices]( [param:BufferAttribute attribute], [param:Integer i0], [param:Integer i1], [param:Integer i2] ) [param:Triangle this]

attribute - [page:BufferAttribute] of vertex data
i0 - [page:Integer] index
i1 - [page:Integer] index
i2 - [page:Integer] index

Sets the triangle's vertices from the buffer attribute vertex data.

[method:this setFromPointsAndIndices]( [param:Array points], [param:Integer i0], [param:Integer i1], [param:Integer i2] ) [param:Triangle this]

points - [page:Array] of [page:Vector3]s
i0 - [page:Integer] index
i1 - [page:Integer] index
i2 - [page:Integer] index

Sets the triangle's vectors to the vectors in the array.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]