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 functions as-is, or apply the Group.op
or Pt.op
to enable functional programming.
See Op guide for details.
Create a circle based on a center point and a radius.
center point of circle
radius of circle
a Group that represents a circle
Create a circle that either fits within, or encloses, a rectangle.
a Group or an Iterable
if true
, the circle will enclose the rectangle. Default is false
, which will fit the circle inside the rectangle.
a Group that represents a circle
Create a circle that either fits within, or encloses, a triangle. Same as Triangle.circumcircle
or Triangle.incircle
.
a Group or an Iterable
if true
, the circle will enclose the triangle. Default is false
, which will fit the circle inside the triangle.
a Group that represents a circle
Get the intersection points between two circles.
a Group or an Iterable
a Group or an Iterable
a Group of intersection points, or an empty Group if no intersection is found
Get the intersection points between a circle and a line segment.
a Group or an Iterable
a Group or an Iterable
a Group of intersection points, or an empty Group if no intersection is found
Get the intersection points between a circle and a ray (infinite line).
a Group or an Iterable
a Group or an Iterable
a Group of intersection points, or an empty Group if no intersection is found
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()
.
a Group or an Iterable
a Group or an Iterable
a Group of intersection points, or an empty Group if no intersection is found
Get a rectangle that either fits within or encloses this circle. See also Rectangle.toCircle
a Group or an Iterable
if true
, the rectangle will be within the circle. If false
, the rectangle will enclose the circle.
a Group representing a rectangle
Get a triangle that fits within this circle.
a Group or an Iterable
if true
, the triangle will be within the circle. If false
, the triangle will enclose the circle.
Check if a point is within a circle.
a Group or an Iterable
the point to checks
an optional small number to set threshold. Default is 0.