10.1.4.10. Primitive¶
Module to implement base classes for geometric primitives.
-
class
Patro.GeometryEngine.Primitive.
ClosedPrimitiveMixin
[source]¶ Bases:
object
-
closed_point_array
¶ Return the geometry matrix as a Numpy array for a closed primitive.
\[\begin{split}\mathrm{Geometry\ Matrix} = \begin{bmatrix} x_0 & x_1 & \ldots & x_{n-1} & x_0 \\ y_0 & y_1 & \ldots & y_{n-1} & y_0 \end{bmatrix}\end{split}\]
-
closed_points
¶
-
is_closed
¶ True if the primitive is a closed path.
-
-
class
Patro.GeometryEngine.Primitive.
PointPrimitive
[source]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive
Base class for geometric primitive which are only defined by a list of points, like segment, polygon and Bézier curve.
Conversely an ellipse is defined by a centre, a scale-rotation matrix (a radius vector and a rotation angle) and an angular domain. Path is also another type of primitive which is a composition of basic primitives.
-
__hash__
= None¶
-
apply_transformation
(transformation)[source]¶ Apply a transformation to the primitive.
If clone is set then the primitive is cloned.
-
bounding_box
¶ Bounding box of the primitive.
Return None if primitive is infinite.
-
is_reversible
¶ True if the order of the points is reversible
-
number_of_points
¶ Number of points which define the primitive.
-
point_array
¶ Return the geometry matrix as a Numpy array.
\[\begin{split}\mathrm{Geometry\ Matrix} = \begin{bmatrix} x_0 & x_1 & \ldots & x_{n-1} \\ y_0 & y_1 & \ldots & y_{n-1} \end{bmatrix}\end{split}\]
-
points
¶ Usually return an iterator on the points.
-
-
class
Patro.GeometryEngine.Primitive.
Primitive
[source]¶ Bases:
object
Base class for geometric primitive
-
__vector_cls__
= None¶
-
bounding_box
¶ Bounding box of the primitive.
Return None if primitive is infinite.
-
dimension
¶ Dimension in [2, 3] for 2D / 3D primitive
-
is_closed
¶ True if the primitive is a closed path.
Note: an infinite primitive cannot be closed.
-
is_composed
¶ True if the primitive is a composition of simpler primitives, e.g. a path.
-
is_infinite
¶ True if the primitive has infinite extend like a line.
Note: a closed primitive cannot be infinite.
-
-
class
Patro.GeometryEngine.Primitive.
Primitive1P
(p0)[source]¶ Bases:
Patro.GeometryEngine.Primitive.PointPrimitive
,Patro.GeometryEngine.Primitive.Primitive1PMixin
Base class to construct 2, 3, … points primitives.
-
number_of_points
¶ Number of points which define the primitive.
-
points
¶ Usually return an iterator on the points.
-
reversed_points
¶
-
-
class
Patro.GeometryEngine.Primitive.
Primitive2DMixin
[source]¶ Bases:
object
Mixin for 2D primitive
-
__vector_cls__
¶ alias of
Patro.GeometryEngine.Vector.Vector2D
-
dimension
¶
-
-
class
Patro.GeometryEngine.Primitive.
Primitive2P
(p0, p1)[source]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive1P
,Patro.GeometryEngine.Primitive.ReversiblePrimitiveMixin
Base class for 2-points primitives.
-
end_point
¶
-
number_of_points
¶ Number of points which define the primitive.
-
p1
¶
-
points
¶ Usually return an iterator on the points.
-
reversed_points
¶
-
start_point
¶
-
-
class
Patro.GeometryEngine.Primitive.
Primitive3P
(p0, p1, p2)[source]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive2P
Base class for 3-points primitives.
-
end_point
¶
-
number_of_points
¶ Number of points which define the primitive.
-
p2
¶
-
points
¶ Usually return an iterator on the points.
-
reversed_points
¶
-
-
class
Patro.GeometryEngine.Primitive.
Primitive4P
(p0, p1, p2, p3)[source]¶ Bases:
Patro.GeometryEngine.Primitive.Primitive3P
Base class for 4-points primitives.
-
end_point
¶
-
number_of_points
¶ Number of points which define the primitive.
-
p3
¶
-
points
¶ Usually return an iterator on the points.
-
reversed_points
¶
-
-
class
Patro.GeometryEngine.Primitive.
PrimitiveNP
(*points)[source]¶ Bases:
Patro.GeometryEngine.Primitive.PointPrimitive
,Patro.GeometryEngine.Primitive.ReversiblePrimitiveMixin
Base class for N-points primitives.
-
end_point
¶
-
number_of_points
¶ Number of points which define the primitive.
-
points
¶ Usually return an iterator on the points.
-
reversed_points
¶
-
start_point
¶
-