skspatial.objects.Circle

class skspatial.objects.Circle(point: Union[numpy.ndarray, Sequence], radius: float)[source]

A circle in 2D space.

The circle is defined by a 2D point and a radius.

Parameters
point(2,) array_like

Center of the circle.

radius{int, float}

Radius of the circle/

Raises
ValueError

If the radius is not positive. If the point is not 2D.

Examples

>>> from skspatial.objects import Circle
>>> circle = Circle([2, 5], 3)
>>> circle
Circle(point=Point([2, 5]), radius=3)
>>> circle.dimension
2
>>> circle.area().round(2)
28.27
>>> Circle([0, 0, 0], 1)
Traceback (most recent call last):
...
ValueError: The point must be 2D.
>>> Circle([0, 0], 0)
Traceback (most recent call last):
...
ValueError: The radius must be positive.
Attributes
point(2,) Point

Center of the circle.

radius{int, float}

Radius of the circle.

dimensionint

Dimension of the circle.

Methods

area()

Return the area of the circle.

best_fit(points)

Return the sphere of best fit for a set of 2D points.

circumference()

Return the circumference of the circle.

intersect_line(line)

Intersect the circle with a line.

plot_2d(ax_2d, **kwargs)

Plot the circle in 2D.