Skip to main content

geometries

Modules

ModuleDescription
modeling/geometries/geom2Represents a 2D geometry consisting of a list of sides.
modeling/geometries/geom3Represents a 3D geometry consisting of a list of polygons.
modeling/geometriesGeometries are objects that represent the contents of primitives or the results of operations. Note: Geometries are considered immutable, so never change the contents directly.
modeling/geometries/path2Represents a 2D geometry consisting of a list of ordered points.
modeling/geometries/poly2Represents a 2D polygon consisting of a list of ordered vertices.
modeling/geometries/poly3Represents a convex 3D polygon consisting of a list of ordered vertices.

Typedefs

NameDescription
geom2Represents a 2D geometry consisting of a list of sides.
geom3Represents a 3D geometry consisting of a list of polygons.
path2Represents a 2D geometry consisting of a list of ordered points.
poly2Represents a convex 2D polygon consisting of a list of ordered vertices.
poly3Represents a convex 3D polygon. The vertices used to initialize a polygon must be coplanar and form a convex shape. The vertices do not have to be vec3 instances but they must behave similarly.

modeling/geometries/geom2

Represents a 2D geometry consisting of a list of sides.

See: geom2 for data structure information.
Example

colorize([0.5,0,1,1], square()) // purple square

Example

{
"sides": [[[-1,1],[-1,-1]],[[-1,-1],[1,-1]],[[1,-1],[1,1]],[[1,1],[-1,1]]],
"transforms": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"color": [0.5,0,1,1]
}

modeling/geometries/geom2.clone(geometry)

Performs a shallow clone of the given geometry.

Kind: static method of modeling/geometries/geom2
Returns: geom2 - new geometry

ParamTypeDescription
geometrygeom2the geometry to clone

modeling/geometries/geom2.create([sides])

Create a new 2D geometry composed of unordered sides (two connected points).

Kind: static method of modeling/geometries/geom2
Returns: geom2 - a new geometry

ParamTypeDescription
[sides]Arraylist of sides where each side is an array of two points

modeling/geometries/geom2.fromCompactBinary(data)

Create a new 2D geometry from the given compact binary data.

Kind: static method of modeling/geometries/geom2
Returns: geom2 - a new geometry

ParamTypeDescription
dataArraycompact binary data

modeling/geometries/geom2.fromPoints(points)

Create a new 2D geometry from the given points. The direction (rotation) of the points is not relevant, as the points can define a convex or a concave polygon. The geometry must not self intersect, i.e. the sides cannot cross.

Kind: static method of modeling/geometries/geom2
Returns: geom2 - a new geometry

ParamTypeDescription
pointsArraylist of points in 2D space

modeling/geometries/geom2.isA(object)

Determine if the given object is a 2D geometry.

Kind: static method of modeling/geometries/geom2
Returns: Boolean - true, if the object matches a geom2 based object

ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries/geom2.reverse(geometry)

Reverses the given geometry so that the sides are flipped in the opposite order. This swaps the left (interior) and right (exterior) edges.

Kind: static method of modeling/geometries/geom2
Returns: geom2 - the new reversed geometry

ParamTypeDescription
geometrygeom2the geometry to reverse

Example

let newgeometry = reverse(geometry)

modeling/geometries/geom2.toCompactBinary(geometry)

Produces a compact binary representation from the given geometry.

Kind: static method of modeling/geometries/geom2
Returns: TypedArray - compact binary representation

ParamTypeDescription
geometrygeom2the geometry

modeling/geometries/geom2.toOutlines(geometry)

Create the outline(s) of the given geometry.

Kind: static method of modeling/geometries/geom2
Returns: Array - an array of outlines, where each outline is an array of ordered points

ParamTypeDescription
geometrygeom2geometry to create outlines from

Example

let geometry = subtract(rectangle({size: [5, 5]}), rectangle({size: [3, 3]}))
let outlines = toOutlines(geometry) // returns two outlines

modeling/geometries/geom2.toPoints(geometry)

Produces an array of points from the given geometry. The returned array should not be modified as the points are shared with the geometry. NOTE: The points returned do NOT define an order. Use toOutlines() for ordered points.

Kind: static method of modeling/geometries/geom2
Returns: Array - an array of points

ParamTypeDescription
geometrygeom2the geometry

Example

let sharedpoints = toPoints(geometry)

modeling/geometries/geom2.toSides(geometry)

Produces an array of sides from the given geometry. The returned array should not be modified as the data is shared with the geometry. NOTE: The sides returned do NOT define an order. Use toOutlines() for ordered points.

Kind: static method of modeling/geometries/geom2
Returns: Array - an array of sides

ParamTypeDescription
geometrygeom2the geometry

Example

let sharedsides = toSides(geometry)

modeling/geometries/geom2.toString(geometry)

Create a string representing the contents of the given geometry.

Kind: static method of modeling/geometries/geom2
Returns: String - a representative string

ParamTypeDescription
geometrygeom2the geometry

Example

console.out(toString(geometry))

modeling/geometries/geom2.transform(matrix, geometry)

Transform the given geometry using the given matrix. This is a lazy transform of the sides, as this function only adjusts the transforms. The transforms are applied when accessing the sides via toSides().

Kind: static method of modeling/geometries/geom2
Returns: geom2 - a new geometry

ParamTypeDescription
matrixmat4the matrix to transform with
geometrygeom2the geometry to transform

Example

let newgeometry = transform(fromZRotation(degToRad(90)), geometry)

modeling/geometries/geom2.validate(object)

Determine if the given object is a valid geom2. Checks for closedness, self-edges, and valid data points.

If the geometry is not valid, an exception will be thrown with details of the geometry error.

Kind: static method of modeling/geometries/geom2
Throws:

  • Error error if the geometry is not valid
ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries/geom3

Represents a 3D geometry consisting of a list of polygons.

See: geom3 for data structure information.
Example

colorize([0,0.5,1,0.6], cube()) // transparent ice cube

Example

{
"polygons": [
{"vertices": [[-1,-1,-1], [-1,-1,1], [-1,1,1], [-1,1,-1]]},
{"vertices": [[1,-1,-1], [1,1,-1], [1,1,1], [1,-1,1]]},
{"vertices": [[-1,-1,-1], [1,-1,-1], [1,-1,1], [-1,-1,1]]},
{"vertices": [[-1,1,-1], [-1,1,1], [1,1,1], [1,1,-1]]},
{"vertices": [[-1,-1,-1], [-1,1,-1], [1,1,-1], [1,-1,-1]]},
{"vertices": [[-1,-1,1], [1,-1,1], [1,1,1], [-1,1,1]]}
],
"transforms": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"color": [0,0.5,1,0.6]
}

modeling/geometries/geom3.clone(geometry)

Performs a shallow clone of the given geometry.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
geometrygeom3the geometry to clone

modeling/geometries/geom3.create([polygons])

Create a new 3D geometry composed of the given polygons.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
[polygons]Arraylist of polygons, or undefined

modeling/geometries/geom3.fromCompactBinary(data)

Construct a new 3D geometry from the given compact binary data.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
dataTypedArraycompact binary data

modeling/geometries/geom3.fromPoints(listofpoints)

Construct a new 3D geometry from a list of points. The list of points should contain sub-arrays, each defining a single polygon of points. In addition, the points should follow the right-hand rule for rotation in order to define an external facing polygon.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
listofpointsArraylist of lists, where each list is a set of points to construct a polygon

modeling/geometries/geom3.fromPointsConvex(uniquePoints)

Construct a new convex 3D geometry from a list of unique points.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
uniquePointsArraylist of points to construct convex 3D geometry

modeling/geometries/geom3.invert(geometry)

Invert the given geometry, transposing solid and empty space.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
geometrygeom3the geometry to invert

modeling/geometries/geom3.isA(object)

Determine if the given object is a 3D geometry.

Kind: static method of modeling/geometries/geom3
Returns: Boolean - true if the object matches a geom3

ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries/geom3.isConvex(geometry)

Test if a 3D geometry is convex.

A polyhedron is convex if every vertex lies on or behind every face plane (i.e., on the interior side of the plane).

Kind: static method of modeling/geometries/geom3
Returns: boolean - true if the geometry is convex

ParamTypeDescription
geometrygeom3the geometry to test

Example

const { geom3, primitives } = require('@jscad/modeling')
const cube = primitives.cuboid({ size: [10, 10, 10] })
console.log(geom3.isConvex(cube)) // true

modeling/geometries/geom3.toCompactBinary(geometry)

Return the given geometry in compact binary representation.

Kind: static method of modeling/geometries/geom3
Returns: TypedArray - compact binary representation

ParamTypeDescription
geometrygeom3the geometry

modeling/geometries/geom3.toPoints(geometry)

Return the given geometry as a list of points, after applying transforms. The returned array should not be modified as the points are shared with the geometry.

Kind: static method of modeling/geometries/geom3
Returns: Array - list of points, where each sub-array represents a polygon

ParamTypeDescription
geometrygeom3the geometry

modeling/geometries/geom3.toPolygons(geometry)

Produces an array of polygons from the given geometry, after applying transforms. The returned array should not be modified as the polygons are shared with the geometry.

Kind: static method of modeling/geometries/geom3
Returns: Array - an array of polygons

ParamTypeDescription
geometrygeom3the geometry

Example

let sharedpolygons = toPolygons(geometry)

modeling/geometries/geom3.toString(geometry)

Create a string representing the contents of the given geometry.

Kind: static method of modeling/geometries/geom3
Returns: String - a representative string

ParamTypeDescription
geometrygeom3the geometry

Example

console.out(toString(geometry))

modeling/geometries/geom3.transform(matrix, geometry)

Transform the given geometry using the given matrix. This is a lazy transform of the polygons, as this function only adjusts the transforms. See applyTransforms() for the actual application of the transforms to the polygons.

Kind: static method of modeling/geometries/geom3
Returns: geom3 - a new geometry

ParamTypeDescription
matrixmat4the matrix to transform with
geometrygeom3the geometry to transform

Example

let newgeometry = transform(fromXRotation(degToRad(90)), geometry)

modeling/geometries/geom3.validate(object)

Determine if the given object is a valid 3D geometry. Checks for valid data structure, convex polygon faces, and manifold edges.

If the geometry is not valid, an exception will be thrown with details of the geometry error.

Kind: static method of modeling/geometries/geom3
Throws:

  • Error error if the geometry is not valid
ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries

Geometries are objects that represent the contents of primitives or the results of operations. Note: Geometries are considered immutable, so never change the contents directly.

See

  • geom2 - 2D geometry consisting of sides
  • geom3 - 3D geometry consisting of polygons
  • path2 - 2D geometry consisting of ordered points
  • poly2 - 2D polygon consisting of ordered vertices
  • poly3 - 3D polygon consisting of ordered vertices

Example

const { geom2, geom3, path2, poly2, poly3 } = require('@jscad/modeling').geometries

modeling/geometries/path2

Represents a 2D geometry consisting of a list of ordered points.

See: path2 for data structure information.
Example

colorize([0,0,0,1], path2.fromPoints({ closed: true }, [[0,0], [4,0], [4,3]]))

Example

{
"points": [[0,0], [4,0], [4,3]],
"isClosed": true,
"transforms": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"color": [0,0,0,1]
}

modeling/geometries/path2.appendArc(options, geometry)

Append a series of points to the given geometry that represent an arc. This implementation follows the SVG specifications.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path with the appended points
See: http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands

ParamTypeDefaultDescription
optionsObjectoptions for construction
options.endpointvec2end point of arc (REQUIRED)
[options.radius]vec2[0,0]radius of arc (X and Y)
[options.xaxisrotation]Number0rotation (RADIANS) of the X axis of the arc with respect to the X axis of the coordinate system
[options.clockwise]Booleanfalsedraw an arc clockwise with respect to the center point
[options.large]Booleanfalsedraw an arc longer than TAU / 2 radians
[options.segments]Number16number of segments per full rotation
geometrypath2the path of which to append the arc

Example

let p1 = path2.fromPoints({}, [[27.5,-22.96875]]);
p1 = path2.appendPoints([[27.5,-3.28125]], p1);
p1 = path2.appendArc({endpoint: [12.5, -22.96875], radius: [15, -19.6875]}, p1);

modeling/geometries/path2.appendBezier(options, geometry)

Append a series of points to the given geometry that represent a Bezier curve. The Bézier curve starts at the last point in the given geometry, and ends at the last control point. The other control points are intermediate control points to transition the curve from start to end points. The first control point may be null to ensure a smooth transition occurs. In this case, the second to last point of the given geometry is mirrored into the control points of the Bezier curve. In other words, the trailing gradient of the geometry matches the new gradient of the curve.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path with the appended points

ParamTypeDefaultDescription
optionsObjectoptions for construction
options.controlPointsArraylist of control points (2D) for the bezier curve
[options.segment]Number16number of segments per 360 rotation
geometrypath2the path of which to appended points

Example

let p5 = path2.create({}, [[10,-20]])
p5 = path2.appendBezier({controlPoints: [[10,-10],[25,-10],[25,-20]]}, p5);
p5 = path2.appendBezier({controlPoints: [null, [25,-30],[40,-30],[40,-20]]}, p5)

modeling/geometries/path2.appendPoints(points, geometry)

Append the given list of points to the end of the given geometry.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path with the appended points

ParamTypeDescription
pointsArraythe points (2D) to append to the given path
geometrypath2the given path

Example

let newpath = appendPoints([[3, 4], [4, 5]], oldpath)

modeling/geometries/path2.clone(geometry)

Performs a shallow clone of the give geometry.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path

ParamTypeDescription
geometrypath2the geometry to clone

modeling/geometries/path2.close(geometry)

Close the given geometry.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path

ParamTypeDescription
geometrypath2the path to close

modeling/geometries/path2.concat(...paths)

Concatenate the given paths.

If both contain the same point at the junction, merge it into one. A concatenation of zero paths is an empty, open path. A concatenation of one closed path to a series of open paths produces a closed path. A concatenation of a path to a closed path is an error.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path

ParamTypeDescription
...pathspath2the paths to concatenate

Example

let newpath = concat(fromPoints({}, [[1, 2]]), fromPoints({}, [[3, 4]]))

modeling/geometries/path2.create()

Create an empty, open path.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path
Example

let newpath = create()

modeling/geometries/path2.equals(a, b)

Determine if the given paths are equal. For closed paths, this includes equality under point order rotation.

Kind: static method of modeling/geometries/path2

ParamTypeDescription
apath2the first path to compare
bpath2the second path to compare

modeling/geometries/path2.fromCompactBinary(data)

Create a new path from the given compact binary data.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path

ParamTypeDescription
dataTypedArraycompact binary data

modeling/geometries/path2.fromPoints(options, points)

Create a new path from the given points. The points must be provided an array of points, where each point is an array of two numbers.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path
Example:: my newpath = fromPoints({closed: true}, [[10, 10], [-10, 10]])

ParamTypeDefaultDescription
optionsObjectoptions for construction
[options.closed]Booleanfalseif the path should be open or closed
pointsArrayarray of points (2D) from which to create the path

modeling/geometries/path2.isA(object)

Determine if the given object is a path2 geometry.

Kind: static method of modeling/geometries/path2
Returns: Boolean - true if the object matches a path2

ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries/path2.reverse(geometry)

Reverses the path so that the points are in the opposite order. This swaps the left (interior) and right (exterior) edges.

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path

ParamTypeDescription
geometrypath2the path to reverse

Example

let newpath = reverse(mypath)

modeling/geometries/path2.toCompactBinary(geometry)

Produce a compact binary representation from the given path.

Kind: static method of modeling/geometries/path2
Returns: TypedArray - compact binary representation

ParamTypeDescription
geometrypath2the path geometry

modeling/geometries/path2.toPoints(geometry)

Produces an array of points from the given geometry. The returned array should not be modified as the data is shared with the geometry.

Kind: static method of modeling/geometries/path2
Returns: Array - an array of points

ParamTypeDescription
geometrypath2the geometry

Example

let sharedpoints = toPoints(geometry)

modeling/geometries/path2.toString(geometry)

Create a string representing the contents of the given path.

Kind: static method of modeling/geometries/path2
Returns: String - a representative string

ParamTypeDescription
geometrypath2the path

Example

console.out(toString(path))

modeling/geometries/path2.transform(matrix, geometry)

Transform the given geometry using the given matrix. This is a lazy transform of the points, as this function only adjusts the transforms. The transforms are applied when accessing the points via toPoints().

Kind: static method of modeling/geometries/path2
Returns: path2 - a new path

ParamTypeDescription
matrixmat4the matrix to transform with
geometrypath2the geometry to transform

Example

let newpath = transform(fromZRotation(TAU / 8), path)

modeling/geometries/path2.validate(object)

Determine if the given object is a valid path2. Checks for valid data points, and duplicate points.

If the geometry is not valid, an exception will be thrown with details of the geometry error.

Kind: static method of modeling/geometries/path2
Throws:

  • Error error if the geometry is not valid
ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries/poly2

Represents a 2D polygon consisting of a list of ordered vertices.

See: poly2 for data structure information.
Example

poly2.create([[0,0], [4,0], [4,3]])

Example

{"vertices": [[0,0], [4,0], [4,3]]}

modeling/geometries/poly2.measureArea

Measure the area under the given polygon.

Kind: static constant of modeling/geometries/poly2
Returns: Number - the area of the polygon

ParamTypeDescription
polygonpoly2the polygon to measure

modeling/geometries/poly2.arePointsInside(points, polygon)

Determine if the given points are inside the given polygon.

Kind: static method of modeling/geometries/poly2
Returns: Integer - 1 if all points are inside, 0 if some or none are inside

ParamTypeDescription
pointsArraya list of points, where each point is an array with X and Y values
polygonpoly2a 2D polygon

modeling/geometries/poly2.create([vertices])

Creates a new polygon with initial values.

Kind: static method of modeling/geometries/poly2
Returns: poly2 - a new polygon

ParamTypeDescription
[vertices]Arraylist of vertices (2D)

Example

let polygon = create()

modeling/geometries/poly2.flip(polygon)

Flip the give polygon, rotating the opposite direction.

Kind: static method of modeling/geometries/poly2
Returns: poly2 - a new polygon

ParamTypeDescription
polygonpoly2the polygon to flip

modeling/geometries/poly3

Represents a convex 3D polygon consisting of a list of ordered vertices.

See: poly3 for data structure information.
Example

poly3.create([[0,0,0], [4,0,0], [4,3,12]])

Example

{"vertices": [[0,0,0], [4,0,0], [4,3,12]]}

modeling/geometries/poly3.clone([out], polygon)

Create a deep clone of the given polygon

Kind: static method of modeling/geometries/poly3
Returns: poly3 - a new polygon

ParamTypeDescription
[out]poly3receiving polygon
polygonpoly3polygon to clone

modeling/geometries/poly3.create([vertices])

Creates a new 3D polygon with initial values.

Kind: static method of modeling/geometries/poly3
Returns: poly3 - a new polygon

ParamTypeDescription
[vertices]Arraya list of vertices (3D)

modeling/geometries/poly3.fromPoints(points)

Create a polygon from the given points.

Kind: static method of modeling/geometries/poly3
Returns: poly3 - a new polygon

ParamTypeDescription
pointsArraylist of points (3D)

Example

const points = [
[0, 0, 0],
[0, 10, 0],
[0, 10, 10]
]
const polygon = fromPoints(points)

modeling/geometries/poly3.fromPointsAndPlane(vertices, plane)

Create a polygon from the given vertices and plane. NOTE: No checks are performed on the parameters.

Kind: static method of modeling/geometries/poly3
Returns: poly3 - a new polygon

ParamTypeDescription
verticesArraylist of vertices (3D)
planeplaneplane of the polygon

modeling/geometries/poly3.invert(polygon)

Invert the give polygon to face the opposite direction.

Kind: static method of modeling/geometries/poly3
Returns: poly3 - a new poly3

ParamTypeDescription
polygonpoly3the polygon to invert

modeling/geometries/poly3.isA(object)

Determine if the given object is a polygon.

Kind: static method of modeling/geometries/poly3
Returns: Boolean - true if the object matches a poly3

ParamTypeDescription
objectObjectthe object to interrogate

modeling/geometries/poly3.isConvex(polygon)

Check whether the given polygon is convex.

Kind: static method of modeling/geometries/poly3
Returns: Boolean - true if convex

ParamTypeDescription
polygonpoly3the polygon to interrogate

modeling/geometries/poly3.measureArea(polygon)

Measure the area of the given polygon.

Kind: static method of modeling/geometries/poly3
Returns: Number - area of the polygon
See: 2000 softSurfer http://geomalgorithms.com

ParamTypeDescription
polygonpoly3the polygon to measure

modeling/geometries/poly3.measureBoundingBox(polygon)

Kind: static method of modeling/geometries/poly3
Returns: Array - an array of two vectors (3D); minimum and maximum coordinates

ParamTypeDescription
polygonpoly3the polygon to measure

modeling/geometries/poly3.measureBoundingSphere(polygon)

Measure the bounding sphere of the given polygon.

Kind: static method of modeling/geometries/poly3
Returns: vec4 - the computed bounding sphere; center point (3D) and radius

ParamTypeDescription
polygonpoly3the polygon to measure

modeling/geometries/poly3.measureSignedVolume(polygon)

Measure the signed volume of the given polygon, which must be convex. The volume is that formed by the tetrahedron connected to the axis [0,0,0], and will be positive or negative based on the rotation of the vertices.

Kind: static method of modeling/geometries/poly3
Returns: Number - volume of the polygon
See: http://chenlab.ece.cornell.edu/Publication/Cha/icip01_Cha.pdf

ParamTypeDescription
polygonpoly3the polygon to measure

modeling/geometries/poly3.toPoints(polygon)

Return the given polygon as a list of points. NOTE: The returned array should not be modified as the points are shared with the geometry.

Kind: static method of modeling/geometries/poly3
Returns: Array - list of points (3D)

ParamTypeDescription
polygonpoly3the polygon

modeling/geometries/poly3.toString(polygon)

Kind: static method of modeling/geometries/poly3
Returns: String - the string representation

ParamTypeDescription
polygonpoly3the polygon to measure

modeling/geometries/poly3.transform(matrix, polygon)

Transform the given polygon using the given matrix.

Kind: static method of modeling/geometries/poly3
Returns: poly3 - a new polygon

ParamTypeDescription
matrixmat4the matrix to transform with
polygonpoly3the polygon to transform

modeling/geometries/poly3.validate(object)

Determine if the given object is a valid polygon. Checks for valid data structure, convex polygons, and duplicate points.

If the geometry is not valid, an exception will be thrown with details of the geometry error.

Kind: static method of modeling/geometries/poly3
Throws:

  • Error error if the geometry is not valid
ParamTypeDescription
objectObjectthe object to interrogate

geom2

Represents a 2D geometry consisting of a list of sides.

Kind: global typedef
Properties

NameTypeDescription
sidesArraylist of sides, each side containing two points
transformsmat4transforms to apply to the sides, see transform()

geom3

Represents a 3D geometry consisting of a list of polygons.

Kind: global typedef
Properties

NameTypeDescription
polygonsArraylist of polygons, each polygon containing three or more points
transformsmat4transforms to apply to the polygons, see transform()

path2

Represents a 2D geometry consisting of a list of ordered points.

Kind: global typedef
Properties

NameTypeDescription
pointsArraylist of ordered points
isClosedBooleantrue if the path is closed where start and end points are the same
transformsmat4transforms to apply to the points, see transform()

poly2

Represents a convex 2D polygon consisting of a list of ordered vertices.

Kind: global typedef
Properties

NameTypeDescription
verticesArraylist of ordered vertices (2D)

poly3

Represents a convex 3D polygon. The vertices used to initialize a polygon must be coplanar and form a convex shape. The vertices do not have to be vec3 instances but they must behave similarly.

Kind: global typedef
Properties

NameTypeDescription
verticesArraylist of ordered vertices (3D)