Global

Members


Detector

Author:
  • alteredq / http://alteredqualia.com/
  • mr.doob / http://mrdoob.com/

Methods


normalize(positions, vertices, rescale)

Centers a mesh about the origin and rescales it to unit radius.

Parameters:
Name Type Description
positions Array.<module:LinearAlgebra.Vector>

The position of each vertex in the vertices array.

vertices Array.<module:Core.Vertex>

The vertices of a mesh.

rescale boolean

A flag indicating whether mesh positions should be scaled to a unit radius.


indexElements(elementList)

Assigns an index to each element in elementList. Indices can be accessed by using
elements as keys in the returned dictionary.

Parameters:
Name Type Description
elementList Array.<Object>

An array of any one of the following mesh elements -
vertices, edges, faces, corners, halfedges, boundaries.

Returns:

A dictionary mapping each element in elementList to a unique index
between 0 and |elementList|-1.

Type
Object
Example
let vertexIndex = indexElements(mesh.vertices);
let v = mesh.vertices[0];
let i = vertexIndex[v];
console.log(i); // prints 0

clamp(x, min, max)

Clamps a number between the specified minimum and maximum values.

Parameters:
Name Type Description
x number

The number to be clamped.

min number

The minimum value of x.

max number

The maximum value of x.

Returns:
Type
number

colormap(x, min, max, values)

Maps a number to RGB color values.

Parameters:
Name Type Description
x number

The number to be mapped to RGB color values.

min number

The minimum value of x.

max number

The maximum value of x.

values Array.<Array.<number>>

The colormap. The current available options
are seismic, coolwarm and hot.

Returns:
Type
module:LinearAlgebra.Vector

hsv(h, s, v)

Computes the hue, saturation, and value of the RGB color model.

Parameters:
Name Type Description
h number

The hue of the RGB color model.

s number

The saturation of the RGB color model.

v number

The value of the RGB color model.

Returns:
Type
module:LinearAlgebra.Vector