# 10.1.4.3. Conic¶

Module to implement conic geometry like circle and ellipse.

For resources on conic see this section.

class Patro.GeometryEngine.Conic.Circle2D(center, radius, domain=None, diameter=False, start_angle=None, distance=None)[source]

Class to implements 2D Circle.

Construct a 2D circle from a center point and a radius.

If the circle is not closed, domain is a an AngularDomain instance in degrees. If start_angle and *distance is given then the stop angle is computed from them.

__init__(center, radius, domain=None, diameter=False, start_angle=None, distance=None)[source]

Construct a 2D circle from a center point and a radius.

If the circle is not closed, domain is a an AngularDomain instance in degrees. If start_angle and *distance is given then the stop angle is computed from them.

__repr__()[source]

Return repr(self).

_circle_distance_to_point(point)[source]
angle_for_point(point)[source]
apply_transformation(transformation)[source]
area
bezier_approximation()[source]
bounding_box

Bounding box of the primitive.

Return None if primitive is infinite.

clone()[source]

Clone a primitive instance.

diameter
distance_to_point(point)[source]
eccentricity
classmethod from_triangle_circumcenter(triangle)[source]

Construct a circle passing by three point

classmethod from_triangle_in_circle(triangle)[source]

Construct the in circle of a triangle

classmethod from_two_points(center, point)[source]

Construct a circle from a center point and passing by another point

intersect_circle(circle)[source]
intersect_segment(segment)[source]

Compute the intersection of a circle and a segment.

is_point_inside(point)[source]
perimeter
point_at_angle(angle)[source]
point_at_distance(distance)[source]
point_in_circle_frame(point)[source]
radius
signed_distance_to_point(point)[source]
tangent_at_angle(angle)[source]
class Patro.GeometryEngine.Conic.Ellipse2D(center, radius_x, radius_y, angle=0, domain=None)[source]

Class to implements 2D Ellipse.

__init__(center, radius_x, radius_y, angle=0, domain=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__repr__()[source]

Return repr(self).

_bezier_arc(start_angle, stop_angle)[source]
_distance_point_bisection(r0, z0, z1, g)[source]
_eberly_distance(point)[source]

Compute distance to point using the algorithm described in

Distance from a Point to an Ellipse, an Ellipsoid, or a Hyperellipsoid David Eberly, Geometric Tools, Redmond WA 98052 September 28, 2018 https://www.geometrictools.com/Documentation/Documentation.html https://www.geometrictools.com/Documentation/DistancePointEllipseEllipsoid.pdf

The point is expressed in the ellipse coordinate system. The preconditions are e0 ≥ e1 > 0, y0 ≥ 0, and y1 ≥ 0.

_logger = <Logger Patro.GeometryEngine.Conic.Ellipse2D (WARNING)>
static _robust_length(x, y)[source]
angle
apply_transformation(transformation)[source]
bounding_box

Bounding box of the primitive.

Return None if primitive is infinite.

clone()[source]

Clone a primitive instance.

distance_to_point(point, return_point=False, is_inside=False)[source]
eccentricity
intersect_conic(conic)[source]

Reference

intersect_segment(segment)[source]
is_point_inside(point)[source]
major_vector
matrix()[source]
minor_vector
point_at_angle(angle)[source]
point_from_ellipse_frame(point)[source]
point_in_ellipse_frame(point)[source]
radius_x
radius_y
classmethod svg_arc(point1, point2, radius_x, radius_y, angle, large_arc, sweep)[source]

Implement SVG Arc.

Parameters

• point1 is the start point and point2 is the end point.
• radius_x and radius_y are the radii of the ellipse, also known as its semi-major and semi-minor axes.
• angle is the angle from the x-axis of the current coordinate system to the x-axis of the ellipse.
• if the large arc flag is unset then arc spanning less than or equal to 180 degrees is chosen, else an arc spanning greater than 180 degrees is chosen.
• if the sweep flag is unset then the line joining centre to arc sweeps through decreasing angles, else if it sweeps through increasing angles.

References

to_bezier()[source]

Convert an ellipse arc to a set of Quadratic Bézier curves.

exception Patro.GeometryEngine.Conic.PointNotOnCircleError[source]

Bases: ValueError