sdf.primitives.LoftedPolygon
sdf.primitives.LoftedPolygon(vertices_a, vertices_b, height, material=None)
Solid lofted between two polygon profiles along the local Z axis.
Profile A lies at z = -height/2, profile B at z = +height/2; each slice in between is the per-vertex linear interpolation of the two vertex loops. Use Translate/Rotate — or the construction-layer :func:cadjoint.construction.loft — for placement.
Vertex parameter references are preserved for both profiles, so sketch constraints and gradients keep acting on the generated solid.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| vertices_a | list[Vector2] | Ordered profile-A vertices — Vector2 parameters (or raw (2,) arrays). | required |
| vertices_b | list[Vector2] | Ordered profile-B vertices; must match vertices_a in count, with vertex i connecting to vertex i. |
required |
| height | float | Scalar | Total loft height (Scalar parameter or float). | required |
| material | Optional render material. | None |
Methods
| Name | Description |
|---|---|
| patch_fields | Wall planes plus the two caps — but only when every wall is flat. |
| sdf | Pure SDF: per-slice exact polygon distance to the lerped profile. |
patch_fields
sdf.primitives.LoftedPolygon.patch_fields()
Wall planes plus the two caps — but only when every wall is flat.
Order matches :class:~cadjoint.sdf.primitives.polygon.ExtrudedPolygon: patch k (for k < N) is the wall between profile edge (v_k, v_{k+1}) and its partner (w_k, w_{k+1}); patch N is the bottom cap (z = -height/2), patch N+1 the top.
A loft wall is in general a ruled surface — the straight line joining the two edges sweeps as it goes, and sweeps out of plane the moment the two edges are not parallel — and a ruled surface is none of the plane, cylinder, sphere or cone a consumer can certify. It is a plane exactly when the wall’s four corners are coplanar, which is the common case in practice because it covers every truncated pyramid: two scaled copies of one profile, which is what a flared port or a draughted pad is. So :func:_planar_walls measures every wall, and the node declares all-or-nothing: one ruled wall and the whole node returns None, because a partial decomposition would silently hide that wall’s surface rather than fall back to one opaque patch.
What is declared for a flat wall is the plane through its four corners, outward-oriented and unit-gradient. That is the analytic continuation of what :meth:sdf computes there rather than a copy of it: the sdf measures within the horizontal slice, which is the same zero set scaled by 1/|n_xy| — a wall tilted 60° off vertical would read twice the true distance and win ownership it should lose. Two further differences, both outside the surface and so both harmless: the sdf clamps its interpolation parameter past the caps, where this plane simply keeps going; and the sdf is a bound rather than an exact distance away from the wall, while a plane’s field is exact everywhere.
Returns
| Name | Type | Description |
|---|---|---|
N + 2 fields, or None when any wall is ruled. |
sdf
sdf.primitives.LoftedPolygon.sdf(p, height, **vertices)
Pure SDF: per-slice exact polygon distance to the lerped profile.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| p | Array | Query point(s), shape (…, 3). Profile plane is local XY. | required |
| height | Array | Total loft height; the solid spans ±height/2 in Z. |
required |
| **vertices | Array | v0..v{N-1} profile-A and w0..w{N-1} profile-B vertices, each shape (2,). | {} |
Returns
| Name | Type | Description |
|---|---|---|
| Array | Signed distance bound, shape (…). Sign-correct while every | |
| Array | interpolated slice polygon is simple. |