sdf.Mirror

sdf.Mirror(sdf, axis='x')

Mirror a shape across a plane by reflecting the query point.

Mirror(shape, 'x') reflects across the x=0 plane (the yz plane): the result is the mirror image of the child, an exact SDF.

The three named axes are the coordinate planes through the world origin, which is the one mirror plane a real part rarely has. Any :class:~cadjoint.construction.faces.Face or :class:~cadjoint.construction.sketch.SketchPlane is accepted instead, so the symmetry plane can be a face of the part or a :meth:~cadjoint.construction.sketch.SketchPlane.midplane between two of them — and being built from the parent’s parameters, it moves when the part is re-dimensioned rather than stranding the mirrored copy.

Parameters

Name Type Description Default
sdf Child shape (SDF node or plain callable). required
axis str The mirror plane. 'x', 'y' or 'z' for the coordinate plane with that normal through the origin, or a Face / SketchPlane to mirror across it. 'x'

Example

seam = SketchPlane.midplane(housing.cap("+"), housing.cap("-"))
both_halves = Union(lug, Mirror(lug, seam))

Methods

Name Description
patch_fields Forward the child’s patch fields through the reflection.
sdf Pure function for the mirror operation.

patch_fields

sdf.Mirror.patch_fields()

Forward the child’s patch fields through the reflection.

A mirror only reflects — sdf(p) = child(M p) — so its surface is the child’s surface reflected, patch for patch: the decomposition is the child’s fields evaluated at the reflected point, in the child’s own order and count. Reflection is an isometry, so distances, patch ownership and feature edges all survive it exactly.

sdf

sdf.Mirror.sdf(child_sdf, p, origin, normal)

Pure function for the mirror operation.