Module: draw

Methods

(inner) formatSVGLegend(labels, colors) → {string}

Format an SVG string with labels and colors.

Parameters:
Name Type Description
labels Array.<string>

The names for the label.

colors Array.<integer>

The colors for each label.

Source:
Returns:

SVG string with the labels and colors values formated as a legend.

Type
string

(inner) makeArrow(from, to, color, name) → {THREE.Object3D}

Create a generic Arrow object (composite of a cone and line)

Parameters:
Name Type Description
from Array.<float>

The x, y and z coordinates where the arrow originates from.

to Array.<float>

The x, y and z coordinates where the arrow points to.

color integer

Hexadecimal base that specifies the color of the line.

name String

The text to be used in the label, and the name of the line and cone (used for raycasting).

Source:
Returns:
Type
THREE.Object3D

(inner) makeLabel(position, text, Color) → {THREE.Sprite}

Create a THREE object that displays 2D text, this implementation is based on the answer found here

The text is returned scaled to its size in pixels, hence you'll need to scale it down depending on the scene's dimensions.

Warning: The text sizes vary slightly depending on the browser and OS you use. This is specially important for testing.

Parameters:
Name Type Description
position Array.<float>

The x, y, and z location of the label.

text string

The text to be shown on screen.

Color integer | string

Hexadecimal base that represents the color of the text.

Source:
Returns:

Object with the text displaying in it.

Type
THREE.Sprite

(inner) makeLine(start, end, color, width, transparent) → {THREE.Line}

Create a generic THREE.Line object

Parameters:
Name Type Description
start Array.<float>

The x, y and z coordinates of one of the ends of the line.

end Array.<float>

The x, y and z coordinates of one of the ends of the line.

color integer

Hexadecimal base that specifies the color of the line.

width float

The width of the line being drawn.

transparent boolean

Whether the line will be transparent or not.

Source:
Returns:
Type
THREE.Line

(inner) makeLineCollection(vertices, color) → {EmperorLineSegments}

Create a collection of disconnected lines.

This function is specially useful when creating a lot of lines as it uses a BufferGeometry for improved performance.

Parameters:
Name Type Description
vertices Array.<Array>

List of vertices used to create the lines. Each line is connected on as (vertices[i], vertices[i+1), (vertices[i+2], vertices[i+3]), etc.

color integer

Hexadecimal base that specifies the color of the line.

Source:
Returns:
Type
EmperorLineSegments