Triangle

A geometric triangle as defined by three vectors.

Constructor

Triangle( a, b, c )

a -- Vector3
b -- Vector3
c -- Vector3
Sets the triangle's vectors to the passed vectors.

Properties

.a

The first Vector3 of the triangle.

.b

The second Vector3 of the triangle.

.c

The third Vector3 of the triangle.

Methods

.setFromPointsAndIndices ( points, i0, i1, i2 ) this

points -- Array of Vector3s
i0 -- Integer index
i1 -- Integer index
i2 -- Integer index
Sets the triangle's vectors to the vectors in the array.

.set ( a, b, c ) this

a -- Vector3
b -- Vector3
c -- Vector3
Sets the triangle's vectors to the passed vectors.

.normal ( optionalTarget )

optionalTarget -- Optional Vector3 target to set the result.
Return the calculated normal of the triangle.

.barycoordFromPoint ( point, optionalTarget )

point -- Vector3
optionalTarget -- Optional Vector3 target to set the result.
Return a barycentric coordinate from the given vector.

http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png(Picture of barycentric coordinates)

.clone ()

Return a new copy of this triangle.

.area ()

Return the area of the triangle.

.midpoint ( optionalTarget )

optionalTarget -- Optional Vector3 target to set the result.
Return the midpoint of the triangle. Optionally sets a target vector.

.equals ( triangle )

triangle -- Triangle
Checks to see if two triangles are equal (share the same vectors).

.plane ( optionalTarget )

optionalTarget -- Optional Plane target to set the result.
Return a plane based on the triangle. Optionally sets a target plane.

.containsPoint ( point )

point -- Vector3
Checks to see if the passed vector is within the triangle.

.closestPointToPoint ( point, optionalTarget )

point -- Vector3
optionalTarget -- Optional Vector3 target to set the result.
Returns the closest point on the triangle.

.copy ( triangle )

triangle -- Triangle
Copies the values of the vertices of the passed triangle to this triangle.

Source

src/math/Triangle.js
Edit