Options
All
• Public
• Public/Protected
• All

Class Circle

Circle class provides static functions to create and operate on circles. A circle is usually represented as a Group of 2 Pts, where the first Pt specifies the center, and the second Pt specifies the radius. You can use the static function as-is, or apply the `op` method in Group or Pt to many of these functions. See Op guide for details.

• Circle

Methods

Static fromCenter

• Create a circle based on a center point and a radius

Parameters

• pt: PtLike

center point of circle

Static fromRect

• Create a circle that either fits within or encloses a rectangle

Parameters

• pts: GroupLike

a Group of 2 Pts representing a rectangle

• Default value enclose: boolean = false

if `true`, the circle will enclose the rectangle. Default is `false`, which will fit the circle inside the rectangle.

Static intersectCircle2D

• Get the intersection points between two circles

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

• circle: GroupLike

a Group of 2 Pts representing a circle

Returns Group

a Group of intersection points, or an empty Group if no intersection is found

Static intersectLine2D

• Get the intersection points between a circle and a line segment

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

Returns Group

a Group of intersection points, or an empty Group if no intersection is found

Static intersectRay2D

• Get the intersection points between a circle and a ray (infinite line)

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

• ray: GroupLike

a Group of 2 Pts representing a ray

Returns Group

a Group of intersection points, or an empty Group if no intersection is found

Static intersectRect2D

• Quick way to check rectangle intersection with a circle. For more optimized implementation, store the rectangle's sides separately (eg, `Rectangle.sides()`) and use `Polygon.intersectPolygon2D()`.

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

• rect: GroupLike

a Group of 2 Pts representing a rectangle

Returns Group

a Group of intersection points, or an empty Group if no intersection is found

Static toInnerRect

• Convert this cirlce to a rectangle that fits within this circle

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

Static toInnerTriangle

• Convert this cirlce to a triangle that fits within this circle

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

Static toRect

• Convert this cirlce to a rectangle that encloses this circle

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

Static withinBound

• Check if a point is within a circle

Parameters

• pts: GroupLike

a Group of 2 Pts representing a circle

• pt: PtLike

the point to checks

• Default value threshold: number = 0

an optional small number to set threshold. Default is 0.

Returns boolean

Generated using TypeDoc