Primitives API

Shape constructors available in Soyuz scripts.

Primitives

sphere

constructor

Creates a sphere centered at the origin.

sphere(radius: f64) -> Sdf
sphere(0.5)

cube

constructor

Creates a cube with equal sides, centered at the origin.

cube(size: f64) -> Sdf
cube(1.0)

box3

constructor

Creates a rectangular box with different dimensions per axis.

box3(width: f64, height: f64, depth: f64) -> Sdf
box3(1.0, 0.5, 0.3)

rounded_box

constructor

Creates a rectangular box with rounded edges.

rounded_box(width: f64, height: f64, depth: f64, radius: f64) -> Sdf
rounded_box(1.0, 0.5, 0.3, 0.05)

cylinder

constructor

Creates a cylinder aligned along the Y axis.

cylinder(radius: f64, height: f64) -> Sdf
cylinder(0.3, 1.0)

capsule

constructor

Creates a capsule with hemispherical caps.

capsule(radius: f64, height: f64) -> Sdf
capsule(0.2, 1.0)

torus

constructor

Creates a torus in the XZ plane.

torus(major_radius: f64, minor_radius: f64) -> Sdf
torus(0.5, 0.1)

cone

constructor

Creates a cone with its tip at the origin.

cone(radius: f64, height: f64) -> Sdf
cone(0.3, 1.0)

plane

constructor

Creates an infinite plane from a normal and offset.

plane(nx: f64, ny: f64, nz: f64, offset: f64) -> Sdf
plane(0.0, 1.0, 0.0, 0.0)

ground_plane

constructor

Creates a horizontal ground plane at Y=0.

ground_plane() -> Sdf
ground_plane()

ellipsoid

constructor

Creates an ellipsoid with different radii per axis.

ellipsoid(rx: f64, ry: f64, rz: f64) -> Sdf
ellipsoid(0.5, 0.3, 0.4)

octahedron

constructor

Creates a regular octahedron.

octahedron(size: f64) -> Sdf
octahedron(0.5)

hex_prism

constructor

Creates a hexagonal prism.

hex_prism(radius: f64, height: f64) -> Sdf
hex_prism(0.3, 0.5)

tri_prism

constructor

Creates a triangular prism.

tri_prism(width: f64, height: f64) -> Sdf
tri_prism(0.5, 0.3)

pyramid

constructor

Creates a square-based pyramid.

pyramid(height: f64) -> Sdf
pyramid(1.0)

extrude_circle

constructor

Extrudes a 2D circle into 3D.

extrude_circle(radius: f64, depth: f64) -> Sdf
extrude_circle(0.3, 0.5)

extrude_rect

constructor

Extrudes a 2D rectangle into 3D.

extrude_rect(width: f64, height: f64, depth: f64) -> Sdf
extrude_rect(0.5, 0.3, 0.2)

extrude_rounded_rect

constructor

Extrudes a rounded 2D rectangle into 3D.

extrude_rounded_rect(width: f64, height: f64, radius: f64, depth: f64) -> Sdf
extrude_rounded_rect(0.5, 0.3, 0.05, 0.2)

revolve_circle

constructor

Revolves a 2D circle around the Y axis.

revolve_circle(radius: f64, offset: f64) -> Sdf
revolve_circle(0.1, 0.5)

revolve_rect

constructor

Revolves a 2D rectangle around the Y axis.

revolve_rect(width: f64, height: f64, offset: f64) -> Sdf
revolve_rect(0.2, 0.1, 0.4)