meta data for this page
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
en:design_guide_translate [2020/11/28 02:57] JSCAD Project created |
en:design_guide_translate [2020/12/01 00:27] JSCAD Project |
||
---|---|---|---|
Line 1: | Line 1: | ||
==== Translate ==== | ==== Translate ==== | ||
- | Shapes can be translated (moved) to another location. In other words, every point in the shape is moved by a fixed distance | + | Shapes can be translated (moved) to another location. In other words, every point in the shape is moved by a fixed distance |
// | // | ||
Defaults: | Defaults: | ||
- | * offset : 0 or [0,0,0] | + | * offset : [0, 0, 0] |
<code javascript> | <code javascript> | ||
- | let obj = sphere(5) | + | let myshape |
- | obj = translate([0,0,10],obj) | + | let newshape |
</ | </ | ||
- | The CSG library functions can also be used. //NOTE: Deprecated in the V2 API// | + | In addition, there are simple versions of the same function for translating about a single axis. |
<code javascript> | <code javascript> | ||
- | obj.translate([0,0,10]) | + | let myshape = sphere([radius: 5}) |
+ | let newshape = translateX(3, myshape) | ||
+ | newshape = translateY(7, newshape) | ||
+ | newshape = translateZ(10, newshape) | ||
</ | </ | ||
- |