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
en:design_guide_rotate [2020/12/08 06:51]
JSCAD Project
en:design_guide_rotate [2022/04/16 04:23] (current)
Andreas Rozek included "require" statements, corrected mistakes
Line 9: Line 9:
  
 <code javascript> <code javascript>
 +const { cuboid } = require('@jscad/modeling').primitives
 +const { rotate } = require('@jscad/modeling').transforms
 +
 const myshape = cuboid({size: [5, 20, 5]}) const myshape = cuboid({size: [5, 20, 5]})
 const newshape = rotate([(Math.PI * 2 / 4), (Math.PI * 2 / 24), (Math.PI * 2 / 12)], myshape) const newshape = rotate([(Math.PI * 2 / 4), (Math.PI * 2 / 24), (Math.PI * 2 / 12)], myshape)
Line 16: Line 19:
  
 <code javascript> <code javascript>
 +const { cuboid } = require('@jscad/modeling').primitives
 +const { rotateX,rotateY,rotateZ } = require('@jscad/modeling').transforms
 +
 const myshape = cuboid({size: [5, 20, 5]}) const myshape = cuboid({size: [5, 20, 5]})
 let newshape = rotateX((Math.PI * 2 / 4), myshape) let newshape = rotateX((Math.PI * 2 / 4), myshape)
Line 25: Line 31:
  
 <code javascript> <code javascript>
-const newshape = rotate([degreeToRad(90), degreeToRad(15), degreeToRad(30)], myshape) +const { cuboid } = require('@jscad/modeling').primitives 
-const newshape = rotateX(degreeToRad(90), myshape)+const { rotateX,rotate } = require('@jscad/modeling').transforms 
 +const { degToRad } = require('@jscad/modeling').utils 
 + 
 +const myshape = cuboid({size: [5, 20, 5]}) 
 +const newshape = rotate([degToRad(90), degToRad(15), degToRad(30)], myshape) 
 +const newshape = rotateX(degToRad(90), myshape)
 </code> </code>