Create and display measures.

This extension require the following extension installed:

  • SDK3DVerse_ThreeJS_Ext
  • SDK3DVerse_ViewportDomOverlay_Ext

Methods

(async) createMeasure(color, positions) → {Entity}

Create a measure from 3D points.

The measure type depends on the point count. 2 points will make a linear measurement. 3 points will make a angular measurement.

Parameters:
NameTypeDescription
colorColor

HTML color string

positionsArray.<Array.<Number>>

An array of 3D point in global space.

Returns:

The measure entity created

Type: 
Entity

(async) createMeasureFromMouseEvent(mouseEvent, pointCount, color) → {Entity}

Create a measure by mouse clicks with a visual effect between each of them.

This function is designed to create a measure from multiple mouse click events. The first event (which will trigger this function) needs to be passed to this function, but the following events are registered and handled by this function automatically.

The measure type depends on the point count. 2 points will make a linear measurement. 3 points will make a angular measurement.

Parameters:
NameTypeDescription
mouseEventMouseEvent

The initial mouse event which triggered this function.

pointCountNumber

Number of point to register before creating a measure.

colorColor

HTML color string

Returns:

The measure entity created

Type: 
Entity

distance(firstEntity, secondEntity) → {Number}

Calculates the euclidian distance multiplied by the current factor (setted by the function setUnit) between two entity global positions.

Parameters:
NameTypeDescription
firstEntityEntity
secondEntityEntity
See
  • setUnit
Returns:

Euclidean distance.

Type: 
Number

getMeasuresFromEntity(entity) → {Array.<object>}

Get computed measures from a measure entity.

Parameters:
NameTypeDescription
entityEntity

The measure entity

Returns:

An array of measures

Type: 
Array.<object>

setUnit(factor, unit)

Set measure unit and factor.

Parameters:
NameTypeDescription
factorNumber

Scaling factor applied to the measures.

unitString

Unit of measurement displayed as a suffix.