meta data for this page
  •  
Your (re)login has failed.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:quick_reference_transforms [2020/12/01 01:48]
JSCAD Editor
en:quick_reference_transforms [2021/04/30 08:23] (current)
JSCAD Editor
Line 5: Line 5:
 <code javascript> <code javascript>
 const { translate, scale, rotateX } = require('@jscad/modeling').transforms const { translate, scale, rotateX } = require('@jscad/modeling').transforms
-</code> 
- 
-The 'transforms' return a single shape or an array of shapes depending on the given shapes. 
- 
-<code javascript> 
-const newshape = align({modes: ['none', 'center', 'none']}, oldshape)  /* Returns a single shape */ 
-const newshapes = align({modes: ['min', 'center', 'none'], alignTo: [10, null, 10], grouped: true }, oldshape, [oldshape0, oldshape1])  /* Returns an array of new shapes*/ 
 </code> </code>
  
 ^  Transform  ^  Notes  ^ ^  Transform  ^  Notes  ^
-| const newshape = align({modes: ['min', 'center', 'none'], alignTo: [10, null, 10], grouped: true}, oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.align | API]]  | +| 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.jscad.xyz/docs/module-modeling_transforms.html#.center | 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.jscad.xyz/docs/module-modeling_transforms.html#.centerX | API]]  | +| const newshape = centerX(oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.centerX | API]]  | 
-| const newshape = centerY(oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.centerY | API]]  | +| const newshape = centerY(oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.centerY | API]]  | 
-| const newshape = centerZ(oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.centerZ | 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.jscad.xyz/docs/module-modeling_transforms.html#.mirror | 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.jscad.xyz/docs/module-modeling_transforms.html#.mirrorX | API]]  | +| const newshape = mirrorX(oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.mirrorX | API]]  | 
-| const newshape = mirrorY(oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.mirrorY | API]]  | +| const newshape = mirrorY(oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.mirrorY | API]]  | 
-| const newshape = mirrorZ(oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.mirrorZ | 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.jscad.xyz/docs/module-modeling_transforms.html#.rotate | 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.jscad.xyz/docs/module-modeling_transforms.html#.rotateX | API]]  | +| const newshape = rotateX(oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.rotateX | API]]  | 
-| const newshape = rotateY(oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.rotateY | API]]  | +| const newshape = rotateY(oldshape)  | [[https://www.openjscad.xyz/docs/module-modeling_transforms.html#.rotateY | API]]  | 
-| const newshape = rotateZ(oldshape)  | [[https://www.jscad.xyz/docs/module-modeling_transforms.html#.rotateZ | 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.jscad.xyz/docs/module-modeling_transforms.html#.scale | 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.jscad.xyz/docs/module-modeling_transforms.html#.scaleX | 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.jscad.xyz/docs/module-modeling_transforms.html#.scaleY | 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.jscad.xyz/docs/module-modeling_transforms.html#.scaleZ | 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]]  |