Triangle class

A triangle defined by three vertices a, b, and c.

Implements Shape and provides classification checks (right, equilateral, isosceles, scalene, acute, obtuse), special points (centroid, circumcenter, incenter, orthocenter), and inscribed/circumscribed circle computation.

final t = Triangle(Point(0, 0), Point(4, 0), Point(2, 3));
print(t.area);        // 6.0
print(t.isAcute);     // true
print(t.centroid);    // Point(2, 1)
Implemented types

Constructors

Triangle(Point a, Point b, Point c)
Creates a triangle from three vertices.
const
Triangle.equilateral({required Point center, required double radius})
Creates an equilateral triangle inscribed in a circle with given center and radius.
factory

Properties

a Point
First vertex.
final
AB Line
Line that goes from a to b;
no setter
AC Line
Line that goes from a to c;
no setter
angles List<Rad>
Interior angles at vertices a, b, c in radians.
no setter
area double
Area of this shape.
no setteroverride
b Point
Second vertex.
final
baseLine Line
Get baseLine of this triangle
no setter
BC Line
Line that goes from b to c;
no setter
c Point
Third vertex.
final
CA Line
Line that goes from c to a;
no setter
centroid Point
Get centroid of this triangle
no setter
circumcenter Point
Get circumcenter of this triangle
no setter
circumscribedCircle Circle
Get the circumscribed circle (circumcircle)
no setter
hashCode int
The hash code for this object.
no setterinherited
height double
Get height value of this triangle
no setter
heightLine Line
Get height Line
no setter
hypotenuse Line
Get hypotenuse
no setter
incenter Point
Get incenter of this triangle
no setter
inscribedCircle Circle
Get the inscribed circle (incircle)
no setter
isAcute bool
Check is this triangle is Acute
no setter
isEquilateral bool
Check is this triangle is equilateral
no setter
isIsosceles bool
Check is this triangle is Isosceles
no setter
isObtuse bool
Check is this triangle is Obtuse
no setter
isRightTriangle bool
Check if this triangle is right
no setter
isScalene bool
Check if this triangle is scalene
no setter
orthocenter Point
Get orthocenter of this triangle
no setter
perimeter double
Perimeter (circumference) of this shape.
no setteroverride
posVertex Point
Pos vertex
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sides List<Line>
Get 3 sides of this triangle
no setter
vertices List<Point>
Get list of 3 vertices of this triangle
no setter

Methods

contains(Point p) bool
Check if a point is inside this triangle
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rotate(double deg) Triangle
Rotate all vertices by deg degrees around the origin.
override
scale(double value) Triangle
Scale all vertices by value.
override
toString() String
A string representation of this object.
inherited
translate({double x = 0, double y = 0}) Triangle
Translate all vertices by x horizontally and y vertically.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited