meta data for this page
  •  

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:design_guide_transforms [2020/12/01 01:53]
JSCAD Editor
en:design_guide_transforms [2021/05/12 08:28] (current)
JSCAD Editor
Line 4: Line 4:
  
 <code javascript> <code javascript>
-let circleA = circle({radius: 5}) +const myshape = circle({radius: 5}) 
-let circleB = scale([5, 10], circleA) // a new cicle, scaled as requested+const newshape = scale([5, 10], circleA) // a new cicle, scaled as requested
 </code> </code>
  
Line 11: Line 11:
  
 <code javascript> <code javascript>
-let circleA = circle({radius: 5}) +let myshape = circle({radius: 5}) 
-circleA = scale([5,10], circleA) // a new circle, scaled as requested, reassigned to the original+myshape = scale([5, 10], myshape) // a new circle, scaled as requested, reassigned to the original
 </code> </code>
  
Line 18: Line 18:
  
 <code javascript> <code javascript>
-let circleA = scale([5, 10]). circle({radius: 5})) // a new circle, and scaled as requested+let myshape = scale([5, 10]). circle({radius: 5})) // a new circle, and scaled as requested
 </code> </code>
  
Line 24: Line 24:
  
 <code javascript> <code javascript>
-// rotate the circle about the X axis by 45 degrees +let myshape = scale([5, 10]). circle({radius: 5})) 
-// and translate the circle up the Z axis 10 units +myshape = translate([0, 0, 10]), rotateX(45, myshape))
-// and assign the result to circleB +
-let circleB = translate([0, 0, 10]), rotateX(45, circleA))+
 </code> </code>
  
-The original shape can be transformed any number of times. For example, the same cylinder can be rotated, making copies of the cylinders, and then unioned together. This is a common pattern when creating complex designs.+The original shape can be transformed any number of times. For example, the a single cylinder can be rotated and translated to make multiple copies of the original. And then, the set of cylinders can be combined together using union. This is a common pattern when creating complex designs.
  
 The transforms return a single shape or an array of shapes depending on the given shapes. The transforms return a single shape or an array of shapes depending on the given shapes.
Line 41: Line 39:
 ==== Orientation ==== ==== Orientation ====
  
-The standard for all 3D systems today, including graphics cards, design tools, etc. is orientating shapes using the right-hand rule. JSCAD follows the same rules internally, and produces shapes, applies transforms, etc. using the right-hand rule of orientation. +The standard for all 3D systems today, including graphics cards, design tools, etc. is orientating shapes using the right-hand rule. JSCAD follows the same rules internally, and produces shapes, applies transforms, etc. using the right-hand rule of orientation. See [[en:math_guide_orientation|Orientation]] for more information.
- +
-//[[https://en.wikipedia.org/wiki/Right-hand_rule|Learn about the right-hand rule at Wikipedia.org]]//+
  
 {{page>design_guide_rotate}} {{page>design_guide_rotate}}
Line 50: Line 46:
  
 {{page>design_guide_translate}} {{page>design_guide_translate}}
 +
 +{{page>design_guide_align}}
  
 {{page>design_guide_center}} {{page>design_guide_center}}