modeling/geometries/geom3

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

Source:
See:
  • geom3 for data structure information.

Methods

(static) clone(geometry) → {geom3}

Source:

Performs a deep clone of the given geometry.

Parameters:
Name Type Description
geometry geom3

the geometry to clone

Returns:

a new geometry

Type
geom3

(static) create(polygonsopt) → {geom3}

Source:

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

Parameters:
Name Type Attributes Description
polygons Array <optional>

list of polygons, or undefined

Returns:

a new geometry

Type
geom3

(static) fromCompactBinary(data) → {geom3}

Source:

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

Parameters:
Name Type Description
data TypedArray

compact binary data

Returns:

a new geometry

Type
geom3

(static) fromPoints(listofpoints) → {geom3}

Source:

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.

Parameters:
Name Type Description
listofpoints Array

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

Returns:

a new geometry

Type
geom3

(static) invert() → {geom3}

Source:

Invert the given geometry, transposing solid and empty space.

Returns:

a new geometry

Type
geom3

(static) isA(object) → {Boolean}

Source:

Determin if the given object is a 3D geometry.

Parameters:
Name Type Description
object object

the object to interogate

Returns:

true if the object matches a geom3

Type
Boolean

(static) toCompactBinary(geometry) → {TypedArray}

Source:

Return the given geometry in compact binary representation.

Parameters:
Name Type Description
geometry geom3

the geometry

Returns:

compact binary representation

Type
TypedArray

(static) toPoints() → {Array}

Source:

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.

Returns:

list of points, where each sub-array represents a polygon

Type
Array

(static) toPolygons(geometry) → {Array}

Source:

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.

Example
let sharedpolygons = toPolygons(geometry)
Parameters:
Name Type Description
geometry geom3

the geometry

Returns:

an array of polygons

Type
Array

(static) toString(geometry) → {String}

Source:

Create a string representing the contents of the given geometry.

Example
console.out(toString(geometry))
Parameters:
Name Type Description
geometry geom3

the geometry

Returns:

a representive string

Type
String

(static) transform(matrix, geometry) → {geom3}

Source:

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.

Example
let newgeometry = transform(fromXRotation(degToRad(90)), geometry)
Parameters:
Name Type Description
matrix mat4

the matrix to transform with

geometry geom3

the geometry to transform

Returns:

a new geometry

Type
geom3