Class: Solid

Solid()

Class representing a factory for various simple solid objects.

Constructor

new Solid()

Source:

Extends

Members

dv :number

Nominal step-count for parametric curves and surfaces.
Type:
  • number
Inherited From:
Source:

Methods

block(wopt, hopt, dopt) → {Array.<Geometry>}

Generate a block (a cuboid.)
Parameters:
Name Type Attributes Default Description
w number <optional>
1 width
h number <optional>
height
d number <optional>
depth
Source:
Returns:
Type
Array.<Geometry>

cone(ropt, hopt) → {Array.<Geometry>}

Generate a solid cone.
Parameters:
Name Type Attributes Default Description
r number <optional>
1 radius
h number <optional>
1 height
Source:
Returns:
Type
Array.<Geometry>

dupe() → {this}

Get a new duplicate transformed Coords object.
Inherited From:
Source:
Returns:
Type
this

extrusion(fopt, topt, hopt) → {Array.<Geometry>}

Generate the surface of an extruded convex polygon. The polygon is drawn in the x-y plane, and extruded along the z-axis. The default parameters draw a unit cube.
Parameters:
Name Type Attributes Default Description
f function <optional>
parameterized cross-section f(t) = [x, y]
t Array.<number> <optional>
[start, end, step] for the cross-section parameterization
h number <optional>
1 extrusion height
Source:
Returns:
Type
Array.<Geometry>

orient(v) → {Array.<number>}

Apply current un-translated coordinate transform to vector v.
Parameters:
Name Type Description
v Array.<number>
Inherited From:
Source:
Returns:
Type
Array.<number>

polygonExtrusion(ptsopt, hopt) → {Array.<Geometry>}

Generate the surface of an extruded convex polygon. The polygon is drawn in the x-y plane, and extruded along the z-axis. The default parameters draw a unit cube.
Parameters:
Name Type Attributes Default Description
pts Array.<Array.<number>> <optional>
2D polygon vertices (must enclose the origin "convex-ly")
h number <optional>
1 extrusion height
Source:
Returns:
Type
Array.<Geometry>

quaternion(q) → {this}

Rotate by a quaternion
Parameters:
Name Type Description
q Array.<number> a quaternion
Inherited From:
Source:
Returns:
Type
this

resetTransform() → {this}

Inherited From:
Source:
Returns:
Type
this

rod(ropt, hopt) → {Array.<Geometry>}

Generate a rod (a solid cylinder, with ends.)
Parameters:
Name Type Attributes Default Description
r number <optional>
1 radius
h number <optional>
1 height
Source:
Returns:
Type
Array.<Geometry>

rotate(angleopt, axisopt) → {this}

Parameters:
Name Type Attributes Default Description
angle number <optional>
0
axis number | Array.<number> <optional>
0 either an axis index (0, 1, 2) or an axis vector
Inherited From:
Source:
Returns:
Type
this

rotateTo(srcAxis, dstAxis)

Rotate so that srcAxis goes into dstAxis.
Parameters:
Name Type Description
srcAxis Array.<number>
dstAxis Array.<number>
Inherited From:
Source:

scale(sopt) → {this}

Parameters:
Name Type Attributes Default Description
s number <optional>
1
Inherited From:
Source:
Returns:
Type
this

sphere(ropt) → {Array.<Geometry>}

Generate a sphere with cubic tesselation.
Parameters:
Name Type Attributes Default Description
r number <optional>
1 radius
Source:
Returns:
Type
Array.<Geometry>

stretch(xopt, yopt, zopt) → {this}

Parameters:
Name Type Attributes Default Description
x number <optional>
1
y number <optional>
1
z number <optional>
1
Inherited From:
Source:
Returns:
Type
this

torus(r1opt, r2opt) → {Array.<Geometry>}

Generate a regular torus.
Parameters:
Name Type Attributes Default Description
r1 number <optional>
2 primary radius
r2 number <optional>
1 secondary radius
Source:
Returns:
Type
Array.<Geometry>

transform(v) → {Array.<number>}

Apply current coordinate transform to vector v.
Parameters:
Name Type Description
v Array.<number>
Inherited From:
Source:
Returns:
Type
Array.<number>

translate(xopt, yopt, zopt) → {this}

Parameters:
Name Type Attributes Default Description
x number <optional>
0
y number <optional>
0
z number <optional>
0
Inherited From:
Source:
Returns:
Type
this

volume(fopt, uopt, vopt, wopt) → {Array.<Geometry>}

Generate the surface of a general parametric volume. The default arguments produce a properly oriented unit cube. If drawing "single-sided", note that the function f naturally parameterizes the interior of the volume, oriented with right-hand-rule, so the "upward-facing" normals to the surface g(u, v) = f(u, v, k) are outward-facing when k = w[1] (not k = w[0]).
Parameters:
Name Type Attributes Description
f function <optional>
parameterization of the volume
u Array.<number> <optional>
[start, end, step] for u parameter (default [0, 1, 1])
v Array.<number> <optional>
[start, end, step] for v parameter (default [0, 1, 1])
w Array.<number> <optional>
[start, end, step] for w parameter (default [0, 1, 1])
Source:
Returns:
Type
Array.<Geometry>