Skip to content

JSCAD logo

The classic JSCAD logo — a cube with a sphere subtracted from the outside, and a smaller sphere-cube intersection floating in the centre.

A nice demonstration of subtract and intersect working together.

"use strict";
const jscad = require('@jscad/modeling')
const { intersect, subtract } = jscad.booleans
const { colorize } = jscad.colors
const { cube, sphere } = jscad.primitives
function main() {
const outer = subtract(
cube({ size: 10 }),
sphere({ radius: 6.8 })
)
const inner = intersect(
sphere({ radius: 4 }),
cube({ size: 7 })
)
return [
colorize([0.65, 0.25, 0.8], outer),
colorize([0.7, 0.7, 0.1], inner),
]
}
module.exports = { main }