compas_nest.offset¶
compas_nest.offset
¶
Clipper2-based polygon offsetting, used to add clearance before nesting.
Convention (orientation-normalised, so it does not depend on input winding):
distance > 0 grows a ring outward, distance < 0 shrinks it inward.
The directional helpers add a uniform clearance d so the real parts end up with gaps:
- :func:
offset_geo— element outer+d(grow), element holes-d(shrink) - :func:
offset_sheets— sheet outer-d(shrink), sheet holes+d(grow)
offset_polyline(polyline, distance)
¶
Offset a single closed polyline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polyline
|
:class:`compas.geometry.Polyline`
|
Closed ring (a trailing duplicate point is tolerated). |
required |
distance
|
float
|
Positive grows the ring outward, negative shrinks it inward. |
required |
Returns:
| Type | Description |
|---|---|
class:`compas.geometry.Polyline` or None
|
The offset ring (the largest one if the offset splits it), or |
Source code in compas_nest/offset.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
offset_geo(geo, distance)
¶
Return a copy of geo with each part outer grown and holes shrunk by distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geo
|
:class:`compas_nest.nest_geo`
|
|
required |
distance
|
float
|
Clearance to add around the parts. |
required |
Returns:
| Type | Description |
|---|---|
class:`compas_nest.nest_geo`
|
|
Source code in compas_nest/offset.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
offset_sheets(sheets, distance)
¶
Return a copy of sheets with each sheet outer shrunk and holes grown by distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheets
|
:class:`compas_nest.nest_sheets`
|
|
required |
distance
|
float
|
Clearance to keep from sheet edges and holes. |
required |
Returns:
| Type | Description |
|---|---|
class:`compas_nest.nest_sheets`
|
|
Source code in compas_nest/offset.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |