A class representing an immutable arbitrary 2-dimensional polygon.
More...
|
def | __init__ (self, points=None) |
|
def | __eq__ (self, other) |
|
def | __repr__ (self) |
| Gives a debugging representation of the polygon. More...
|
|
def | isValid (self) |
|
def | getPoints (self) |
|
def | project (self, normal) |
| Project this polygon on a line described by a normal. More...
|
|
def | translate (self, x=0, y=0) |
| Moves the polygon by a fixed offset. More...
|
|
def | mirror (self, point_on_axis, axis_direction) |
| Mirrors this polygon across the specified axis. More...
|
|
def | intersectionConvexHulls |
| Computes the intersection of the convex hulls of this and another polygon. More...
|
|
def | intersectsPolygon |
| Check to see whether this polygon intersects with another polygon. More...
|
|
def | getConvexHull (self) |
| Calculate the convex hull around the set of points of this polygon. More...
|
|
def | getMinkowskiSum |
| Perform a Minkowski sum of this polygon with another polygon. More...
|
|
def | getMinkowskiHull |
| Create a Minkowski hull from this polygon and another polygon. More...
|
|
def | isInside (self, point) |
| Whether the specified point is inside this polygon. More...
|
|
A class representing an immutable arbitrary 2-dimensional polygon.
◆ __repr__()
def 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]]
- Returns
- A representation of the polygon that is useful for debugging.
◆ approximatedCircle()
def UM.Math.Polygon.Polygon.approximatedCircle |
( |
|
radius | ) |
|
|
static |
Return vertices from an approximate circle.
An octagon is returned, which comes close enough to a circle.
- Parameters
-
radius | The radius of the circle. |
- Returns
- A polygon that approximates a circle.
◆ getConvexHull()
def UM.Math.Polygon.Polygon.getConvexHull |
( |
|
self, |
|
|
|
Polygon |
|
) |
| |
Calculate the convex hull around the set of points of this polygon.
- Returns
- The convex hull around the points of this polygon.
◆ getMinkowskiHull()
def UM.Math.Polygon.Polygon.getMinkowskiHull |
( |
|
self, |
|
|
|
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.
- Parameters
-
- Returns
- The convex hull around the Minkowski sum of this Polygon with other
◆ getMinkowskiSum()
def UM.Math.Polygon.Polygon.getMinkowskiSum |
( |
|
self, |
|
|
|
other |
|
) |
| |
Perform a Minkowski sum of this polygon with another polygon.
- Parameters
-
other | The polygon to perform a Minkowski sum with. |
- Returns
- Polygon The Minkowski sum of this polygon with other.
◆ intersectionConvexHulls()
def UM.Math.Polygon.Polygon.intersectionConvexHulls |
( |
|
self, |
|
|
|
other |
|
) |
| |
Computes the intersection of the convex hulls of this and another polygon.
- Parameters
-
other | The other polygon to intersect convex hulls with. |
- Returns
- The intersection of the two polygons' convex hulls.
◆ intersectsPolygon()
def UM.Math.Polygon.Polygon.intersectsPolygon |
( |
|
self, |
|
|
|
other |
|
) |
| |
Check to see whether this polygon intersects with another polygon.
- Parameters
-
other | Polygon The polygon to check for intersection. |
- Returns
- A tuple of the x and y distance of intersection, or None if no intersection occured.
◆ isInside()
def UM.Math.Polygon.Polygon.isInside |
( |
|
self, |
|
|
|
point, |
|
|
|
bool |
|
) |
| |
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.
- Parameters
-
point | The point to check of whether it is inside. |
- Returns
- True if it is inside, or False otherwise.
◆ mirror()
def UM.Math.Polygon.Polygon.mirror |
( |
|
self, |
|
|
|
point_on_axis, |
|
|
|
axis_direction, |
|
|
|
Polygon |
|
) |
| |
Mirrors this polygon across the specified axis.
- Parameters
-
point_on_axis | A point on the axis to mirror across. |
axis_direction | The direction vector of the axis to mirror across. |
◆ project()
def UM.Math.Polygon.Polygon.project |
( |
|
self, |
|
|
|
normal, |
|
|
|
Tuple, |
|
|
|
float, |
|
|
|
float |
|
) |
| |
Project this polygon on a line described by a normal.
- Parameters
-
normal | The normal to project on. |
- Returns
- 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.
◆ translate()
def UM.Math.Polygon.Polygon.translate |
( |
|
self, |
|
|
|
x = 0 , |
|
|
|
y = 0 , |
|
|
|
Polygon |
|
) |
| |
Moves the polygon by a fixed offset.
- Parameters
-
x | The distance to move along the X-axis. |
y | The distance to move along the Y-axis. |
The documentation for this class was generated from the following file: