meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
en:design_guide_transforms [2020/11/28 02:56] JSCAD Editor created |
en:design_guide_transforms [2021/05/12 08:28] (current) JSCAD Editor |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Transforms ===== | ===== Transforms ===== | ||
| - | All shapes can be transformed, | + | All shapes can be transformed, |
| <code javascript> | <code javascript> | ||
| - | let circleA | + | const myshape |
| - | let circleB | + | const newshape |
| </ | </ | ||
| - | So, in order to modify the original, place that on the left-hand side of the expression. | + | So, in order to modify the original, place the original |
| <code javascript> | <code javascript> | ||
| - | let circleA | + | let myshape |
| - | circleA | + | myshape |
| </ | </ | ||
| Line 18: | Line 18: | ||
| <code javascript> | <code javascript> | ||
| - | let circleA | + | let myshape |
| </ | </ | ||
| - | Transforms can also be chained together. | + | Transforms can also be chained together, but keep in mind that the order of transforms is important. |
| <code javascript> | <code javascript> | ||
| - | // rotate the circle about the X axis by 45 degrees | + | let myshape |
| - | // and translate the circle up the Z axis 10 units | + | myshape = translate([0, |
| - | // and assign the result to circleB | + | |
| - | let circleB | + | |
| </ | </ | ||
| - | The original shape can be transformed any number of times. For example, the same cylinder can be rotated, making | + | The original shape can be transformed any number of times. For example, the a single |
| - | ==== Orientation ==== | + | The transforms return a single shape or an array of shapes depending on the given shapes. |
| - | 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. | + | <code javascript> |
| + | const newshape = align({modes: | ||
| + | const newshapes = align({modes: | ||
| + | </ | ||
| - | // | + | ==== 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: | ||
| {{page> | {{page> | ||
| Line 43: | Line 46: | ||
| {{page> | {{page> | ||
| + | |||
| + | {{page> | ||
| {{page> | {{page> | ||
| Line 49: | Line 54: | ||
| {{page> | {{page> | ||
| - | |||
| - | {{page> | ||