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_center [2020/12/04 08:26] JSCAD Editor |
en:design_guide_center [2021/11/07 07:33] (current) JSCAD Editor |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Center ==== | ==== Center ==== | ||
| - | Shapes can be centered about the X, Y or Z axis, or centered | + | Shapes can be centered about the X, Y or Z axis, or centered |
| //Note: The center of a shape is calculated as the midpoint between minimum and maximum points.// | //Note: The center of a shape is calculated as the midpoint between minimum and maximum points.// | ||
| Line 7: | Line 7: | ||
| Defaults: | Defaults: | ||
| * axes : [true, true, true] | * axes : [true, true, true] | ||
| - | * center | + | * relativeTo |
| <code javascript> | <code javascript> | ||
| - | let myshape = sphere({radius: | + | const myshape = sphere({radius: |
| let newshape = center({}, myshape) | let newshape = center({}, myshape) | ||
| newshape = center({axes: | newshape = center({axes: | ||
| - | newshape = center({center: [5, 6, 7]}, myshape) | + | newshape = center({relativeTo: [5, 6, 7]}, myshape) |
| </ | </ | ||
| - | There are also simple versions of this function to center | + | There are also simple versions of this function to center |
| <code javascript> | <code javascript> | ||
| - | let myshape = sphere({radius: | + | const myshape = sphere({radius: |
| let newshape = centerX(myshape) | let newshape = centerX(myshape) | ||
| newshape = centerY(newshape) | newshape = centerY(newshape) | ||
| newshape = centerZ(newshape) | newshape = centerZ(newshape) | ||
| </ | </ | ||