meta data for this page
  •  

Differences

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

Link to this comparison view

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 (reflectabout the X, Y, or Z axis, and more specifically about any ''origin''.
  
 //[[http://www.mathsisfun.com/geometry/reflection.html|Learn about reflection at MathIsFun.com]]// //[[http://www.mathsisfun.com/geometry/reflection.html|Learn about reflection at MathIsFun.com]]//
  
 Defaults: Defaults:
-  * axis 0 or [0, 0, 0], set to reflect about X, Y, or Z axis+  * origin : [0, 0, 0] 
 +  * normal : [0, 0, 1] (mirror about the Z axis)
  
 <code javascript> <code javascript>
-let obj = cube([5, 20, 5]) +const myshape = cube({size: [5, 20, 5]}
-obj = mirror([1, 0, 1], obj// mirror about X and Z axis+const newshape = mirror({origin: 3, 3, 3], normal: [1, 0, 1]}myshape)
 </code> </code>
  
-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 = cube({size: [5205]}
- +let newshape mirrorX(myshape
-var cube2 cube.mirroredX() // mirrored about the X axis +newshape mirrorY(newshape
-var cube3 cube.mirroredY() // mirrored about the Y axis +newshape mirrorZ(newshape)
-var cube4 cube.mirroredZ() // mirrored about the Z axis +
- +
-// create a plane by specifying 3 points: +
-var plane = CSG.Plane.fromPoints([5,0,0], [5, 1, 0], [3, 1, 7]); +
- +
-// and mirror in that plane: +
-var cube5 = cube.mirrored(plane);+
 </code> </code>
-