Circle class
A circle defined by a center point and a radius.
Implements Shape with area (pir^2) and perimeter (2pi*r). Supports containment checks, intersection with lines and other circles, and tangent line computation.
final c = Circle(center: Point(0, 0), radius: 5);
print(c.area); // ~78.54
print(c.contains(Point(1, 1))); // true
- Implemented types
Constructors
Properties
- area → double
-
Get area of circle
no setteroverride
- center → Point
-
Center point of this circle.
final
- circumference → double
-
Circumference of this circle (alias for perimeter)
no setter
- diameter → double
-
Diameter of this circle
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- perimeter → double
-
Get perimeter of circle
no setteroverride
- radius → double
-
Radius of this circle.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
contains(
Point point) → bool - Check if a point is inside this circle (alias for hasPoint)
-
distanceTo(
Point point) → double -
Shortest distance from circle boundary to
point -
getCircleIntersections(
Circle other) → List< Point> -
Get intersection points of this circle with
other -
getLineIntersections(
Line line) → List< Point> - Get intersection points of a line segment with this circle
-
hasPoint(
Point point) → bool - Check if a given point is inside of this circle
-
intersectsCircle(
Circle other) → bool -
Check if this circle overlaps with
other -
intersectsLine(
Line line) → bool - Check if a line segment intersects this circle
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rotate(
double deg) → Circle -
Rotate the circle by
degdegrees.override -
scale(
double value) → Circle -
Scale the circle by
value, scaling both radius and center.override -
tangentAt(
Point point) → Line -
Get tangent line at
pointon boundary -
toString(
) → String -
A string representation of this object.
inherited
-
translate(
{double x = 0, double y = 0}) → Circle -
Translate the circle by
xhorizontally andyvertically.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override