use cord_sdf::SdfNode;
use crate::Shape;

/// Unit sphere (radius 1) at the origin.
pub fn unit_sphere() -> Shape {
    Shape::new(SdfNode::Sphere { radius: 1.0 })
}

/// Sphere with given radius at the origin.
pub fn sphere(radius: f64) -> Shape {
    Shape::new(SdfNode::Sphere { radius })
}

/// Axis-aligned box with given half-extents.
pub fn box3(hx: f64, hy: f64, hz: f64) -> Shape {
    Shape::new(SdfNode::Box {
        half_extents: [hx, hy, hz],
    })
}

/// Cube with given half-extent (equal on all axes).
pub fn cube(half: f64) -> Shape {
    box3(half, half, half)
}

/// Z-axis aligned cylinder centered at origin.
pub fn cylinder(radius: f64, height: f64) -> Shape {
    Shape::new(SdfNode::Cylinder { radius, height })
}
