Transforms API
Positioning, rotation, scale, symmetry, and math helpers.
Transforms
translate
methodMoves the shape by an offset.
sdf.translate(x: f64, y: f64, z: f64) -> Sdfsphere(0.5).translate(1.0, 0.0, 0.0)translate_x
methodMoves the shape along the X axis.
sdf.translate_x(x: f64) -> Sdfsphere(0.5).translate_x(1.0)translate_y
methodMoves the shape along the Y axis.
sdf.translate_y(y: f64) -> Sdfsphere(0.5).translate_y(1.0)translate_z
methodMoves the shape along the Z axis.
sdf.translate_z(z: f64) -> Sdfsphere(0.5).translate_z(1.0)rotate_x
methodRotates the shape around the X axis in radians.
sdf.rotate_x(angle: f64) -> Sdfcube(0.5).rotate_x(deg(45.0))rotate_y
methodRotates the shape around the Y axis in radians.
sdf.rotate_y(angle: f64) -> Sdfcube(0.5).rotate_y(deg(45.0))rotate_z
methodRotates the shape around the Z axis in radians.
sdf.rotate_z(angle: f64) -> Sdfcube(0.5).rotate_z(deg(45.0))scale
methodUniformly scales the shape.
sdf.scale(factor: f64) -> Sdfsphere(0.5).scale(2.0)mirror_x
methodMirrors the shape across the YZ plane.
sdf.mirror_x() -> Sdfsphere(0.5).translate_x(0.5).mirror_x()mirror_y
methodMirrors the shape across the XZ plane.
sdf.mirror_y() -> Sdfsphere(0.5).translate_y(0.5).mirror_y()mirror_z
methodMirrors the shape across the XY plane.
sdf.mirror_z() -> Sdfsphere(0.5).translate_z(0.5).mirror_z()symmetry_x
methodCreates X-axis symmetry.
sdf.symmetry_x() -> Sdfsphere(0.5).translate_x(0.5).symmetry_x()symmetry_y
methodCreates Y-axis symmetry.
sdf.symmetry_y() -> Sdfsphere(0.5).translate_y(0.5).symmetry_y()symmetry_z
methodCreates Z-axis symmetry.
sdf.symmetry_z() -> Sdfsphere(0.5).translate_z(0.5).symmetry_z()Math Helpers
PI
functionReturns pi.
PI() -> f64cube(0.5).rotate_y(PI() / 4.0)TAU
functionReturns 2*pi.
TAU() -> f64cube(0.5).rotate_y(TAU() / 8.0)deg
functionConverts degrees to radians.
deg(degrees: f64) -> f64cube(0.5).rotate_x(deg(45.0))rad
functionConverts radians to degrees.
rad(radians: f64) -> f64let angle = rad(PI() / 4.0);