• Surface-of-revolution geometry: revolve a 2D profile around the Y axis to produce columns, balusters, vases, dome roofs, light fixtures, doughnut shapes.

    The profile lies in the (r, y) half-plane — r is radial distance from the Y axis, y is height. Each profile point sweeps a ring of segments vertices around the axis. Smooth normals follow the profile's local outward perpendicular.

    • profile is a flat array [r0, y0, r1, y1, ...]. List points in order of increasing arc length along the profile. Outward surface normals assume the profile traces CCW in (r, y) space — for the typical "outer skin from bottom to top" path that means r >= 0 and y increasing.
    • Profile vertices on the axis (r = 0) are allowed and produce a cone tip; the ring at that vertex collapses to a single point but each duplicated vertex still carries the smooth-shaded normal so triangles around the tip render correctly.
    • segments (default 32) is the radial subdivision count around the Y axis.
    • closedProfile (default false) closes the profile loop so the ring at the last vertex connects back to the ring at the first, producing torus-shape geometry from a closed 2D profile (e.g. a circle offset from the axis).
    // Wine-bottle silhouette revolved around Y.
    const result = buildLathe({
    profile: [
    0.00, 0.0, // base centre (on axis)
    0.30, 0.0, // base rim
    0.30, 0.5, // body bottom
    0.32, 1.5, // shoulder
    0.10, 2.0, // neck
    0.12, 2.4 // top rim
    ],
    segments: 48
    });

    if (result.ok) {
    const geometry = result.value;
    // Pass to sceneModel.createGeometry(...)
    } else {
    console.error("Error creating lathe geometry:", result.error);
    }

    Parameters

    • cfg: { closedProfile?: boolean; profile: number[]; segments?: number }

      Configuration for the lathe.

      • OptionalclosedProfile?: boolean

        Whether the profile closes back on itself, producing a torus-shape revolution.

      • profile: number[]

        Profile polyline, flat [r0, y0, r1, y1, ...]. Must contain at least 2 vertices (length ≥ 4, even).

      • Optionalsegments?: number

        Number of radial subdivisions around the Y axis. Clamped to a minimum of 3.

    Returns SDKResult<GeometryArrays>

    Geometry arrays for the surface of revolution, or an error.