Operations API
Boolean operations, modifiers, and repetition methods.
Boolean Operations
union
methodCombines two shapes.
sdf.union(other: Sdf) -> Sdfsphere(0.5).union(cube(0.4))subtract
methodSubtracts one shape from another.
sdf.subtract(other: Sdf) -> Sdfsphere(0.5).subtract(cube(0.4))intersect
methodKeeps only the overlapping region of two shapes.
sdf.intersect(other: Sdf) -> Sdfsphere(0.5).intersect(cube(0.4))smooth_union
methodCombines two shapes with a smooth blend.
sdf.smooth_union(other: Sdf, k: f64) -> Sdfsphere(0.5).smooth_union(cube(0.4), 0.1)smooth_subtract
methodSubtracts one shape from another with smooth edges.
sdf.smooth_subtract(other: Sdf, k: f64) -> Sdfsphere(0.5).smooth_subtract(cube(0.4), 0.05)smooth_intersect
methodIntersects two shapes with smooth edges.
sdf.smooth_intersect(other: Sdf, k: f64) -> Sdfsphere(0.5).smooth_intersect(cube(0.4), 0.05)xor
methodKeeps non-overlapping regions from two shapes.
sdf.xor(other: Sdf) -> Sdfsphere(0.5).xor(cube(0.4))Modifiers And Repetition
shell
methodKeeps only a shell around the surface.
sdf.shell(thickness: f64) -> Sdfsphere(0.5).shell(0.05)hollow
aliasAlias for shell.
sdf.hollow(thickness: f64) -> Sdfsphere(0.5).hollow(0.05)Alias for shell.
round
methodRounds the surface outward by a radius.
sdf.round(radius: f64) -> Sdfcube(0.5).round(0.05)onion
methodCreates repeated shell layers.
sdf.onion(thickness: f64) -> Sdfsphere(0.5).onion(0.05)elongate
methodStretches the shape along each axis.
sdf.elongate(x: f64, y: f64, z: f64) -> Sdfsphere(0.3).elongate(0.2, 0.0, 0.0)twist
methodTwists the shape around the Y axis.
sdf.twist(amount: f64) -> Sdfbox3(0.5, 1.0, 0.1).twist(2.0)bend
methodBends the shape along the X axis.
sdf.bend(amount: f64) -> Sdfbox3(1.0, 0.2, 0.2).bend(0.5)displace
methodAdds noise-based displacement to the surface.
sdf.displace(amount: f64, frequency: f64) -> Sdfsphere(0.5).displace(0.05, 10.0)repeat
methodRepeats the shape infinitely in a grid.
sdf.repeat(sx: f64, sy: f64, sz: f64) -> Sdfsphere(0.2).repeat(1.0, 1.0, 1.0)repeat_limited
methodRepeats the shape in a bounded grid.
sdf.repeat_limited(sx: f64, sy: f64, sz: f64, cx: f64, cy: f64, cz: f64) -> Sdfsphere(0.2).repeat_limited(0.5, 0.5, 0.5, 3.0, 3.0, 3.0)repeat_polar
methodRepeats the shape radially around the Y axis.
sdf.repeat_polar(count: i64) -> Sdfsphere(0.2).translate_x(0.5).repeat_polar(6)