[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

.a : Vector3

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

.b : Vector3

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

.c : Vector3

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

Methods

.clone () : Triangle

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

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

[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].

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

[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.

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

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

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

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

.getArea () : Float

Return the area of the triangle.

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

[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]

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

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

Calculate the midpoint of the triangle.

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

[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.

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

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

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

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

[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.

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

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

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

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

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

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

.set ( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] ) : this [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.

.setFromAttributeAndIndices ( [param:BufferAttribute attribute], [param:Integer i0], [param:Integer i1], [param:Integer i2] ) : this [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.

.setFromPointsAndIndices ( [param:Array points], [param:Integer i0], [param:Integer i1], [param:Integer i2] ) : this [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]

Triangle Triangle Triangle Triangle

Triangle Triangle Triangle Triangle