Skip to content

enum

Primitive

pub enum Primitive {
    Cube { size: f32 },
    Sphere { radius: f32 },
    Plane { width: f32, height: f32 },
    Torus { radius: f32, tube: f32 },
    TorusKnot { radius: f32, tube: f32, p: u16, q: u16 },
    Icosphere { radius: f32, detail: u8 },
    Cylinder { radius: f32, height: f32 },
    Cone { radius: f32, height: f32 },
}

A built-in 3D shape, with its dimensions.

Variants

Cube

Cube { size: f32 }

A cube (cube) with sides of size.

Sphere

Sphere { radius: f32 }

A sphere (sphere).

Plane

Plane { width: f32, height: f32 }

A flat rectangle (plane) in the XY plane, facing +z, as three.js. width along x and height along y.

Torus

Torus { radius: f32, tube: f32 }

A ring (torus): radius to the tube's centre, tube its radius.

TorusKnot

TorusKnot { radius: f32, tube: f32, p: u16, q: u16 }

A knot (torus-knot) winding p times around its axis and q times through its hole.

Icosphere

Icosphere { radius: f32, detail: u8 }

A sphere made of triangles (icosphere), subdivided detail times (at most 5).

Cylinder

Cylinder { radius: f32, height: f32 }

A cylinder (cylinder).

Cone

Cone { radius: f32, height: f32 }

A cone (cone).

Methods

mesh

pub fn mesh(&self) -> Mesh

The shape's mesh.

kind

pub fn kind(&self) -> &'static str

The DSL element name for this primitive.

Trait implementations