The foundational contract for all 2D entities.
Utilizing the Curiously Recurring Template Pattern (CRTP), Shape ensures
that spatial transformations logically return the exact mathematical entity.
Properties
- area → double
-
The total surface area of the shape.
no setter
- boundingBox → Rectangle
-
The smallest axis-aligned rectangle that completely encloses the shape.
no setter
-
centroid
→ Point<
double> -
The mathematical center of mass of the shape.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- perimeter → double
-
The total length of the shape's boundary.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rotate(
double angle, [Point< num> ? origin]) → T -
Rotates the shape by the given
angle(in radians) around theorigin. Iforiginis omitted, rotates around the shape's centroid. -
scale(
num factor) → T -
Scales the shape uniformly by the given
factororiginating from centroid. -
toString(
) → String -
A string representation of this object.
inherited
-
translate(
Point< num> offset) → T -
Translates the shape by the given vector
offset.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited