Edge Treatment

Warning

This module is currently experimental and has several known issues. While it generally works fine for simple primitive geometry, it struggles to properly identify external edges on geometry commonly emitted by CSG operations.

Geometry geared towards modifying object edges.

>>> from petrify.solid import Box, Vector, Point
>>> from petrify.space import LineSegment
>>> box = Box(Point.origin, Vector(1, 1, 1))
>>> edge = LineSegment(Point(0, 0, 0), Point(0, 1, 0))
>>> chamfered = box - Chamfer(box, [edge], 0.25)
class petrify.edge.Chamfer(solid, edges, amount)[source]

Chamfer geometry formed by creating an inset of amount along the pairs of polygons formed by edges on a solid.

The starting point of each edge must equal the endpoint of the prior edge (and, by induction, the endpoint of each edge must be the start of the next edge).

class petrify.edge.EdgeChamfer(polygons, edge, amount)[source]
petrify.edge.polygon_inset(polygon, edge, inwards)[source]

Finds the inset line given a normal direction, the polygon to inset, and the edge to inset from.

Note: it is critical that edge face in the same direction as it does for the polygon.