Circle class

The circle with a given center and a radius.

A circle's radius cannot be negative, but it can be zero.

A circle transforms into a circle under any conformal transformation, i.e. a Transform2D that contains translations, rotations, and uniform scaling. Under a generic projection, a circle would turn into an ellipse, however, this is currently not implemented.

Inheritance

Constructors

Circle(Vector2 center, double radius)

Properties

aabb Aabb2
The axis-aligned bounding box of the shape.
no setteroverride
center Vector2
The central point of the shape.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
True if the shape is "closed", in the sense that it has an interior. For example, a closed shape can be filled with a paint.
no setterinherited
isConvex bool
True if the shape is convex, i.e. a line segment connecting any two points of the shape would lie completely within the shape.
no setteroverride
perimeter double
The length of the shape's boundary. For some more complicated shapes this can be computed approximately.
no setteroverride
radius double
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asPath() Path
Converts the shape to a Path object, suitable for rendering on a canvas. If a particular geometric primitive cannot be represented as a Path faithfully, an approximate path can be returned.
override
containsPoint(Vector2 point) bool
Returns true if the given point is inside the shape or on the boundary.
override
move(Vector2 offset) → void
Translates the shape by the specified offset vector, in-place.
override
nearestPoint(Vector2 point) Vector2
Returns a point on the shape's boundary which is closest to the given point.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
project(Transform2D transform, [Shape? target]) Shape
Returns the result of applying an affine transformation to the shape.
override
randomPoint({Random? random, bool within = true}) Vector2
Returns a random point within the shape if within is true (default) and otherwise a point along the edges of the shape. Do note that within=true also includes the edges.
override
support(Vector2 direction) Vector2
Finds the intersection of this shape with another one, if it exists. Returns a point on the boundary that is furthest in the given direction.
override
toString() String
A string representation of this object.
override

Operators

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

Static Methods

fromPoints(Vector2 p1, Vector2 p2, Vector2 p3) Circle?
Tries to create a Circle that intersects the 3 points, if it exists.