Triangle class
Represents a planar triangle, and provides methods for calculating various properties of triangles.
@version 1.7
Constructors
- Triangle(Coordinate p0, Coordinate p1, Coordinate p2)
- Creates a new triangle with the given vertices.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- p0 ↔ Coordinate
-
The coordinates of the vertices of the triangle
getter/setter pair
- p1 ↔ Coordinate
-
The coordinates of the vertices of the triangle
getter/setter pair
- p2 ↔ Coordinate
-
The coordinates of the vertices of the triangle
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
area(
) → double - Computes the 2D area of this triangle. The area value is always non-negative.
-
area3D(
) → double - Computes the 3D area of this triangle. The value computed is always non-negative.
-
centroid(
) → Coordinate - Computes the centroid (centre of mass) of this 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.
-
circumcentre(
) → Coordinate - Computes the circumcentre of this 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.
-
inCentre(
) → Coordinate - Computes the incentre of this 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.
-
interpolateZ(
Coordinate? p) → double - Computes the Z-value (elevation) of an XY point on a three-dimensional plane defined by this triangle (whose vertices must have Z-values). This triangle must not be degenerate (in other words, the triangle must enclose a non-zero area), and must not be parallel to the Z-axis.
-
isAcute(
) → bool - Tests whether this 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.
-
longestSideLength(
) → double - Computes the length of the longest side of this triangle
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
signedArea(
) → double - Computes the signed 2D area of this triangle. The area value is positive if the triangle is oriented CW, and negative if it is oriented CCW.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
angleBisector(
Coordinate a, Coordinate b, Coordinate c) → Coordinate - Computes the point at which the bisector of the angle ABC cuts the segment AC.
-
area3DStatic(
Coordinate a, Coordinate b, Coordinate c) → double - Computes the 3D area of a triangle. The value computed is always non-negative.
-
areaStatic(
Coordinate a, Coordinate b, Coordinate c) → double - Computes the 2D area of a triangle. The area value is always non-negative.
-
centroidStatic(
Coordinate a, Coordinate b, Coordinate c) → 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.
-
circumcentreStatic(
Coordinate a, Coordinate b, Coordinate c) → 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.
-
circumcentreStaticDD(
Coordinate a, Coordinate b, Coordinate c) → 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.
-
det(
double m00, double m01, double m10, double m11) → double - Computes the determinant of a 2x2 matrix. Uses standard double-precision arithmetic, so is susceptible to round-off error.
-
inCentreStatic(
Coordinate a, Coordinate b, Coordinate c) → 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.
-
interpolateZStatic(
Coordinate p, Coordinate v0, Coordinate v1, Coordinate v2) → double - Computes the Z-value (elevation) of an XY point on a three-dimensional plane defined by a triangle whose vertices have Z-values. The defining triangle must not be degenerate (in other words, the triangle must enclose a non-zero area), and must not be parallel to the Z-axis.
-
isAcuteStatic(
Coordinate a, Coordinate b, Coordinate c) → bool - 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.
-
longestSideLengthStatic(
Coordinate a, Coordinate b, Coordinate c) → double - Computes the length of the longest side of a triangle
-
perpendicularBisector(
Coordinate a, Coordinate b) → HCoordinate - Computes the line which is the perpendicular bisector of the line segment a-b.
-
signedAreaStatic(
Coordinate a, Coordinate b, Coordinate c) → double - 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.