===== Shape Transformations ===== The 'transforms' are accessed through the modeling API using the following: const { translate, scale, rotateX } = require('@jscad/modeling').transforms ^ Transform ^ Notes ^ | const newshape = align({modes: ['min', 'center', 'none'], relativeTo: [10, null, 10], grouped: true}, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.align | API]] | | const newshape = center({axes: [true, true, false], center: [15, 10, 0]}, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.center | API]] | | const newshape = centerX(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.centerX | API]] | | const newshape = centerY(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.centerY | API]] | | const newshape = centerZ(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.centerZ | API]] | | const newshape = mirror({origin: [5, 5, 5], normal: [0, 0, 10]}, oldshape)) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.mirror | API]] | | const newshape = mirrorX(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.mirrorX | API]] | | const newshape = mirrorY(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.mirrorY | API]] | | const newshape = mirrorZ(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.mirrorZ | API]] | | const newshape = rotate([Math.PI / 4, 0, 0], oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.rotate | API]] | | const newshape = rotateX(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.rotateX | API]] | | const newshape = rotateY(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.rotateY | API]] | | const newshape = rotateZ(oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.rotateZ | API]] | | const newshape = scale([5, 0, 10], oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.scale | API]] | | const newshape = scaleX(5, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.scaleX | API]] | | const newshape = scaleY(0.5, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.scaleY | API]] | | const newshape = scaleZ(5, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.scaleZ | API]] | | const newshape = transform(mat4.rotateX(Math.PI/4), oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.transform | API]] | | const newshape = translate([5, 0, 10], oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.translate | API]] | | const newshape = translateX(5, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.translateX | API]] | | const newshape = translateY(0.5, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.translateY | API]] | | const newshape = translateZ(5, oldshape) | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.translateZ | API]] |