Table Of Contents
Geometry utilities¶
This module contains some helper functions for geometric calculations.
- kivy.geometry.circumcircle(a, b, c)[source]¶
Computes the circumcircle of a triangle defined by a, b, c. See: http://en.wikipedia.org/wiki/Circumscribed_circle
- Parameters
- a: iterable containing at least 2 values (for x and y)
The 1st point of the triangle.
- b: iterable containing at least 2 values (for x and y)
The 2nd point of the triangle.
- c: iterable containing at least 2 values (for x and y)
The 3rd point of the triangle.
- Return
- A tuple that defines the circle :
The first element in the returned tuple is the center as (x, y)
The second is the radius (float)
- kivy.geometry.minimum_bounding_circle(points)[source]¶
Returns the minimum bounding circle for a set of points.
For a description of the problem being solved, see the Smallest Circle Problem.
The function uses Applet’s Algorithm, the runtime is
O(h^3, *n)
, where h is the number of points in the convex hull of the set of points. But it runs in linear time in almost all real world cases. See: http://tinyurl.com/6e4n5yb- Parameters
- points: iterable
A list of points (2 tuple with x,y coordinates)
- Return
- A tuple that defines the circle:
The first element in the returned tuple is the center (x, y)
The second the radius (float)