skspatial.objects.Circle.from_points

classmethod Circle.from_points(point_a: Union[ndarray, Sequence], point_b: Union[ndarray, Sequence], point_c: Union[ndarray, Sequence], **kwargs) Circle[source]

Instantiate a circle from three points.

Parameters
point_a, point_b, point_c: array_like

Three points defining the circle. The points must be 2D.

kwargs: dict, optional

Additional keywords passed to Points.are_collinear().

Returns
Circle

Circle containing the three input points.

Raises
ValueError

If the points are not 2D. If the points are collinear.

Examples

>>> from skspatial.objects import Circle
>>> Circle.from_points([-1, 0], [0, 1], [1, 0])
Circle(point=Point([-0.,  0.]), radius=1.0)
>>> Circle.from_points([1, 0, 0], [0, 1], [1, 0])
Traceback (most recent call last):
...
ValueError: The points must be 2D.
>>> Circle.from_points([0, 0], [1, 1], [2, 2])
Traceback (most recent call last):
...
ValueError: The points must not be collinear.