Triangle class

Defines a mathematical triangle strictly via 3 points in 2D space.

Implemented types

Constructors

Triangle({required Point<num> p1, required Point<num> p2, required Point<num> p3})
Creates a Triangle by defining its three vertices.

Properties

area double
The total surface area of the shape.
no setteroverride
boundingBox Rectangle
The smallest axis-aligned rectangle that completely encloses the shape.
no setteroverride
centroid Point<double>
The mathematical center of mass of the shape.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
p1 Point<num>
The first vertex.
final
p2 Point<num>
The second vertex.
final
p3 Point<num>
The third vertex.
final
perimeter double
The total length of the shape's boundary.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sideA double
The first side length.
no setter
sideB double
The second side length.
no setter
sideC double
The third side length.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rotate(double angle, [Point<num>? origin]) Triangle
Rotates the shape by the given angle (in radians) around the origin. If origin is omitted, rotates around the shape's centroid.
override
scale(num factor) Triangle
Scales the shape uniformly by the given factor originating from centroid.
override
toString() String
A string representation of this object.
override
translate(Point<num> offset) Triangle
Translates the shape by the given vector offset.
override

Operators

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