jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.65k stars 514 forks source link

hull with a single unconvex solid #1357

Open her01n opened 2 months ago

her01n commented 2 months ago

Expected Behavior

hull(solid) returns a convex hull of solid.

Actual Behavior

hull(solid) returns the argument solid even when it is not convex.

Steps to Reproduce the Problem

    const { torus } = require('@jscad/modeling').primitives
    const { hull } = require('@jscad/modeling').hulls

    const main = () => {
        return hull(torus())
    }

    module.exports = { main }

Running this code produces a torus.

Workaround

Repeat the solid to get the correct behavior, for example:

    const { torus } = require('@jscad/modeling').primitives
    const { hull } = require('@jscad/modeling').hulls

    const main = () => {
        return hull(torus(), torus())
    }

    module.exports = { main }

Specifications