Type of the custom data property (optional, inferred automatically).
Circle Constructor
Type of the custom data property (optional, inferred automatically).
Circle properties
OptionaldataCustom data.
Radius of the circle.
X center of the circle.
Y center of the circle.
Determine which quadrant this circle belongs to.
Quadtree node to be checked
Array containing indexes of intersecting subnodes (0-3 = top-right, top-left, bottom-left, bottom-right)
StaticintersectBetaCheck if a circle intersects an axis aligned rectangle.
circle center X
circle center Y
circle radius
rectangle start X
rectangle start Y
rectangle end X
rectangle end Y
true if circle intersects rectangle
const circ = { x: 10, y: 20, r: 30 };
const rect = { x: 40, y: 50, width: 60, height: 70 };
const intersect = Circle.intersectRect(
circ.x,
circ.y,
circ.r,
rect.x,
rect.y,
rect.x + rect.width,
rect.y + rect.height,
);
console.log(circle, rect, 'intersect?', intersect);
Class representing a Circle.
Example: Without custom data
Example: With custom data
Example: With custom data (TS)
Example: With custom class extending Circle
Example: With custom class and mapping
Example: With custom object (implements CircleGeometry)
Example: With custom object and mapping