Esempio n. 1
0
def _boundaries_to_polygons(boundaries, ocs, elevation):
    paths = (from_hatch_boundary_path(boundary, ocs, elevation)
             for boundary in boundaries)
    for polygon in fast_bbox_detection(paths):
        exterior = polygon[0]
        # only take exterior path of level 1 holes, nested holes are ignored
        yield exterior, [hole[0] for hole in polygon[1:]]
Esempio n. 2
0
def closed_loops(
    paths: List[AbstractBoundaryPath],
    ocs: OCS,
    elevation: float,
    offset: Vec3 = NULLVEC,
) -> List[Path]:
    loops = []
    for boundary in paths:
        path = from_hatch_boundary_path(boundary, ocs, elevation, offset)
        assert isinstance(
            path.user_data,
            const.BoundaryPathState), "missing attached boundary path state"
        for sub_path in path.sub_paths():
            sub_path.close()
            loops.append(sub_path)
    return loops
Esempio n. 3
0
 def to_path(p):
     path = from_hatch_boundary_path(p, ocs, elevation)
     path.close()
     return path
Esempio n. 4
0
 def boundary_to_vertices(boundary) -> List[Vec3]:
     path = from_hatch_boundary_path(boundary, ocs, elevation)
     return path_to_vertices(path)