Circle

A circle with a set center and radius.

center Point

The center point of the circle.

radius number

The radius of the circle.

Constructors

Circle (center: any | Point, radius: number)

Creates a circle with a set center and radius.

Parameters

center any | Point

The center point of the circle.

radius number

The radius of the circle.

Methods

addObserver

Adds an observer to be notified for changes.

Parameters

observer GeometryObserver

The observer to add.

Returns

Circle - The current Arc instance.

bbox

Returns the bounding box of this circle after applying the specified transformation matrix.

Parameters

matrix? Matrix

The transformation matrix to apply.

Returns

Rect - The bounding box after applying the transformation matrix.

clone

Creates a new instance with the same center and radius.

Returns

Circle - A new Circle instance with the same center and radius.

equals

Compares this circle with another instance.

Parameters

other Circle

The circle to compare with.

Returns

boolean true if the point coordinates match. Otherwise, returns false.

getCenter

Gets the center location of the circle.

Returns

Point - The location of the circle center.

getRadius

Gets the radius of the circle.

Returns

number - The radius of the circle.

observers

Returns the list of observers.

Returns

GeometryObserver[] - The current observers.

pointAt

Gets the location of a point on the circumference of the circle at a given angle.

Parameters

angle number

The angle in decimal degrees. Measured in a clockwise direction with 0 (zero) pointing "right". Negative values or values greater than 360 are normalized.

Returns

Point - The point on the circumference of the circle.

removeObserver

Stops notifying the specified observer for changes.

Parameters

observer GeometryObserver

The observer to remove.

Returns

Circle - The current Arc instance.

resume

Resumes the notification to all observers for changes.

Returns

Circle - The current Arc instance.

setCenter

Sets the location of the circle center.

Parameters

center Point | number[]

The new center Point or an equivalent [x, y] array.

Returns

Point - The location of the circle center.

setRadius

Sets the radius of the circle.

Parameters

radius number

The new radius of the circle.

Returns

Circle - The current Circle instance.

suspend

Suspends the change notifications to all observers.

Returns

Circle - The current Arc instance.