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:design_guide_rotate [2020/12/01 00:07] JSCAD Editor |
en:design_guide_rotate [2022/04/16 04:23] (current) rozek included "require" statements, corrected mistakes |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Rotate ==== | ==== Rotate ==== | ||
| - | Shapes can be rotated by any given angle about the X, Y, and Z axis. The angles can be specified as either positive or negative values, in RADIANS. | + | Shapes can be rotated by any given angle about the X, Y, and Z axis. The '' |
| // | // | ||
| Line 9: | Line 9: | ||
| <code javascript> | <code javascript> | ||
| - | let myshape = cuboid({size: | + | const { cuboid } = require(' |
| - | let newshape = rotate([(PI * 2 / 4), (PI * 2 / 24), (PI * 2 / 12)], myshape) | + | const { rotate } = require(' |
| + | |||
| + | const myshape = cuboid({size: | ||
| + | const newshape = rotate([(Math.PI * 2 / 4), (Math.PI * 2 / 24), (Math.PI * 2 / 12)], myshape) | ||
| + | </ | ||
| + | |||
| + | In addition, there are simple versions of the same function for rotating about a single axis. | ||
| + | |||
| + | <code javascript> | ||
| + | const { cuboid } = require(' | ||
| + | const { rotateX, | ||
| + | |||
| + | const myshape = cuboid({size: | ||
| + | let newshape = rotateX((Math.PI * 2 / 4), myshape) | ||
| + | newshape = rotateY((Math.PI * 2 / 24), newshape) | ||
| + | newshape = rotateZ((Math.PI * 2 / 12), newshape) | ||
| + | </ | ||
| + | |||
| + | There is a [[en: | ||
| + | |||
| + | <code javascript> | ||
| + | const { cuboid } = require(' | ||
| + | const { rotateX, | ||
| + | const { degToRad } = require(' | ||
| + | |||
| + | const myshape = cuboid({size: | ||
| + | const newshape = rotate([degToRad(90), | ||
| + | const newshape = rotateX(degToRad(90), myshape) | ||
| </ | </ | ||
| - | //Note: There is a [[en: | ||