 # B.Math.Triangle()

Represents a triangle.

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

## PROPERTIES:

The first point.

The second point.

The third point.

## METHODS:

clone()

Clones this triangle to a new triangle.

### RETURNS:

this

copy(triangle)

Copies a given triangle into this triangle.

triangle

### RETURNS:

this

set(a, b, c)

Sets this triangle from three points.

### RETURNS:

this

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.

offset

### RETURNS:

this

transform(matrix)

Transforms this triangle by a 4x4 matrix.

matrix

### RETURNS:

this

normal(result)

Gets the normal of this triangle.

### PARAMETERS:

[result]

omit if you want to return newly created vector

### RETURNS:

plane(result)

Gets the plane of this triangle.

### PARAMETERS:

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

[result]

omit if you want to return newly created vector

### RETURNS:

barycentric(point, result)

Computes barycentric coordinates of point for this triangle.

### PARAMETERS:

point

[result]

omit if you want to return newly created vector

### THROWS:

{Error}

if triangle is collinear or singular

equal(triangle)

Checks for strict equality of this triangle and another triangle.

triangle

{boolean}