# Class: Triangle

## jsts.geom.Triangle

#### new Triangle(p0, p1, p2)

Represents a planar triangle, and provides methods for calculating various properties of triangles.
##### Parameters:
Name Type Description
`p0` jsts.geom.Coordinate a coordinate.
`p1` jsts.geom.Coordinate a coordinate.
`p2` jsts.geom.Coordinate a coordinate.
Source:

### Methods

#### (static) angleBisector(a, b, c) → {jsts.geom.Coordinate}

Computes the point at which the bisector of the angle ABC cuts the segment AC.
##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertex of the triangle.
`b` jsts.geom.Coordinate a vertex of the triangle.
`c` jsts.geom.Coordinate a vertex of the triangle.
Source:
##### Returns:
the angle bisector cut point.
Type
jsts.geom.Coordinate

#### (static) area(a, b, c) → {Number}

Computes the 2D area of a triangle. The area value is always non-negative.
##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertex of the triangle.
`b` jsts.geom.Coordinate a vertex of the triangle.
`c` jsts.geom.Coordinate a vertex of the triangle.
Source:
##### Returns:
the area of the triangle.
Type
Number

#### (static) centroid(a, b, c) → {jsts.geom.Coordinate}

Computes the centroid (centre of mass) of a triangle. This is also the point at which the triangle's three medians intersect (a triangle median is the segment from a vertex of the triangle to the midpoint of the opposite side). The centroid divides each median in a ratio of 2:1. The centroid always lies within the triangle.
##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertx of the triangle.
`b` jsts.geom.Coordinate a vertx of the triangle.
`c` jsts.geom.Coordinate a vertx of the triangle.
Source:
##### Returns:
the centroid of the triangle.
Type
jsts.geom.Coordinate

#### (static) circumcentre(a, b, c) → {jsts.geom.Coordinate}

Computes the circumcentre of a triangle. The circumcentre is the centre of the circumcircle, the smallest circle which encloses the triangle. It is also the common intersection point of the perpendicular bisectors of the sides of the triangle, and is the only point which has equal distance to all three vertices of the triangle.

This method uses an algorithm due to J.R.Shewchuk which uses normalization to the origin to improve the accuracy of computation. (See Lecture Notes on Geometric Robustness, Jonathan Richard Shewchuk, 1999).

##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertx of the triangle.
`b` jsts.geom.Coordinate a vertx of the triangle.
`c` jsts.geom.Coordinate a vertx of the triangle.
Source:
##### Returns:
the circumcentre of the triangle.
Type
jsts.geom.Coordinate

#### (static) det(m00, m01, m10, m11) → {Number}

Computes the determinant of a 2x2 matrix. Uses standard double-precision arithmetic, so is susceptible to round-off error.
##### Parameters:
Name Type Description
`m00` Number the [0,0] entry of the matrix.
`m01` Number the [0,1] entry of the matrix.
`m10` Number the [1,0] entry of the matrix.
`m11` Number the [1,1] entry of the matrix.
Source:
the determinant.
Type
Number

#### (static) inCentre(a, b, c) → {jsts.geom.Coordinate}

Computes the incentre of a triangle. The inCentre of a triangle is the point which is equidistant from the sides of the triangle. It is also the point at which the bisectors of the triangle's angles meet. It is the centre of the triangle's incircle, which is the unique circle that is tangent to each of the triangle's three sides.
##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertx of the triangle.
`b` jsts.geom.Coordinate a vertx of the triangle.
`c` jsts.geom.Coordinate a vertx of the triangle.
Source:
##### Returns:
the point which is the incentre of the triangle.
Type
jsts.geom.Coordinate

#### (static) isAcute(a, b, c) → {Boolean}

Tests whether a triangle is acute. A triangle is acute iff all interior angles are acute. This is a strict test - right triangles will return false A triangle which is not acute is either right or obtuse.

Note: this implementation is not robust for angles very close to 90 degrees.

##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertex of the triangle.
`b` jsts.geom.Coordinate a vertex of the triangle.
`c` jsts.geom.Coordinate a vertex of the triangle.
Source:
##### Returns:
true if the triangle is acute.
Type
Boolean

#### (static) longestSideLength(a, b, c) → {Number}

Computes the length of the longest side of a triangle
##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertex of the triangle.
`b` jsts.geom.Coordinate a vertex of the triangle.
`c` jsts.geom.Coordinate a vertex of the triangle.
Source:
##### Returns:
the length of the longest side of the triangle.
Type
Number

#### (static) perpendicularBisector(a, b) → {jsts.algorithm.HCoordinate}

Computes the line which is the perpendicular bisector of the line segment a-b.
##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a point.
`b` jsts.geom.Coordinate another point.
Source:
##### Returns:
the perpendicular bisector, as an HCoordinate.
Type
jsts.algorithm.HCoordinate

#### (static) signedArea(a, b, c) → {Number}

Computes the signed 2D area of a triangle. The area value is positive if the triangle is oriented CW, and negative if it is oriented CCW.

The signed area value can be used to determine point orientation, but the implementation in this method is susceptible to round-off errors. Use Coordinate, Coordinate) for robust orientation calculation.

##### Parameters:
Name Type Description
`a` jsts.geom.Coordinate a vertex of the triangle.
`b` jsts.geom.Coordinate a vertex of the triangle.
`c` jsts.geom.Coordinate a vertex of the triangle.
Source:
##### Returns:
the signed 2D area of the triangle.
Type
Number

#### inCentre() → {jsts.geom.Coordinate}

Computes the incentre of a triangle. The incentre of a triangle is the point which is equidistant from the sides of the triangle. It is also the point at which the bisectors of the triangle's angles meet. It is the centre of the triangle's incircle, which is the unique circle that is tangent to each of the triangle's three sides.
Source:
##### Returns:
the point which is the inCentre of the triangle.
Type
jsts.geom.Coordinate