meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
en:quick_reference_transforms [2020/11/28 06:24] JSCAD Editor |
en:quick_reference_transforms [2021/04/30 08:23] (current) JSCAD Editor |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ^ Transform | ^ Transform | ||
| - | | const newshape = align({}, oldshape) | + | | const newshape = align({modes: [' |
| - | | const newshapes | + | | const newshape |
| + | | const newshape = centerX(oldshape) | ||
| + | | const newshape = centerY(oldshape) | ||
| + | | const newshape = centerZ(oldshape) | ||
| + | | const newshape = mirror({origin: | ||
| + | | const newshape = mirrorX(oldshape) | ||
| + | | const newshape = mirrorY(oldshape) | ||
| + | | const newshape = mirrorZ(oldshape) | ||
| + | | const newshape = rotate([Math.PI / 4, 0, 0], oldshape) | ||
| + | | const newshape = rotateX(oldshape) | ||
| + | | const newshape = rotateY(oldshape) | ||
| + | | const newshape = rotateZ(oldshape) | ||
| + | | const newshape = scale([5, 0, 10], oldshape) | ||
| + | | const newshape = scaleX(5, oldshape) | ||
| + | | const newshape = scaleY(0.5, oldshape) | ||
| + | | const newshape = scaleZ(5, oldshape) | ||
| + | | const newshape = transform(mat4.rotateX(Math.PI/ | ||
| + | | const newshape = translate([5, | ||
| + | | const newshape = translateX(5, | ||
| + | | const newshape = translateY(0.5, | ||
| + | | const newshape = translateZ(5, | ||
| - | ^ 2D Transformations | ||
| - | | 2Dshape = 2Dshape.translate([-2, | ||
| - | | 2Dshape = 2Dshape.rotateZ(20); | ||
| - | | ::: | 3Dshape = 3Dshape.rotateY(-180); | ||
| - | | ::: | 3Dshape = 3Dshape.rotateZ(45); | ||
| - | | 2Dshape = 2Dshape.rotate(center, | ||
| - | | 2Dshape = 2Dshape.rotateEulerAngles(alpha, | ||
| - | | 2Dshape = 2Dshape.scale([0.7, | ||
| - | | 2Dshape = 2Dshape.center([true, | ||
| - | | 2Dshape = 2Dshape.mirroredX(); | ||
| - | | 2Dshape = 2Dshape.mirroredY(); | ||
| - | | ::: | 3Dshape = 3Dshape.mirroredZ(); | ||
| - | | 2Dshape = 2Dshape.mirrored(plane); | ||
| - | | 2Dshape = 2Dshape.transform(matrix); | ||
| - | | **/* not supported yet */** | 3Dshape = 3Dshape.setColor(r, | ||
| - | | ::: | 3Dshape = 3Dshape.setColor(r, | ||
| - | | ::: | 3Dshape = 3Dshape.setColor([r, | ||
| - | | ::: | 3Dshape = 3Dshape.setColor([r, | ||
| - | | 2Dshape = 2Dshape.expand(0.2, | ||
| - | | 2Dshape = 2Dshape.contract(0.2, | ||
| - | |||
| - | //Note: Shape transformations can be chained together. Example:// | ||
| - | |||
| - | **var 3Dshape = CSG.cube().rotate(45).translate([20, | ||