#[non_exhaustive]pub enum SdfNode {
Show 130 variants
Sphere {
radius: f32,
},
Box3d {
half_extents: Vec3,
},
Cylinder {
radius: f32,
half_height: f32,
},
Torus {
major_radius: f32,
minor_radius: f32,
},
Plane {
normal: Vec3,
distance: f32,
},
Capsule {
point_a: Vec3,
point_b: Vec3,
radius: f32,
},
Cone {
radius: f32,
half_height: f32,
},
Ellipsoid {
radii: Vec3,
},
RoundedCone {
r1: f32,
r2: f32,
half_height: f32,
},
Pyramid {
half_height: f32,
},
Octahedron {
size: f32,
},
HexPrism {
hex_radius: f32,
half_height: f32,
},
Link {
half_length: f32,
r1: f32,
r2: f32,
},
Triangle {
point_a: Vec3,
point_b: Vec3,
point_c: Vec3,
},
Bezier {
point_a: Vec3,
point_b: Vec3,
point_c: Vec3,
radius: f32,
},
RoundedBox {
half_extents: Vec3,
round_radius: f32,
},
CappedCone {
half_height: f32,
r1: f32,
r2: f32,
},
CappedTorus {
major_radius: f32,
minor_radius: f32,
cap_angle: f32,
},
RoundedCylinder {
radius: f32,
round_radius: f32,
half_height: f32,
},
TriangularPrism {
width: f32,
half_depth: f32,
},
CutSphere {
radius: f32,
cut_height: f32,
},
CutHollowSphere {
radius: f32,
cut_height: f32,
thickness: f32,
},
DeathStar {
ra: f32,
rb: f32,
d: f32,
},
SolidAngle {
angle: f32,
radius: f32,
},
Rhombus {
la: f32,
lb: f32,
half_height: f32,
round_radius: f32,
},
Horseshoe {
angle: f32,
radius: f32,
half_length: f32,
width: f32,
thickness: f32,
},
Vesica {
radius: f32,
half_dist: f32,
},
InfiniteCylinder {
radius: f32,
},
InfiniteCone {
angle: f32,
},
Gyroid {
scale: f32,
thickness: f32,
},
MetricBall {
radius: f32,
w_l1: f32,
w_l2: f32,
w_linf: f32,
},
MetricBlend {
inner: Arc<Self>,
outer: Arc<Self>,
center: Vec3,
radius: f32,
skin: f32,
},
Heart {
size: f32,
},
Tube {
outer_radius: f32,
thickness: f32,
half_height: f32,
},
Barrel {
radius: f32,
half_height: f32,
bulge: f32,
},
Diamond {
radius: f32,
half_height: f32,
},
ChamferedCube {
half_extents: Vec3,
chamfer: f32,
},
SchwarzP {
scale: f32,
thickness: f32,
},
Superellipsoid {
half_extents: Vec3,
e1: f32,
e2: f32,
},
RoundedX {
width: f32,
round_radius: f32,
half_height: f32,
},
Pie {
angle: f32,
radius: f32,
half_height: f32,
},
Trapezoid {
r1: f32,
r2: f32,
trap_height: f32,
half_depth: f32,
},
Parallelogram {
width: f32,
para_height: f32,
skew: f32,
half_depth: f32,
},
Tunnel {
width: f32,
height_2d: f32,
half_depth: f32,
},
UnevenCapsule {
r1: f32,
r2: f32,
cap_height: f32,
half_depth: f32,
},
Egg {
ra: f32,
rb: f32,
},
ArcShape {
aperture: f32,
radius: f32,
thickness: f32,
half_height: f32,
},
Moon {
d: f32,
ra: f32,
rb: f32,
half_height: f32,
},
CrossShape {
length: f32,
thickness: f32,
round_radius: f32,
half_height: f32,
},
BlobbyCross {
size: f32,
half_height: f32,
},
ParabolaSegment {
width: f32,
para_height: f32,
half_depth: f32,
},
RegularPolygon {
radius: f32,
n_sides: f32,
half_height: f32,
},
StarPolygon {
radius: f32,
n_points: f32,
m: f32,
half_height: f32,
},
Stairs {
step_width: f32,
step_height: f32,
n_steps: f32,
half_depth: f32,
},
Helix {
major_r: f32,
minor_r: f32,
pitch: f32,
half_height: f32,
},
Tetrahedron {
size: f32,
},
Dodecahedron {
radius: f32,
},
Icosahedron {
radius: f32,
},
TruncatedOctahedron {
radius: f32,
},
TruncatedIcosahedron {
radius: f32,
},
BoxFrame {
half_extents: Vec3,
edge: f32,
},
DiamondSurface {
scale: f32,
thickness: f32,
},
Neovius {
scale: f32,
thickness: f32,
},
Lidinoid {
scale: f32,
thickness: f32,
},
IWP {
scale: f32,
thickness: f32,
},
FRD {
scale: f32,
thickness: f32,
},
FischerKochS {
scale: f32,
thickness: f32,
},
PMY {
scale: f32,
thickness: f32,
},
Circle2D {
radius: f32,
half_height: f32,
},
Rect2D {
half_extents: Vec2,
half_height: f32,
},
Segment2D {
a: Vec2,
b: Vec2,
thickness: f32,
half_height: f32,
},
Polygon2D {
vertices: Vec<Vec2>,
half_height: f32,
},
RoundedRect2D {
half_extents: Vec2,
round_radius: f32,
half_height: f32,
},
Annular2D {
outer_radius: f32,
thickness: f32,
half_height: f32,
},
Union {
a: Arc<Self>,
b: Arc<Self>,
},
Intersection {
a: Arc<Self>,
b: Arc<Self>,
},
Subtraction {
a: Arc<Self>,
b: Arc<Self>,
},
SmoothUnion {
a: Arc<Self>,
b: Arc<Self>,
k: f32,
},
SmoothIntersection {
a: Arc<Self>,
b: Arc<Self>,
k: f32,
},
SmoothSubtraction {
a: Arc<Self>,
b: Arc<Self>,
k: f32,
},
ChamferUnion {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
},
ChamferIntersection {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
},
ChamferSubtraction {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
},
StairsUnion {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
n: f32,
},
StairsIntersection {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
n: f32,
},
StairsSubtraction {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
n: f32,
},
XOR {
a: Arc<Self>,
b: Arc<Self>,
},
Morph {
a: Arc<Self>,
b: Arc<Self>,
t: f32,
},
ColumnsUnion {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
n: f32,
},
ColumnsIntersection {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
n: f32,
},
ColumnsSubtraction {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
n: f32,
},
Pipe {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
},
Engrave {
a: Arc<Self>,
b: Arc<Self>,
r: f32,
},
Groove {
a: Arc<Self>,
b: Arc<Self>,
ra: f32,
rb: f32,
},
Tongue {
a: Arc<Self>,
b: Arc<Self>,
ra: f32,
rb: f32,
},
ExpSmoothUnion {
a: Arc<Self>,
b: Arc<Self>,
k: f32,
},
ExpSmoothIntersection {
a: Arc<Self>,
b: Arc<Self>,
k: f32,
},
ExpSmoothSubtraction {
a: Arc<Self>,
b: Arc<Self>,
k: f32,
},
Translate {
child: Arc<Self>,
offset: Vec3,
},
Rotate {
child: Arc<Self>,
rotation: Quat,
},
Scale {
child: Arc<Self>,
factor: f32,
},
ScaleNonUniform {
child: Arc<Self>,
factors: Vec3,
},
ProjectiveTransform {
child: Arc<Self>,
inv_matrix: [f32; 16],
lipschitz_bound: f32,
},
LatticeDeform {
child: Arc<Self>,
control_points: Vec<Vec3>,
nx: u32,
ny: u32,
nz: u32,
bbox_min: Vec3,
bbox_max: Vec3,
},
SdfSkinning {
child: Arc<Self>,
bones: Vec<BoneTransform>,
},
Twist {
child: Arc<Self>,
strength: f32,
},
Bend {
child: Arc<Self>,
curvature: f32,
},
RepeatInfinite {
child: Arc<Self>,
spacing: Vec3,
},
RepeatFinite {
child: Arc<Self>,
count: [u32; 3],
spacing: Vec3,
},
Noise {
child: Arc<Self>,
amplitude: f32,
frequency: f32,
seed: u32,
},
Round {
child: Arc<Self>,
radius: f32,
},
Onion {
child: Arc<Self>,
thickness: f32,
},
Elongate {
child: Arc<Self>,
amount: Vec3,
},
Mirror {
child: Arc<Self>,
axes: Vec3,
},
Revolution {
child: Arc<Self>,
offset: f32,
},
Extrude {
child: Arc<Self>,
half_height: f32,
},
SweepBezier {
child: Arc<Self>,
p0: Vec2,
p1: Vec2,
p2: Vec2,
},
Taper {
child: Arc<Self>,
factor: f32,
reach: [f32; 2],
},
Displacement {
child: Arc<Self>,
strength: f32,
},
SineDisplacement {
child: Arc<Self>,
amplitude: f32,
frequency: Vec3,
},
PolarRepeat {
child: Arc<Self>,
count: u32,
},
OctantMirror {
child: Arc<Self>,
},
Shear {
child: Arc<Self>,
shear: Vec3,
},
Animated {
child: Arc<Self>,
speed: f32,
amplitude: f32,
},
WithMaterial {
child: Arc<Self>,
material_id: u32,
},
IcosahedralSymmetry {
child: Arc<Self>,
},
IFS {
child: Arc<Self>,
transforms: Vec<[f32; 16]>,
iterations: u32,
},
HeightmapDisplacement {
child: Arc<Self>,
heightmap: Vec<f32>,
width: u32,
height: u32,
amplitude: f32,
scale: f32,
},
SurfaceRoughness {
child: Arc<Self>,
frequency: f32,
amplitude: f32,
octaves: u32,
},
Terrain {
scale: f32,
amplitude: f32,
},
}Expand description
Signed Distance Function Node
Represents a node in the SDF tree. Each node can be:
- A primitive shape (sphere, box, etc.)
- An operation combining two shapes (union, intersection, etc.)
- A transform applied to a child node
- A modifier deforming a child node
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sphere
Sphere with radius
Box3d
Axis-aligned box with half-extents
Cylinder
Cylinder along Y-axis with radius and half-height
Torus
Torus in XZ plane with major and minor radius
Plane
Infinite plane with normal and distance from origin
Capsule
Capsule between two points with radius
Cone
Cone along Y-axis with base radius and half-height
Ellipsoid
Ellipsoid with semi-axis radii
RoundedCone
Rounded cone along Y-axis with bottom radius r1, top radius r2
Pyramid
4-sided pyramid with square base (side=1) centered at origin
Octahedron
Regular octahedron centered at origin
HexPrism
Hexagonal prism centered at origin
Link
Chain link shape centered at origin
Fields
Triangle
Triangle defined by three vertices (unsigned distance)
Bezier
Quadratic Bezier curve with radius (tube around curve)
Fields
RoundedBox
Box with rounded edges
CappedCone
Capped cone (frustum) along Y-axis
CappedTorus
Partial torus (arc) in XZ plane
Fields
RoundedCylinder
Cylinder with rounded edges along Y-axis
Fields
TriangularPrism
Equilateral triangular prism along Z-axis
Fields
CutSphere
Sphere with a planar cut
CutHollowSphere
Hollow sphere shell with a planar cut
Fields
DeathStar
Death Star: sphere with spherical indentation
Fields
SolidAngle
Solid angle (cone sector)
Rhombus
3D rhombus (diamond shape)
Fields
Horseshoe
Horseshoe (U-shape)
Fields
Vesica
3D vesica (lens shape, revolved)
InfiniteCylinder
Infinite cylinder along Y-axis
InfiniteCone
Infinite cone along Y-axis
Gyroid
Gyroid triply-periodic minimal surface
MetricBall
Ball of a weighted norm — w₁‖p‖₁ + w₂‖p‖₂ + w∞‖p‖∞ − radius.
The three weights choose the shape: (0, 1, 0) is a sphere,
(0, 0, 1) a cube, (1, 0, 0) an octahedron, and anything in
between a convex blend of those unit balls. They are non-negative and
not all zero — SdfNode::metric_ball takes a validated
MetricWeights, which is the only way to build one.
Fields
MetricBlend
Two fields blended over a spherical skin — the inner field inside a bubble, the outer one beyond it, smoothly joined across the skin.
Inside radius the result is the inner field exactly, beyond
radius + skin the outer one exactly (the blend weight is exactly
0 and 1 there, and the interpolation is endpoint-exact), so placing a
bubble never perturbs the world outside it.
The blend of two unrelated fields is not a distance function: across
the skin the gradient picks up |f_in − f_out| · |∇w|, which no
static bound can know, so
eval_lipschitz reports infinity
for it. Use measure_tension over
the skin to find out what it actually does.
Fields
Heart
3D heart shape (revolved contour)
Tube
Hollow cylinder (tube/pipe) along Y-axis
Fields
Barrel
Cylinder with parabolic radial bulge along Y-axis
Fields
Diamond
Bipyramid (double-cone) with revolution symmetry
ChamferedCube
Box with chamfered (beveled) edges
SchwarzP
Schwarz P triply-periodic minimal surface
Superellipsoid
Generalized ellipsoid (sphere-box morph)
RoundedX
Rounded X shape extruded along Y-axis
Fields
Pie
Pie (sector) shape extruded along Y-axis
Fields
Trapezoid
Trapezoid prism in XY plane, extruded along Z
Fields
Parallelogram
Parallelogram prism in XY plane, extruded along Z
Fields
Tunnel
Tunnel (arch opening) in XY plane, extruded along Z
Fields
UnevenCapsule
Uneven capsule prism in XY plane, extruded along Z
Fields
Egg
Egg shape (revolution body) around Y-axis
ArcShape
Arc shape (thick ring sector) in XZ plane, extruded along Y
Fields
Moon
Moon (crescent) shape in XZ plane, extruded along Y
Fields
CrossShape
Cross (plus) shape in XZ plane, extruded along Y
Fields
BlobbyCross
Blobby cross (organic) in XZ plane, extruded along Y
ParabolaSegment
Parabola segment in XY plane, extruded along Z
Fields
RegularPolygon
Regular N-sided polygon prism in XZ plane, extruded along Y
Fields
StarPolygon
Star polygon prism in XZ plane, extruded along Y
Fields
Stairs
Staircase shape in XY plane, extruded along Z
Fields
Helix
Helix (spiral tube) along Y-axis
Fields
Tetrahedron
Regular tetrahedron centered at origin
Dodecahedron
Regular dodecahedron centered at origin (GDF)
Icosahedron
Regular icosahedron centered at origin (GDF)
TruncatedOctahedron
Truncated octahedron centered at origin (GDF)
TruncatedIcosahedron
Truncated icosahedron (soccer ball) centered at origin (GDF)
BoxFrame
Box frame (wireframe box, edges only)
DiamondSurface
Diamond surface (Schwarz D TPMS)
Neovius
Neovius surface (TPMS)
Lidinoid
Lidinoid surface (TPMS)
IWP
IWP surface (TPMS)
FRD
FRD surface (TPMS)
FischerKochS
Fischer-Koch S surface (TPMS)
PMY
PMY surface (TPMS)
Circle2D
2D Circle extruded along Z
Rect2D
2D Rectangle extruded along Z
Fields
Segment2D
2D Line Segment extruded along Z
Fields
Polygon2D
2D Polygon (convex, up to 8 vertices) extruded along Z
RoundedRect2D
2D Rounded Rectangle extruded along Z
Fields
Annular2D
2D Annular (ring) shape extruded along Z
Fields
Union
Union of two shapes (min distance)
Intersection
Intersection of two shapes (max distance)
Subtraction
Subtraction: a minus b (max of a and -b)
SmoothUnion
Smooth union with blending factor k
SmoothIntersection
Smooth intersection with blending factor k
SmoothSubtraction
Smooth subtraction with blending factor k
ChamferUnion
Chamfer union: 45-degree beveled blend
ChamferIntersection
Chamfer intersection: 45-degree beveled blend
ChamferSubtraction
Chamfer subtraction: 45-degree beveled blend
StairsUnion
Stairs union: stepped/terraced blend (Mercury hg_sdf)
Fields
StairsIntersection
Stairs intersection: stepped/terraced blend
Fields
StairsSubtraction
Stairs subtraction: stepped/terraced blend
Fields
XOR
XOR (symmetric difference)
Morph
Morph (linear interpolation between two shapes)
ColumnsUnion
Columns union: column-shaped blend
Fields
ColumnsIntersection
Columns intersection: column-shaped blend
Fields
ColumnsSubtraction
Columns subtraction: column-shaped blend
Fields
Pipe
Pipe: cylindrical surface at intersection
Engrave
Engrave: engrave shape b into shape a
Fields
Groove
Groove: cut a groove of shape b into shape a
Fields
Tongue
Tongue: add a tongue protrusion
Fields
ExpSmoothUnion
Exponential smooth union (IQ): exp-weighted smooth min
ExpSmoothIntersection
Exponential smooth intersection
ExpSmoothSubtraction
Exponential smooth subtraction
Translate
Translation
Rotate
Rotation (quaternion)
Scale
Uniform scale
ScaleNonUniform
Non-uniform scale (stretches the shape)
ProjectiveTransform
Projective (perspective) transform with Lipschitz correction
Fields
LatticeDeform
Free-Form Deformation via control point lattice
Fields
SdfSkinning
SDF Skinning — bone-weight based spatial blending
Twist
Twist around Y-axis (radians per unit height)
Bend
Bend around Y-axis
RepeatInfinite
Infinite repetition with spacing
RepeatFinite
Finite repetition with count and spacing
Fields
Noise
Perlin noise displacement
Fields
Round
Round edges by subtracting radius
Onion
Onion: creates a shell with thickness
Elongate
Elongate along an axis
Mirror
Mirror along specified axes (takes absolute value of coordinates)
Revolution
Revolution around Y-axis (creates rotational symmetry)
Extrude
Extrude along Z-axis (creates 3D from XY cross-section)
SweepBezier
Sweep along a quadratic Bezier curve in the XZ plane. The child SDF is evaluated at (perpendicular_distance, y, 0). Creates tubes, channels, or any cross-section shape along a curved path.
Fields
Taper
Taper: the child is evaluated at (x, y, z) / (1 − y·factor) (a
perspective map with centre (0, 1/factor, 0)), and its distance is
turned into a parent-space bound by real::taper_bound.
Fields
reach: [f32; 2]Reach of the child in its own space, [r_xz, r_y] (|q_xz| ≤ r_xz,
|q_y| ≤ r_y), computed by SdfNode::taper from the child’s
AABB. It bounds the parent-space shape by a cone ∩ slab so that the
singular plane y = 1/factor is not reported as a surface.
[INFINITY; 2] (unbounded child, or a file written before 2.0)
keeps only the Jacobian bound. Must be recomputed
(SdfNode::taper) if the child changes.
Displacement
Sin-based displacement (post-processing modifier)
SineDisplacement
Sin-based displacement with custom amplitude and per-axis frequency (= Vec3 frequency for anisotropic patterns、 e.g. elongated diamond scales)
Fields
PolarRepeat
Polar repetition around Y-axis
OctantMirror
Octant mirror: maps point to first octant with x >= y >= z (48-fold symmetry)
Shear
Shear deformation (modifies evaluation point)
Animated
Animated modifier: applies time-based transformation
Fields
WithMaterial
Assign a material ID to a subtree (transparent for distance evaluation)
IcosahedralSymmetry
Icosahedral symmetry (120-fold) — maps to fundamental domain
IFS
Iterated Function System — fractal self-similar folding
Fields
HeightmapDisplacement
Heightmap displacement — image-based surface perturbation
Fields
SurfaceRoughness
Surface roughness — FBM micro-detail noise
Fields
Terrain
Biome terrain — procedural terrain with FBM + Voronoi erosion Uses radial biome blending (snow, desert, rock, grassland)
Implementations§
Source§impl SdfNode
impl SdfNode
Sourcepub fn box3d(width: f32, height: f32, depth: f32) -> Self
pub fn box3d(width: f32, height: f32, depth: f32) -> Self
Create an axis-aligned box with the given full dimensions
(width × height × depth; the node stores half of each).
§Naming hazard
This is the one box constructor that takes full extents. Both
SdfNode::rounded_box and the LOL DSL box3d(hx, hy, hz) take
half-extents — box3d(20, 20, 3) in LOL is a 40 × 40 × 6 mm box,
while SdfNode::box3d(20.0, 20.0, 3.0) in Rust is 20 × 20 × 3 mm.
Use SdfNode::box3d_half_extents when you hold half-extents (for
example when porting a LOL expression to Rust) so the intent is
visible at the call site. Neither spelling can change without
breaking published callers, so the difference is documented rather
than unified.
Sourcepub const fn box3d_half_extents(hx: f32, hy: f32, hz: f32) -> Self
pub const fn box3d_half_extents(hx: f32, hy: f32, hz: f32) -> Self
Create an axis-aligned box from half-extents — the same
convention as SdfNode::rounded_box and the LOL DSL box3d.
use alice_sdf::types::SdfNode;
// LOL `box3d(20, 10, 1.5)` (40 × 20 × 3 mm) ported to Rust:
let a = SdfNode::box3d_half_extents(20.0, 10.0, 1.5);
let b = SdfNode::box3d(40.0, 20.0, 3.0);
let p = glam::Vec3::new(19.0, 9.0, 1.0);
assert_eq!(alice_sdf::eval::eval(&a, p), alice_sdf::eval::eval(&b, p));Sourcepub const fn torus(major_radius: f32, minor_radius: f32) -> Self
pub const fn torus(major_radius: f32, minor_radius: f32) -> Self
Create a torus in the XZ plane
Sourcepub const fn capsule(a: Vec3, b: Vec3, radius: f32) -> Self
pub const fn capsule(a: Vec3, b: Vec3, radius: f32) -> Self
Create a capsule between two points
Sourcepub const fn ellipsoid(rx: f32, ry: f32, rz: f32) -> Self
pub const fn ellipsoid(rx: f32, ry: f32, rz: f32) -> Self
Create an ellipsoid with given semi-axis radii
Sourcepub fn rounded_cone(r1: f32, r2: f32, height: f32) -> Self
pub fn rounded_cone(r1: f32, r2: f32, height: f32) -> Self
Create a rounded cone along Y-axis
Sourcepub const fn octahedron(size: f32) -> Self
pub const fn octahedron(size: f32) -> Self
Create a regular octahedron
Sourcepub const fn bezier(a: Vec3, b: Vec3, c: Vec3, radius: f32) -> Self
pub const fn bezier(a: Vec3, b: Vec3, c: Vec3, radius: f32) -> Self
Create a quadratic Bezier curve tube
Sourcepub const fn rounded_box(hx: f32, hy: f32, hz: f32, round_radius: f32) -> Self
pub const fn rounded_box(hx: f32, hy: f32, hz: f32, round_radius: f32) -> Self
Create a rounded box from half-extents (hx, hy, hz) and an
edge rounding radius.
Note the asymmetry with SdfNode::box3d, which takes full
dimensions; see SdfNode::box3d_half_extents for the half-extent
spelling of the plain box.
Sourcepub fn capped_cone(height: f32, r1: f32, r2: f32) -> Self
pub fn capped_cone(height: f32, r1: f32, r2: f32) -> Self
Create a capped cone (frustum)
Sourcepub const fn capped_torus(
major_radius: f32,
minor_radius: f32,
cap_angle: f32,
) -> Self
pub const fn capped_torus( major_radius: f32, minor_radius: f32, cap_angle: f32, ) -> Self
Create a capped torus (arc)
Sourcepub fn rounded_cylinder(radius: f32, round_radius: f32, height: f32) -> Self
pub fn rounded_cylinder(radius: f32, round_radius: f32, height: f32) -> Self
Create a rounded cylinder
Sourcepub fn triangular_prism(width: f32, depth: f32) -> Self
pub fn triangular_prism(width: f32, depth: f32) -> Self
Create a triangular prism
Sourcepub const fn cut_sphere(radius: f32, cut_height: f32) -> Self
pub const fn cut_sphere(radius: f32, cut_height: f32) -> Self
Create a cut sphere
Sourcepub const fn cut_hollow_sphere(
radius: f32,
cut_height: f32,
thickness: f32,
) -> Self
pub const fn cut_hollow_sphere( radius: f32, cut_height: f32, thickness: f32, ) -> Self
Create a cut hollow sphere
Sourcepub const fn death_star(ra: f32, rb: f32, d: f32) -> Self
pub const fn death_star(ra: f32, rb: f32, d: f32) -> Self
Create a Death Star shape
Sourcepub const fn solid_angle(angle: f32, radius: f32) -> Self
pub const fn solid_angle(angle: f32, radius: f32) -> Self
Create a solid angle
Sourcepub fn horseshoe(
angle: f32,
radius: f32,
length: f32,
width: f32,
thickness: f32,
) -> Self
pub fn horseshoe( angle: f32, radius: f32, length: f32, width: f32, thickness: f32, ) -> Self
Create a horseshoe shape
Sourcepub const fn infinite_cylinder(radius: f32) -> Self
pub const fn infinite_cylinder(radius: f32) -> Self
Create an infinite cylinder
Sourcepub const fn infinite_cone(angle: f32) -> Self
pub const fn infinite_cone(angle: f32) -> Self
Create an infinite cone
Sourcepub const fn metric_ball(radius: f32, weights: MetricWeights) -> Self
pub const fn metric_ball(radius: f32, weights: MetricWeights) -> Self
Create the ball of a weighted norm.
(0, 1, 0) gives a sphere, (0, 0, 1) a cube, (1, 0, 0) an
octahedron. Taking a validated
MetricWeights is what keeps
a non-metric (a negative weight, whose unit ball is not convex) out of
the tree.
Sourcepub fn metric_blend(
inner: Self,
outer: Self,
center: Vec3,
radius: f32,
skin: f32,
) -> Self
pub fn metric_blend( inner: Self, outer: Self, center: Vec3, radius: f32, skin: f32, ) -> Self
Blend two fields over a spherical skin: inner within radius of
center, outer beyond radius + skin, smoothly joined between.
Outside the bubble the result is outer bit for bit, so a bubble is
a local edit of the world and nothing else.
Sourcepub fn tube(outer_radius: f32, thickness: f32, height: f32) -> Self
pub fn tube(outer_radius: f32, thickness: f32, height: f32) -> Self
Create a tube (hollow cylinder) along Y-axis
Sourcepub fn chamfered_cube(width: f32, height: f32, depth: f32, chamfer: f32) -> Self
pub fn chamfered_cube(width: f32, height: f32, depth: f32, chamfer: f32) -> Self
Create a chamfered cube
Sourcepub fn superellipsoid(
width: f32,
height: f32,
depth: f32,
e1: f32,
e2: f32,
) -> Self
pub fn superellipsoid( width: f32, height: f32, depth: f32, e1: f32, e2: f32, ) -> Self
Create a superellipsoid
Sourcepub fn trapezoid(r1: f32, r2: f32, trap_height: f32, depth: f32) -> Self
pub fn trapezoid(r1: f32, r2: f32, trap_height: f32, depth: f32) -> Self
Create a trapezoid prism
Sourcepub fn parallelogram(
width: f32,
para_height: f32,
skew: f32,
depth: f32,
) -> Self
pub fn parallelogram( width: f32, para_height: f32, skew: f32, depth: f32, ) -> Self
Create a parallelogram prism
Sourcepub fn uneven_capsule(r1: f32, r2: f32, cap_height: f32, depth: f32) -> Self
pub fn uneven_capsule(r1: f32, r2: f32, cap_height: f32, depth: f32) -> Self
Create an uneven capsule prism
Sourcepub fn arc_shape(
aperture: f32,
radius: f32,
thickness: f32,
height: f32,
) -> Self
pub fn arc_shape( aperture: f32, radius: f32, thickness: f32, height: f32, ) -> Self
Create an arc shape (thick ring sector)
Sourcepub fn cross_shape(
length: f32,
thickness: f32,
round_radius: f32,
height: f32,
) -> Self
pub fn cross_shape( length: f32, thickness: f32, round_radius: f32, height: f32, ) -> Self
Create a cross (plus) shape
Sourcepub fn blobby_cross(size: f32, height: f32) -> Self
pub fn blobby_cross(size: f32, height: f32) -> Self
Create a blobby cross (organic) shape
Sourcepub fn parabola_segment(width: f32, para_height: f32, depth: f32) -> Self
pub fn parabola_segment(width: f32, para_height: f32, depth: f32) -> Self
Create a parabola segment
Sourcepub fn regular_polygon(radius: f32, n_sides: u32, height: f32) -> Self
pub fn regular_polygon(radius: f32, n_sides: u32, height: f32) -> Self
Create a regular N-sided polygon prism
Sourcepub fn star_polygon(radius: f32, n_points: u32, m: f32, height: f32) -> Self
pub fn star_polygon(radius: f32, n_points: u32, m: f32, height: f32) -> Self
Create a star polygon prism
Sourcepub fn stairs(
step_width: f32,
step_height: f32,
n_steps: u32,
depth: f32,
) -> Self
pub fn stairs( step_width: f32, step_height: f32, n_steps: u32, depth: f32, ) -> Self
Create a staircase shape
Sourcepub fn helix(major_r: f32, minor_r: f32, pitch: f32, height: f32) -> Self
pub fn helix(major_r: f32, minor_r: f32, pitch: f32, height: f32) -> Self
Create a helix (spiral tube)
Sourcepub const fn tetrahedron(size: f32) -> Self
pub const fn tetrahedron(size: f32) -> Self
Create a regular tetrahedron
Sourcepub const fn dodecahedron(radius: f32) -> Self
pub const fn dodecahedron(radius: f32) -> Self
Create a regular dodecahedron
Sourcepub const fn icosahedron(radius: f32) -> Self
pub const fn icosahedron(radius: f32) -> Self
Create a regular icosahedron
Sourcepub const fn truncated_octahedron(radius: f32) -> Self
pub const fn truncated_octahedron(radius: f32) -> Self
Create a truncated octahedron
Sourcepub const fn truncated_icosahedron(radius: f32) -> Self
pub const fn truncated_icosahedron(radius: f32) -> Self
Create a truncated icosahedron (soccer ball)
Sourcepub const fn box_frame(half_extents: Vec3, edge: f32) -> Self
pub const fn box_frame(half_extents: Vec3, edge: f32) -> Self
Create a box frame (wireframe box)
Sourcepub const fn diamond_surface(scale: f32, thickness: f32) -> Self
pub const fn diamond_surface(scale: f32, thickness: f32) -> Self
Create a diamond surface (TPMS)
Sourcepub const fn fischer_koch_s(scale: f32, thickness: f32) -> Self
pub const fn fischer_koch_s(scale: f32, thickness: f32) -> Self
Create a Fischer-Koch S surface (TPMS)
Sourcepub const fn circle_2d(radius: f32, half_height: f32) -> Self
pub const fn circle_2d(radius: f32, half_height: f32) -> Self
Create a 2D circle extruded along Z
Sourcepub const fn rect_2d(half_w: f32, half_h: f32, half_height: f32) -> Self
pub const fn rect_2d(half_w: f32, half_h: f32, half_height: f32) -> Self
Create a 2D rectangle extruded along Z
Sourcepub const fn segment_2d(
ax: f32,
ay: f32,
bx: f32,
by: f32,
thickness: f32,
half_height: f32,
) -> Self
pub const fn segment_2d( ax: f32, ay: f32, bx: f32, by: f32, thickness: f32, half_height: f32, ) -> Self
Create a 2D line segment extruded along Z
Sourcepub const fn polygon_2d(vertices: Vec<Vec2>, half_height: f32) -> Self
pub const fn polygon_2d(vertices: Vec<Vec2>, half_height: f32) -> Self
Create a 2D polygon extruded along Z
Sourcepub const fn rounded_rect_2d(
half_w: f32,
half_h: f32,
round_radius: f32,
half_height: f32,
) -> Self
pub const fn rounded_rect_2d( half_w: f32, half_h: f32, round_radius: f32, half_height: f32, ) -> Self
Create a 2D rounded rectangle extruded along Z
Sourcepub const fn annular_2d(
outer_radius: f32,
thickness: f32,
half_height: f32,
) -> Self
pub const fn annular_2d( outer_radius: f32, thickness: f32, half_height: f32, ) -> Self
Create a 2D annular (ring) shape extruded along Z
Source§impl SdfNode
impl SdfNode
Sourcepub fn repeat_infinite(
self,
spacing_x: f32,
spacing_y: f32,
spacing_z: f32,
) -> Self
pub fn repeat_infinite( self, spacing_x: f32, spacing_y: f32, spacing_z: f32, ) -> Self
Infinite repetition
Sourcepub fn repeat_finite(self, count: [u32; 3], spacing: Vec3) -> Self
pub fn repeat_finite(self, count: [u32; 3], spacing: Vec3) -> Self
Finite repetition
Sourcepub fn noise(self, amplitude: f32, frequency: f32, seed: u32) -> Self
pub fn noise(self, amplitude: f32, frequency: f32, seed: u32) -> Self
Perlin noise displacement
Sourcepub fn revolution(self, offset: f32) -> Self
pub fn revolution(self, offset: f32) -> Self
Revolution around Y-axis
Sourcepub fn sweep_bezier(self, p0: Vec2, p1: Vec2, p2: Vec2) -> Self
pub fn sweep_bezier(self, p0: Vec2, p1: Vec2, p2: Vec2) -> Self
Sweep along a quadratic Bezier curve in the XZ plane. Control points are (x, z) coordinates.
Sourcepub fn taper(self, factor: f32) -> Self
pub fn taper(self, factor: f32) -> Self
Taper along Y-axis: the child is evaluated at
(x, y, z) / (1 − y·factor), narrower at +Y for factor > 0.
The child’s reach ([r_xz, r_y] from its AABB) is computed here and
stored in the node; it lets the evaluators bound the parent-space
shape by a cone so that the singular plane y = 1/factor is not a
phantom surface (see real::taper_bound). Rebuild the node with this
constructor after changing the child.
Sourcepub fn displacement(self, strength: f32) -> Self
pub fn displacement(self, strength: f32) -> Self
Sin-based displacement
Sourcepub fn sine_displacement(self, amplitude: f32, frequency: f32) -> Self
pub fn sine_displacement(self, amplitude: f32, frequency: f32) -> Self
Sin-based displacement with custom amplitude + isotropic frequency (= e.g. frequency 15-30 for fine scale-like patterns、 Vec3::splat 化)
Sourcepub fn sine_displacement_aniso(self, amplitude: f32, frequency: Vec3) -> Self
pub fn sine_displacement_aniso(self, amplitude: f32, frequency: Vec3) -> Self
Sin-based displacement with anisotropic per-axis frequency
(= e.g. Vec3::new(10.0, 40.0, 10.0) で軸別周波数、 細長菱形鱗用)
Sourcepub fn polar_repeat(self, count: u32) -> Self
pub fn polar_repeat(self, count: u32) -> Self
Polar repetition around Y-axis
Sourcepub fn octant_mirror(self) -> Self
pub fn octant_mirror(self) -> Self
Octant mirror (48-fold symmetry)
Sourcepub fn with_material(self, material_id: u32) -> Self
pub fn with_material(self, material_id: u32) -> Self
Assign a material ID to this subtree
Sourcepub fn icosahedral_symmetry(self) -> Self
pub fn icosahedral_symmetry(self) -> Self
Icosahedral symmetry (120-fold)
Sourcepub fn heightmap_displacement(
self,
heightmap: Vec<f32>,
width: u32,
height: u32,
amplitude: f32,
scale: f32,
) -> Self
pub fn heightmap_displacement( self, heightmap: Vec<f32>, width: u32, height: u32, amplitude: f32, scale: f32, ) -> Self
Heightmap displacement
Sourcepub fn surface_roughness(
self,
frequency: f32,
amplitude: f32,
octaves: u32,
) -> Self
pub fn surface_roughness( self, frequency: f32, amplitude: f32, octaves: u32, ) -> Self
Surface roughness (FBM noise)
Source§impl SdfNode
impl SdfNode
Sourcepub fn intersection(self, other: Self) -> Self
pub fn intersection(self, other: Self) -> Self
Intersection with another shape
Sourcepub fn smooth_union(self, other: Self, k: f32) -> Self
pub fn smooth_union(self, other: Self, k: f32) -> Self
Smooth union with another shape
Sourcepub fn smooth_intersection(self, other: Self, k: f32) -> Self
pub fn smooth_intersection(self, other: Self, k: f32) -> Self
Smooth intersection with another shape
Sourcepub fn smooth_subtract(self, other: Self, k: f32) -> Self
pub fn smooth_subtract(self, other: Self, k: f32) -> Self
Smooth subtraction of another shape
Sourcepub fn chamfer_union(self, other: Self, r: f32) -> Self
pub fn chamfer_union(self, other: Self, r: f32) -> Self
Chamfer union with another shape
Sourcepub fn chamfer_intersection(self, other: Self, r: f32) -> Self
pub fn chamfer_intersection(self, other: Self, r: f32) -> Self
Chamfer intersection with another shape
Sourcepub fn chamfer_subtract(self, other: Self, r: f32) -> Self
pub fn chamfer_subtract(self, other: Self, r: f32) -> Self
Chamfer subtraction of another shape
Sourcepub fn stairs_union(self, other: Self, r: f32, n: f32) -> Self
pub fn stairs_union(self, other: Self, r: f32, n: f32) -> Self
Stairs union with another shape
Sourcepub fn stairs_intersection(self, other: Self, r: f32, n: f32) -> Self
pub fn stairs_intersection(self, other: Self, r: f32, n: f32) -> Self
Stairs intersection with another shape
Sourcepub fn stairs_subtract(self, other: Self, r: f32, n: f32) -> Self
pub fn stairs_subtract(self, other: Self, r: f32, n: f32) -> Self
Stairs subtraction of another shape
Sourcepub fn columns_union(self, other: Self, r: f32, n: f32) -> Self
pub fn columns_union(self, other: Self, r: f32, n: f32) -> Self
Columns union with another shape
Sourcepub fn columns_intersection(self, other: Self, r: f32, n: f32) -> Self
pub fn columns_intersection(self, other: Self, r: f32, n: f32) -> Self
Columns intersection with another shape
Sourcepub fn columns_subtract(self, other: Self, r: f32, n: f32) -> Self
pub fn columns_subtract(self, other: Self, r: f32, n: f32) -> Self
Columns subtraction of another shape
Sourcepub fn groove(self, other: Self, ra: f32, rb: f32) -> Self
pub fn groove(self, other: Self, ra: f32, rb: f32) -> Self
Cut a groove of another shape into this one
Sourcepub fn tongue(self, other: Self, ra: f32, rb: f32) -> Self
pub fn tongue(self, other: Self, ra: f32, rb: f32) -> Self
Add a tongue protrusion of another shape
Sourcepub fn exp_smooth_union(self, other: Self, k: f32) -> Self
pub fn exp_smooth_union(self, other: Self, k: f32) -> Self
Exponential smooth union with another shape
Sourcepub fn exp_smooth_intersection(self, other: Self, k: f32) -> Self
pub fn exp_smooth_intersection(self, other: Self, k: f32) -> Self
Exponential smooth intersection with another shape
Sourcepub fn exp_smooth_subtract(self, other: Self, k: f32) -> Self
pub fn exp_smooth_subtract(self, other: Self, k: f32) -> Self
Exponential smooth subtraction of another shape
Source§impl SdfNode
impl SdfNode
Sourcepub fn translate_vec(self, offset: Vec3) -> Self
pub fn translate_vec(self, offset: Vec3) -> Self
Translate by vector
Sourcepub fn rotate_euler(self, x: f32, y: f32, z: f32) -> Self
pub fn rotate_euler(self, x: f32, y: f32, z: f32) -> Self
Rotate by Euler angles (radians)
Sourcepub fn projective_transform(
self,
inv_matrix: [f32; 16],
lipschitz_bound: f32,
) -> Self
pub fn projective_transform( self, inv_matrix: [f32; 16], lipschitz_bound: f32, ) -> Self
Projective (perspective) transform
Sourcepub fn lattice_deform(
self,
control_points: Vec<Vec3>,
nx: u32,
ny: u32,
nz: u32,
bbox_min: Vec3,
bbox_max: Vec3,
) -> Self
pub fn lattice_deform( self, control_points: Vec<Vec3>, nx: u32, ny: u32, nz: u32, bbox_min: Vec3, bbox_max: Vec3, ) -> Self
Lattice deformation (Free-Form Deformation)
Sourcepub fn sdf_skinning(self, bones: Vec<BoneTransform>) -> Self
pub fn sdf_skinning(self, bones: Vec<BoneTransform>) -> Self
SDF skinning (bone-weight based deformation)
Source§impl SdfNode
impl SdfNode
Sourcepub const fn category(&self) -> SdfCategory
pub const fn category(&self) -> SdfCategory
Returns the category of this node variant
Sourcepub fn node_count(&self) -> u32
pub fn node_count(&self) -> u32
Count total nodes in the tree
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SdfNode
impl<'de> Deserialize<'de> for SdfNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SdfNode
impl RefUnwindSafe for SdfNode
impl Send for SdfNode
impl Sync for SdfNode
impl Unpin for SdfNode
impl UnsafeUnpin for SdfNode
impl UnwindSafe for SdfNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more