Options
All
• Public
• Public/Protected
• All

# Class Triangle

Triangle class provides static functions to create and operate on trianges. A triange is usually represented as a Group of 3 Pts. You can use the static function as-is, or apply the `op` method in Group or Pt to many of these functions. See Op guide for details.

• Triangle

## Methods

### Static altitude

• Get a triangle's altitude, which is a line from a triangle's point to its opposite side, and perpendicular to its opposite side.

#### Parameters

• ##### pts: GroupLike

a Group of Pts

• ##### index: number

a Pt on the triangle group

#### Returns Group

a Group that represents the altitude line

### Static circumcenter

• Get circumcenter, which is the intersection point of its 3 perpendicular bisectors lines ( each of which divides a side in half and is perpendicular to the side)

#### Parameters

• ##### pts: GroupLike

a Group of Pts

#### Returns Pt

the circumcenter as a Pt

### Static circumcircle

• Get circumcenter, which is the intersection point of its 3 perpendicular bisectors lines ( each of which divides a side in half and is perpendicular to the side)

#### Parameters

• ##### pts: GroupLike

a Group of Pts

• ##### Optional center: Pt

Optional parameter if the circumcenter is already known. Otherwise, leave it empty and the circumcenter will be calculated

### Static fromCenter

• Create an equilateral triangle based on a center point and a size

#### Parameters

• ##### pt: PtLike

the center point

• ##### size: number

size is the magnitude of lines from center to the triangle's vertices, like a "radius".

### Static fromCircle

• Create a triangle that fits within a circle

#### Parameters

• ##### circle: GroupLike

a Group of 2 Pts representing a circle

### Static fromRect

• Create a triangle from a rectangle. The triangle will be isosceles, with the bottom of the rectangle as its base.

#### Parameters

• ##### rect: GroupLike

a Group of 2 Pts representing a rectangle

### Static incenter

• Get incenter, which is the center point of its inner circle, and also the intersection point of its 3 angle bisector lines (each of which cuts one of the 3 angles in half).

#### Parameters

• ##### pts: GroupLike

a Group of Pts

#### Returns Pt

the incenter as a Pt

### Static incircle

• Get an interior circle, which is the largest circle completed enclosed by this triangle

#### Parameters

• ##### pts: GroupLike

a Group of Pts

• ##### Optional center: Pt

Optional parameter if the incenter is already known. Otherwise, leave it empty and the incenter will be calculated

### Static medial

• Get the medial, which is an inner triangle formed by connecting the midpoints of this triangle's sides

#### Parameters

• ##### pts: GroupLike

a Group of Pts

#### Returns Group

a Group representing a medial triangle

### Static oppositeSide

• Given a point of the triangle, the opposite side is the side which the point doesn't touch.

#### Parameters

• ##### pts: GroupLike

a Group of Pts

• ##### index: number

a Pt on the triangle group

#### Returns Group

a Group that represents a line of the opposite side

### Static orthocenter

• Get orthocenter, which is the intersection point of a triangle's 3 altitudes (the 3 lines that are perpendicular to its 3 opposite sides).

#### Parameters

• ##### pts: GroupLike

a Group of Pts

#### Returns Pt

the orthocenter as a Pt

Generated using TypeDoc