Clipping

Clipping module: ezdxf.math.clipping

ezdxf.math.clipping.greiner_hormann_union(p1: Iterable[Union[Sequence[float], Vec2, Vec3]], p2: Iterable[Union[Sequence[float], Vec2, Vec3]]) list[list[ezdxf.math._vector.Vec2]]

Returns the UNION of polygon p1 | polygon p2. This algorithm works only for polygons with real intersection points and line end points on face edges are not considered as such intersection points!

ezdxf.math.clipping.greiner_hormann_difference(p1: Iterable[Union[Sequence[float], Vec2, Vec3]], p2: Iterable[Union[Sequence[float], Vec2, Vec3]]) list[list[ezdxf.math._vector.Vec2]]

Returns the DIFFERENCE of polygon p1 - polygon p2. This algorithm works only for polygons with real intersection points and line end points on face edges are not considered as such intersection points!

ezdxf.math.clipping.greiner_hormann_intersection(p1: Iterable[Union[Sequence[float], Vec2, Vec3]], p2: Iterable[Union[Sequence[float], Vec2, Vec3]]) list[list[ezdxf.math._vector.Vec2]]

Returns the INTERSECTION of polygon p1 & polygon p2. This algorithm works only for polygons with real intersection points and line end points on face edges are not considered as such intersection points!

class ezdxf.math.clipping.ClippingPolygon2d(vertices: Iterable[Vec2], ccw_check=True)

The clipping path is an arbitrary polygon.

clip_polygon(polygon: Iterable[Vec2]) Sequence[Vec2]

Returns the clipped polygon.

clip_polyline(polyline: Iterable[Vec2]) Sequence[Sequence[Vec2]]

Returns the parts of the clipped polyline.

clip_line(start: Vec2, end: Vec2) Sequence[Vec2]

Returns the clipped line.

is_inside(point: Vec2) bool

Returns True if point is inside the clipping polygon.

class ezdxf.math.clipping.ClippingRect2d(bottom_left: Vec2, top_right: Vec2)

The clipping path is a rectangle parallel to the x- and y-axis.

This class will get an optimized implementation in the future.

clip_polygon(polygon: Iterable[Vec2]) Sequence[Vec2]

Returns the clipped polygon.

clip_polyline(polyline: Iterable[Vec2]) Sequence[Sequence[Vec2]]

Returns the parts of the clipped polyline.

clip_line(start: Vec2, end: Vec2) Sequence[Vec2]

Returns the clipped line.

is_inside(point: Vec2) bool

Returns True if point is inside the clipping rectangle.