All 2D shapes (primitives or the results of operations) can be extruded in various ways. In all cases, the function returns the results, and never changes the original shapes.
- Source:
Example
const { extrudeLinear, extrudeRectangular, extrudeRotate } = this.extrusions
Methods
(static) extrudeFromSlices(options, base) → {geom3}
Extrude a solid from the slices as returned by the callback function.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for extrude Properties
|
|||||||||||||||||||||||||||||||||||
base |
Object | the base object which is used to create slices (see the example for callback information) |
- Source:
- See:
Returns:
the extruded shape
- Type
- geom3
Example
// Parameters:
// progress : the percent complete [0..1]
// index : the index of the current slice [0..numberOfSlices - 1]
// base : the base object as given
// Return Value:
// slice or null (to skip)
const callback = (progress, index, base) => {
...
return slice
}
(static) extrudeHelical(options, geometry) → {geom3}
Perform a helical extrude of the geometry, using the given options.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for extrusion Properties
|
|||||||||||||||||||||||||||||||||||
geometry |
geom2 | the geometry to extrude |
Returns:
the extruded geometry
- Type
- geom3
Example
const myshape = extrudeHelical(
{
angle: Math.PI * 4,
pitch: 10,
segmentsPerRotation: 64
},
circle({size: 3, center: [10, 0]})
)
(static) extrudeLinear(options, …objects) → {Object|Array}
Extrude the given geometry in an upward linear direction using the given options. Accepts path2 or geom2 objects as input. Paths must be closed.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for extrude Properties
|
|||||||||||||||||||||
objects |
Object |
<repeatable> |
the geometries to extrude |
Returns:
the extruded geometry, or a list of extruded geometry
- Type
- Object | Array
Example
let myshape = extrudeLinear({height: 10}, rectangle({size: [20, 25]}))
(static) extrudeRectangular(options, …objects) → {Object|Array}
Extrude the given geometry by following the outline(s) with a rectangle.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for extrusion, if any Properties
|
||||||||||||||||
objects |
Object |
<repeatable> |
the geometries to extrude |
- Source:
- See:
-
- expand for addition options
Returns:
the extruded object, or a list of extruded objects
- Type
- Object | Array
Example
let mywalls = extrudeRectangular({size: 1, height: 3}, square({size: 20}))
let mywalls = extrudeRectangular({size: 1, height: 300, twistAngle: TAU / 2}, square({size: 20}))
(static) extrudeRotate(options, geometry) → {geom3}
Rotate extrude the given geometry using the given options.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for extrusion Properties
|
|||||||||||||||||||||||||
geometry |
geom2 | the geometry to extrude |
Returns:
the extruded geometry
- Type
- geom3
Example
const myshape = extrudeRotate({segments: 8, angle: TAU / 2}, circle({size: 3, center: [4, 0]}))
(static) project(options, …objects) → {geom2|Array}
Project the given 3D geometry on to the given plane.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for project Properties
|
||||||||||||||||
objects |
Object |
<repeatable> |
the list of 3D geometry to project |
- Source:
Returns:
the projected 2D geometry, or a list of 2D projected geometry
- Type
- geom2 | Array
Example
let myshape = project({}, sphere({radius: 20, segments: 5}))