|
| __init__ (self, Optional[Union[numpy.ndarray, List]] points=None) |
|
| __eq__ (self, other) |
|
| __repr__ (self) |
|
bool | isValid (self) |
|
numpy.ndarray | getPoints (self) |
|
Tuple[float, float] | project (self, normal) |
|
"Polygon" | translate (self, float x=0, float y=0) |
|
"Polygon" | mirror (self, List[float] point_on_axis, List[float] axis_direction) |
|
"Polygon" | scale (self, float factor, Optional[List[float]] origin=None) |
|
"Polygon" | intersectionConvexHulls (self, "Polygon" other) |
|
"Polygon" | intersection (self, "Polygon" other) |
|
"Polygon" | unionConvexHulls (self, "Polygon" other) |
|
Optional[Tuple[float, float]] | intersectsPolygon (self, "Polygon" other) |
|
"Polygon" | getConvexHull (self) |
|
"Polygon" | getMinkowskiSum (self, "Polygon" other) |
|
"Polygon" | getMinkowskiHull (self, "Polygon" other) |
|
bool | isInside (self, point) |
|
|
int | CLIPPER_PRECISION = 1000 |
|
|
float | _isRightTurn (self, numpy.ndarray p, numpy.ndarray q, numpy.ndarray r) |
|
numpy.ndarray | _clipperPoints (self) |
|
A class representing an immutable arbitrary 2-dimensional polygon.
◆ __repr__()
UM.Math.Polygon.Polygon.__repr__ |
( |
| self | ) |
|
Gives a debugging representation of the polygon.
This lists the polygon's coordinates, like so::
[[0,0], [1,3], [3,0]]
:return: A representation of the polygon that is useful for debugging.
◆ _clipperPoints()
numpy.ndarray UM.Math.Polygon.Polygon._clipperPoints |
( |
| self | ) |
|
|
protected |
Converts the vertices to a representation useful for PyClipper.
This is necessary because Clipper uses integer-coordinates, but the coordinates in the rest of the front-end are
one millimeter per unit. Without this conversion, vertices would be rounded to millimeters. With this conversion
the units represent micrometers, allowing much greater precision.
:return: A vertex representation useful for Clipper.
◆ _fromClipperPoints()
"Polygon" UM.Math.Polygon.Polygon._fromClipperPoints |
( |
numpy.ndarray | points | ) |
|
|
staticprotected |
Converts the clipper point representation into a normal polygon.
:param points: The clipper
:return:
◆ approximatedCircle()
UM.Math.Polygon.Polygon.approximatedCircle |
( |
| radius, |
|
|
| num_segments = 8 ) |
|
static |
Return vertices from an approximate circle.
An octagon is returned, which comes close enough to a circle.
:param radius: The radius of the circle.
:return: A polygon that approximates a circle.
◆ getConvexHull()
"Polygon" UM.Math.Polygon.Polygon.getConvexHull |
( |
| self | ) |
|
Calculate the convex hull around the set of points of this polygon.
:return: The convex hull around the points of this polygon.
◆ getMinkowskiHull()
"Polygon" UM.Math.Polygon.Polygon.getMinkowskiHull |
( |
| self, |
|
|
"Polygon" | other ) |
Create a Minkowski hull from this polygon and another polygon.
The Minkowski hull is the convex hull around the Minkowski sum of this
polygon with other.
:param other: :type{Polygon} The Polygon to do a Minkowski addition with.
:return: The convex hull around the Minkowski sum of this Polygon with other
◆ getMinkowskiSum()
"Polygon" UM.Math.Polygon.Polygon.getMinkowskiSum |
( |
| self, |
|
|
"Polygon" | other ) |
Perform a Minkowski sum of this polygon with another polygon.
:param other: The polygon to perform a Minkowski sum with.
:return: :type{Polygon} The Minkowski sum of this polygon with other.
◆ intersection()
"Polygon" UM.Math.Polygon.Polygon.intersection |
( |
| self, |
|
|
"Polygon" | other ) |
Computes the intersection of this and another polygon.
:param other: The other polygon to intersect with.
:return: The intersection of the two polygons.
◆ intersectionConvexHulls()
"Polygon" UM.Math.Polygon.Polygon.intersectionConvexHulls |
( |
| self, |
|
|
"Polygon" | other ) |
Computes the intersection of the convex hulls of this and another
polygon.
:param other: The other polygon to intersect convex hulls with.
:return: The intersection of the two polygons' convex hulls.
◆ intersectsPolygon()
Optional[Tuple[float, float]] UM.Math.Polygon.Polygon.intersectsPolygon |
( |
| self, |
|
|
"Polygon" | other ) |
Check to see whether this polygon intersects with another polygon.
:param other: :type{Polygon} The polygon to check for intersection.
:return: A tuple of the x and y distance of intersection, or None if no intersection occurred.
◆ isInside()
bool UM.Math.Polygon.Polygon.isInside |
( |
| self, |
|
|
| point ) |
Whether the specified point is inside this polygon.
If the point is exactly on the border or on a vector, it does not count
as being inside the polygon.
:param point: The point to check of whether it is inside.
:return: True if it is inside, or False otherwise.
◆ mirror()
"Polygon" UM.Math.Polygon.Polygon.mirror |
( |
| self, |
|
|
List[float] | point_on_axis, |
|
|
List[float] | axis_direction ) |
Mirrors this polygon across the specified axis.
:param point_on_axis: A point on the axis to mirror across.
:param axis_direction: The direction vector of the axis to mirror across.
◆ project()
Tuple[float, float] UM.Math.Polygon.Polygon.project |
( |
| self, |
|
|
| normal ) |
Project this polygon on a line described by a normal.
:param normal: The normal to project on.
:return: A tuple describing the line segment of this Polygon projected on to the infinite line described by normal.
The first element is the minimum value, the second the maximum.
◆ scale()
"Polygon" UM.Math.Polygon.Polygon.scale |
( |
| self, |
|
|
float | factor, |
|
|
Optional[List[float]] | origin = None ) |
Scales this polygon around a certain origin point.
:param factor: The scaling factor.
:param origin: Origin point around which to scale, 2D. As the scale
factor approaches 0, all coordinates will approach this origin point. As
the scale factor grows, all coordinates will move away from this origin
point. If `None`, the 0,0 coordinate will be used.
:return: A transformed polygon.
◆ translate()
"Polygon" UM.Math.Polygon.Polygon.translate |
( |
| self, |
|
|
float | x = 0, |
|
|
float | y = 0 ) |
Moves the polygon by a fixed offset.
:param x: The distance to move along the X-axis.
:param y: The distance to move along the Y-axis.
The documentation for this class was generated from the following file: