B.Math.Triangle()

Represents a triangle.

To create the object use B.Math.makeTriangle().

PROPERTIES:

{B.Math.Vector3} a

The first point.

{B.Math.Vector3} b

The second point.

{B.Math.Vector3} c

The third point.

METHODS:

clone()

Clones this triangle to a new triangle.

RETURNS:

copy(triangle)

Copies a given triangle into this triangle.

PARAMETERS:

{B.Math.Triangle} triangle

RETURNS:

set(a, b, c)

Sets this triangle from three points.

PARAMETERS:

RETURNS:

fromArray(array, offset)

Sets this triangle from a part of array.

PARAMETERS:

{Array.<number>} array

{number} [offset] = 0

RETURNS:

{number}

new offset

toArray(array, offset)

Sets this triangle to a part of array.

PARAMETERS:

{Array.<number>} array

{number} [offset] = 0

RETURNS:

{number}

new offset

translate(offset)

Translates this triangle by a given offset.

PARAMETERS:

{B.Math.Vector3} offset

RETURNS:

transform(matrix)

Transforms this triangle by a 4x4 matrix.

PARAMETERS:

{B.Math.Matrix4} matrix

RETURNS:

normal(result)

Gets the normal of this triangle.

PARAMETERS:

{B.Math.Vector3} [result]

omit if you want to return newly created vector

RETURNS:

plane(result)

Gets the plane of this triangle.

PARAMETERS:

{B.Math.Plane} [result]

omit if you want to return newly created plane

RETURNS:

area()

Gets the area of this triangle.

RETURNS:

{number}

perimeter()

Gets the perimeter of this triangle.

RETURNS:

{number}

centroid(result)

Gets the centroid of this triangle.

PARAMETERS:

{B.Math.Vector3} [result]

omit if you want to return newly created vector

RETURNS:

barycentric(point, result)

Computes barycentric coordinates of point for this triangle.

PARAMETERS:

{B.Math.Vector3} point

{B.Math.Vector3} [result]

omit if you want to return newly created vector

RETURNS:

THROWS:

{Error}

if triangle is collinear or singular

equal(triangle)

Checks for strict equality of this triangle and another triangle.

PARAMETERS:

{B.Math.Triangle} triangle

RETURNS:

{boolean}

PROPERTIES:

METHODS: