Circle

class kurbopy.Circle(center, radius)

A circle.

area()

Compute the signed area under the curve.

For a closed path, the signed area of the path is the sum of signed areas of the segments. This is a variant of the “shoelace formula.” See: <https://github.com/Pomax/bezierinfo/issues/44> and <http://ich.deanmcnamee.com/graphics/2016/03/30/CurveArea.html>

This can be computed exactly for Béziers thanks to Green’s theorem, and also for simple curves such as circular arcs. For more exotic curves, it’s probably best to subdivide to cubics. We leave that to the caller, which is why we don’t give an accuracy param here.

bounding_box()

The smallest rectangle that encloses the shape.

center
contains(pt)

Returns true if the [Point] is inside this shape.

This is only meaningful for closed shapes.

is_finite()

Is this value finite?

is_nan()

Is this value NaN?

perimeter(accuracy)

Total length of perimeter.

radius
segment(inner_radius, start_angle, sweep_angle)

Create a [CircleSegment] by cutting out parts of this circle.

to_path(tolerance)

Convert to a Bézier path.

winding(pt)

The winding number of a point.

This method only produces meaningful results with closed shapes.

The sign of the winding number is consistent with that of area, meaning it is +1 when the point is inside a positive area shape and -1 when it is inside a negative area shape. Of course, greater magnitude values are also possible when the shape is more complex.

CircleSegment

class kurbopy.CircleSegment(center, outer_radius, inner_radius, start_angle, sweep_angle)

A segment of a circle.

If inner_radius > 0, then the shape will be a doughnut segment.

area()

Compute the signed area under the curve.

For a closed path, the signed area of the path is the sum of signed areas of the segments. This is a variant of the “shoelace formula.” See: <https://github.com/Pomax/bezierinfo/issues/44> and <http://ich.deanmcnamee.com/graphics/2016/03/30/CurveArea.html>

This can be computed exactly for Béziers thanks to Green’s theorem, and also for simple curves such as circular arcs. For more exotic curves, it’s probably best to subdivide to cubics. We leave that to the caller, which is why we don’t give an accuracy param here.

bounding_box()

The smallest rectangle that encloses the shape.

center
contains(pt)

Returns true if the [Point] is inside this shape.

This is only meaningful for closed shapes.

inner_radius
is_finite()

Is this value finite?

is_nan()

Is this value NaN?

outer_radius
perimeter(accuracy)

Total length of perimeter.

start_angle
sweep_angle
to_path(tolerance)

Convert to a Bézier path.

winding(pt)

The winding number of a point.

This method only produces meaningful results with closed shapes.

The sign of the winding number is consistent with that of area, meaning it is +1 when the point is inside a positive area shape and -1 when it is inside a negative area shape. Of course, greater magnitude values are also possible when the shape is more complex.