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.
Name | Type | Description |
---|---|---|
color | Color | HTML color string |
positions | Array.<Array.<Number>> | An array of 3D point in global space. |
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.
Name | Type | Description |
---|---|---|
mouseEvent | MouseEvent | The initial mouse event which triggered this function. |
pointCount | Number | Number of point to register before creating a measure. |
color | Color | HTML color string |
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.
- See
- setUnit
Euclidean distance.
- Type:
- Number
getMeasuresFromEntity(entity) → {Array.<object>}
Get computed measures from a measure entity.
Name | Type | Description |
---|---|---|
entity | Entity | The measure entity |
An array of measures
- Type:
- Array.<object>
setUnit(factor, unit)
Set measure unit and factor.
Name | Type | Description |
---|---|---|
factor | Number | Scaling factor applied to the measures. |
unit | String | Unit of measurement displayed as a suffix. |