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]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive2DMixin
,Patro.GeometryEngine.Mixin.CenterMixin
,Patro.GeometryEngine.Mixin.AngularDomainMixin
,Patro.GeometryEngine.Primitive.Primitive
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.
-
area
¶
-
bounding_box
¶ Bounding box of the primitive.
Return None if primitive is infinite.
-
diameter
¶
-
eccentricity
¶
-
classmethod
from_two_points
(center, point)[source]¶ Construct a circle from a center point and passing by another point
-
perimeter
¶
-
radius
¶
-
-
class
Patro.GeometryEngine.Conic.
Ellipse2D
(center, radius_x, radius_y, angle=0, domain=None)[source]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive2DMixin
,Patro.GeometryEngine.Mixin.CenterMixin
,Patro.GeometryEngine.Mixin.AngularDomainMixin
,Patro.GeometryEngine.Primitive.Primitive
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.
-
_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.pdfThe 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)>¶
-
angle
¶
-
bounding_box
¶ Bounding box of the primitive.
Return None if primitive is infinite.
-
eccentricity
¶
-
intersect_conic
(conic)[source]¶ Reference
- Intersection of Ellipses
- David Eberly, Geometric Tools, Redmond WA 98052
- June 23, 2015
- https://www.geometrictools.com/
- https://www.geometrictools.com/Documentation/IntersectionOfEllipses.pdf
-
major_vector
¶
-
minor_vector
¶
-
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
-
-
exception
Patro.GeometryEngine.Conic.
PointNotOnCircleError
[source]¶ Bases:
ValueError