Triangle class

Represents a triangle in 2D space.

Inheritance

Constructors

Triangle({num? a, num? b, num? c, Angle? angleA, Angle? angleB, Angle? angleC, Point? A, Point? B, Point? C})
Creates a new triangle from provided sides, angles, and points.

Properties

A ↔ Point?
The point A of the triangle.
getter/setter pair
a ↔ num?
Side a of the triangle
getter/setter pair
angleA ↔ Angle?
The angle opposite side a of the triangle.
getter/setter pair
angleB ↔ Angle?
The angle opposite side b of the triangle.
getter/setter pair
angleC ↔ Angle?
The angle opposite side c of the triangle.
getter/setter pair
B ↔ Point?
The point B of the triangle.
getter/setter pair
b ↔ num?
Side b of the triangle
getter/setter pair
base → num?
no setter
C ↔ Point?
The point C of the triangle.
getter/setter pair
c ↔ num?
Side c of the triangle
getter/setter pair
circumCircleRadius → double
Get the circumcircle radius of the triangle.
no setter
hashCode → int
The hash code for this object.
no setterinherited
height1 → double
The height of the triangle, which is equal to the length of side b.
no setter
height2 → double
The heightII of the triangle, which is equal to the length of side a.
no setter
height3 → double
The heightIII of the triangle, calculated from the lengths of its sides.
no setter
heightA → num?
The height of side a of the triangle.
no setter
heightB → num?
The height of side b of the triangle.
no setter
heightC → num?
The height of side c of the triangle
no setter
inCircleRadius → double
Get the incircle radius of the triangle.
no setter
medianA → num?
The median of side a of the triangle.
no setter
medianB → num?
The median of side b of the triangle.
no setter
medianC → num?
The median of side c of the triangle.
no setter
name ↔ String
The name of the geometric shape.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
s → double
Get the semi-perimeter of a triangle
no setter

Methods

area([AreaMethod method = AreaMethod.heron]) → double
Calculates the area of the triangle using the given method.
override
calculateMissingCoordinates() → List<Point>
Calculate any missing coordinates. If all coordinates are known, it will throw an Exception.
calculateOtherCoordinates() → List<Point>
Calculate the missing coordinates (point C) if points A and B, sides a, b and angleC are given.
cosineRule() → void
Uses the cosine rule to calculate a missing side or angle. Requires two known sides and one known angle.
heron() → double
Calculates area using Heron's formula. Requires all sides to be known.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perimeter() → double
Calculates the perimeter of the triangle.
override
sineRule() → void
Uses the sine rule to calculate a missing side or angle. Requires one unknown side or angle.
toString() → String
A string representation of this object.
override
trigonometric() → double
Calculates area using trigonometric formula. Requires two sides and the angle between them.

Operators

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

Static Methods

baseHeightFormula(num base, num height) → double
Computes the area of a triangle using the base-height formula.
coordinatesFormula(List<Point> coords) → double
Computes the area of a triangle using the coordinates formula.
heronFormula(num a, num b, num c) → double
Computes the area of a triangle using Heron's formula.
trigonometricFormula(num a, num b, Angle angleC) → double
Computes the area of a triangle using the trigonometric formula.