All shapes (primitives or the results of operations) can be transformed, such as scaled or rotated. In all cases, the function returns the results, and never changes the original shapes.
- Source:
Example
const { center, rotateX, translate } = this.transforms
Methods
(static) align(options, …geometries) → {Object|Array}
Align the boundaries of the given geometries using the given options.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for aligning Properties
|
|||||||||||||||||||||
geometries |
Object |
<repeatable> |
the geometries to align |
- Source:
Returns:
the aligned geometry, or a list of aligned geometries
- Type
- Object | Array
Example
let alignedGeometries = align({modes: ['min', 'center', 'none'], relativeTo: [10, null, 10], grouped: true }, geometries)
(static) center(options, …objects) → {Object|Array}
Center the given objects using the given options.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for centering Properties
|
||||||||||||||||
objects |
Object |
<repeatable> |
the objects to center |
- Source:
Returns:
the centered object, or a list of centered objects
- Type
- Object | Array
Example
let myshape = center({axes: [true,false,false]}, sphere()) // center about the X axis
(static) centerX(…objects) → {Object|Array}
Center the given objects about the X axis.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
objects |
Object |
<repeatable> |
the objects to center |
- Source:
Returns:
the centered object, or a list of centered objects
- Type
- Object | Array
(static) centerY(…objects) → {Object|Array}
Center the given objects about the Y axis.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
objects |
Object |
<repeatable> |
the objects to center |
- Source:
Returns:
the centered object, or a list of centered objects
- Type
- Object | Array
(static) centerZ(…objects) → {Object|Array}
Center the given objects about the Z axis.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
objects |
Object |
<repeatable> |
the objects to center |
- Source:
Returns:
the centered object, or a list of centered objects
- Type
- Object | Array
(static) mirror(options, …objects) → {Object|Array}
Mirror the given objects using the given options.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for mirror Properties
|
||||||||||||||||
objects |
Object |
<repeatable> |
the objects to mirror |
- Source:
Returns:
the mirrored object, or a list of mirrored objects
- Type
- Object | Array
Example
let myshape = mirror({normal: [0,0,10]}, cube({center: [0,0,15], radius: [20, 25, 5]}))
(static) mirrorX(…objects) → {Object|Array}
Mirror the given objects about the X axis.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
objects |
Object |
<repeatable> |
the objects to mirror |
- Source:
Returns:
the mirrored object, or a list of mirrored objects
- Type
- Object | Array
(static) mirrorY(…objects) → {Object|Array}
Mirror the given objects about the Y axis.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
objects |
Object |
<repeatable> |
the geometries to mirror |
- Source:
Returns:
the mirrored object, or a list of mirrored objects
- Type
- Object | Array
(static) mirrorZ(…objects) → {Object|Array}
Mirror the given objects about the Z axis.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
objects |
Object |
<repeatable> |
the geometries to mirror |
- Source:
Returns:
the mirrored object, or a list of mirrored objects
- Type
- Object | Array
(static) rotate(angles, …objects) → {Object|Array}
Rotate the given objects using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
angles |
Array | angle (RADIANS) of rotations about X, Y, and Z axis |
|
objects |
Object |
<repeatable> |
the objects to rotate |
- Source:
Returns:
the rotated object, or a list of rotated objects
- Type
- Object | Array
Example
const newsphere = rotate([TAU / 8, 0, 0], sphere())
(static) rotateX(angle, …objects) → {Object|Array}
Rotate the given objects about the X axis, using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
angle |
Number | angle (RADIANS) of rotations about X |
|
objects |
Object |
<repeatable> |
the objects to rotate |
- Source:
Returns:
the rotated object, or a list of rotated objects
- Type
- Object | Array
(static) rotateY(angle, …objects) → {Object|Array}
Rotate the given objects about the Y axis, using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
angle |
Number | angle (RADIANS) of rotations about Y |
|
objects |
Object |
<repeatable> |
the objects to rotate |
- Source:
Returns:
the rotated object, or a list of rotated objects
- Type
- Object | Array
(static) rotateZ(angle, …objects) → {Object|Array}
Rotate the given objects about the Z axis, using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
angle |
Number | angle (RADIANS) of rotations about Z |
|
objects |
Object |
<repeatable> |
the objects to rotate |
- Source:
Returns:
the rotated object, or a list of rotated objects
- Type
- Object | Array
(static) scale(factors, …objects) → {Object|Array}
Scale the given objects using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
factors |
Array | X, Y, Z factors by which to scale the objects |
|
objects |
Object |
<repeatable> |
the objects to scale |
- Source:
Returns:
the scaled object, or a list of scaled objects
- Type
- Object | Array
Example
let myshape = scale([5, 0, 10], sphere())
(static) scaleX(factor, …objects) → {Object|Array}
Scale the given objects about the X axis using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
factor |
Number | X factor by which to scale the objects |
|
objects |
Object |
<repeatable> |
the objects to scale |
- Source:
Returns:
the scaled object, or a list of scaled objects
- Type
- Object | Array
(static) scaleY(factor, …objects) → {Object|Array}
Scale the given objects about the Y axis using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
factor |
Number | Y factor by which to scale the objects |
|
objects |
Object |
<repeatable> |
the objects to scale |
- Source:
Returns:
the scaled object, or a list of scaled objects
- Type
- Object | Array
(static) scaleZ(factor, …objects) → {Object|Array}
Scale the given objects about the Z axis using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
factor |
Number | Z factor by which to scale the objects |
|
objects |
Object |
<repeatable> |
the objects to scale |
- Source:
Returns:
the scaled object, or a list of scaled objects
- Type
- Object | Array
(static) transform(matrix, …objects) → {Object|Array}
Transform the given objects using the given matrix.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
matrix |
mat4 | a transformation matrix |
|
objects |
Object |
<repeatable> |
the objects to transform |
Returns:
the transformed object, or a list of transformed objects
- Type
- Object | Array
Example
const newsphere = transform(mat4.rotateX(TAU / 8), sphere())
(static) translate(offset, …objects) → {Object|Array}
Translate the given objects using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
offset |
Array | offset (vector) of which to translate the objects |
|
objects |
Object |
<repeatable> |
the objects to translate |
Returns:
the translated object, or a list of translated objects
- Type
- Object | Array
Example
const newsphere = translate([5, 0, 10], sphere())
(static) translateX(offset, …objects) → {Object|Array}
Translate the given objects along the X axis using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
offset |
Number | X offset of which to translate the objects |
|
objects |
Object |
<repeatable> |
the objects to translate |
Returns:
the translated object, or a list of translated objects
- Type
- Object | Array
(static) translateY(offset, …objects) → {Object|Array}
Translate the given objects along the Y axis using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
offset |
Number | Y offset of which to translate the geometries |
|
objects |
Object |
<repeatable> |
the objects to translate |
Returns:
the translated object, or a list of translated objects
- Type
- Object | Array
(static) translateZ(offset, …objects) → {Object|Array}
Translate the given objects along the Z axis using the given options.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
offset |
Number | Z offset of which to translate the geometries |
|
objects |
Object |
<repeatable> |
the objects to translate |
Returns:
the translated object, or a list of translated objects
- Type
- Object | Array