meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
en:design_guide_mirror [2020/11/28 02:58] JSCAD Editor created |
en:design_guide_mirror [2020/12/08 06:53] (current) JSCAD Editor |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Mirror ==== | ==== Mirror ==== | ||
| - | Shapes can reflect about the X, Y, or Z axis. | + | Shapes can mirror (reflect) about the X, Y, or Z axis, and more specifically about any '' |
| // | // | ||
| Defaults: | Defaults: | ||
| - | * axis : 0 or [0, 0, 0], set 1 to reflect | + | * origin |
| + | * normal : [0, 0, 1] (mirror | ||
| <code javascript> | <code javascript> | ||
| - | let obj = cube([5, 20, 5]) | + | const myshape |
| - | obj = mirror([1, 0, 1], obj) // mirror about X and Z axis | + | const newshape |
| </ | </ | ||
| - | The CSG library functions can also be used. //NOTE: Deprecated in the V2 API// | + | There are simple versions of this function to mirror a single axis about the origin. |
| <code javascript> | <code javascript> | ||
| - | var cube = CSG.cube().translate([1,0,0]) | + | const myshape |
| - | + | let newshape | |
| - | var cube2 = cube.mirroredX() // mirrored about the X axis | + | newshape |
| - | var cube3 = cube.mirroredY() // mirrored about the Y axis | + | newshape |
| - | var cube4 = cube.mirroredZ() // mirrored about the Z axis | + | |
| - | + | ||
| - | // create a plane by specifying 3 points: | + | |
| - | var plane = CSG.Plane.fromPoints([5, | + | |
| - | + | ||
| - | // and mirror in that plane: | + | |
| - | var cube5 = cube.mirrored(plane); | + | |
| </ | </ | ||
| - | |||