arcade2d
Class

Circle

geometry/circle.ts:18

Defines a circle as a pure shape: it is described entirely by its radius and has no position of its own. Where a circle "is" in the world is the responsibility of whatever owns it (e.g. a transform / WorldObject position).

Consequently, geometric queries operate in the circle's local space, where the circle is centered on the origin 0,0. Callers map world coordinates into that space (and supply the relative offset between two shapes) before calling.

A negative radius is treated as having no area for containment and intersection purposes.

Constructors

#
constructor(radius: number): Circle

Parameters

  • radius number

Properties

readonly #
radius: number

The radius of the circle. Expected to be non-negative.

Accessors

readonly #
area: number

The area enclosed by the circle (πr²).

readonly #
circumference: number

The distance around the circle (2πr).

readonly #
diameter: number

The distance across the circle through its center (radius * 2).

Methods

#
clone(): Circle

Returns a copy of this circle.

Returns

Circle
#
containsPoint(point: PointPrimitive): boolean

Determines whether a point lies inside this circle. The point is expressed in the circle's local space (relative to its center). A point exactly on the edge is treated as contained.

Parameters

Returns

boolean
#
getBoundingBox(): Rectangle

Returns the Rectangle size that tightly bounds this circle (diameter × diameter), centered on the circle's origin.

Returns

Rectangle
#
intersectsCircle(other: Circle, offset: PointPrimitive): boolean

Determines whether this circle overlaps another circle. Circles that touch at exactly one point are considered intersecting.

Parameters

Returns

boolean
#
toString(): string

Returns a string representation of this circle.

Returns

string
ESC