-
-
Save tsuckow/b8569b1e061dc0286cb95517ca4add2b to your computer and use it in GitHub Desktop.
Bug in JSCad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Basic Booleans Demonstration | |
* @category Manipulating Shapes | |
* @skillLevel 2 | |
* @description Demonstrating the basics of boolean shape combinations | |
* @tags cube, sphere, union, subtract, difference, subtraction, intersect, intersection | |
* @authors Simon Clark | |
* @licence MIT License | |
*/ | |
const jscad = require('@jscad/modeling') | |
const { hull, hullChain } = jscad.hulls | |
const { cube, sphere, square } = jscad.primitives | |
const { translate } = jscad.transforms | |
const { colorize } = jscad.colors | |
const { union, subtract, intersect } = jscad.booleans | |
const {extrudeLinear } = jscad.extrusions | |
const main = () => { | |
const aCube = colorize([1, 0, 0], translate([-4.5, 0, 0], cube())) | |
const aSphere = colorize([0, 1, 0], translate([-5.2, -0.8, 0.8], sphere({ segments: 32 }))) | |
const s1 = translate([20, 0, 0], square({size: 1})); | |
const s2 = translate([20, 20, 0], square({size: 1})); | |
const s3 = translate([10, 10, 0], square({size: 1})); | |
const h1 = hull(s1,s2,s3) | |
const h2 = translate([5,20,10], h1); | |
const aUnion = union(aCube, aSphere) | |
const aSubtract = subtract(aCube, aSphere) | |
const aIntersection = intersect(aCube, aSphere) | |
return [ | |
s1,s2,s3, | |
h1, | |
h2, | |
translate([18, 0, 0], extrudeLinear({height: 0}, h1)), | |
translate([10, 0, 0], extrudeLinear({height: 0}, h2)), | |
//hullChain(h1,h2), | |
aCube, | |
aSphere, | |
translate([3, 0, 0], aUnion), | |
translate([6, 0, 0], aSubtract), | |
translate([10 , 0, 0], aIntersection) | |
] | |
} | |
module.exports = { main } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Basic Booleans Demonstration | |
* @category Manipulating Shapes | |
* @skillLevel 2 | |
* @description Demonstrating the basics of boolean shape combinations | |
* @tags cube, sphere, union, subtract, difference, subtraction, intersect, intersection | |
* @authors Simon Clark | |
* @licence MIT License | |
*/ | |
const jscad = require('@jscad/modeling') | |
const { hull, hullChain } = jscad.hulls | |
const { cube, sphere, square } = jscad.primitives | |
const { translate } = jscad.transforms | |
const { colorize } = jscad.colors | |
const { union, subtract, intersect } = jscad.booleans | |
const {extrudeLinear } = jscad.extrusions | |
const main = () => { | |
const aCube = colorize([1, 0, 0], translate([-4.5, 0, 0], cube())) | |
const aSphere = colorize([0, 1, 0], translate([-5.2, -0.8, 0.8], sphere({ segments: 32 }))) | |
const s1 = translate([20, 0, 0], square({size: 1})); | |
const s2 = translate([20, 20, 0], square({size: 1})); | |
const s3 = translate([10, 10, 0], square({size: 1})); | |
const h1 = hull(s1,s2,s3) | |
const h2 = translate([5,20,10], h1); | |
const aUnion = union(aCube, aSphere) | |
const aSubtract = subtract(aCube, aSphere) | |
const aIntersection = intersect(aCube, aSphere) | |
return [ | |
s1,s2,s3, | |
h1, | |
h2, | |
translate([18, 0, 0], extrudeLinear({height: 0}, h1)), | |
//Why does commenting this out change rander of h2?? | |
//translate([10, 0, 0], extrudeLinear({height: 0}, h2)), | |
aCube, | |
aSphere, | |
translate([3, 0, 0], aUnion), | |
translate([6, 0, 0], aSubtract), | |
translate([10 , 0, 0], aIntersection) | |
] | |
} | |
module.exports = { main } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment