@novorender/api / CoreModule
Class: CoreModule
Defined in: @novorender/src/measure/modules/core/module.ts:23
Standard measure module for standard measure functions
Extends
BaseModule
Constructors
Constructor
new CoreModule(worker, parent): CoreModule;
Defined in: @novorender/src/measure/modules/base.ts:5
Parameters
Parameter | Type |
---|---|
worker | MeasureWorker |
parent | MeasureView |
Returns
CoreModule
Inherited from
BaseModule.constructor
Methods
areaFromPolygon()
areaFromPolygon(vertices): object;
Defined in: @novorender/src/measure/modules/core/module.ts:165
Calculates the area from polygon. Treat polygon as closed, Z is treated as height and is ignored.
Parameters
Parameter | Type | Description |
---|---|---|
vertices | ReadonlyVec3 [] | Vertices defining the polygon, last and first vertex will be connected to create a closed polygon |
Returns
object
The area of the selected polygon, do note this is 2d calulation and height is ignored
area
area: undefined | number;
polygon
polygon: ReadonlyVec3[];
getVertexEdges()
getVertexEdges(entity): Promise<undefined | EdgeValues[]>;
Defined in: @novorender/src/measure/modules/core/module.ts:429
Parameters
Parameter | Type |
---|---|
entity | MeasureEntity |
Returns
Promise
<undefined
| EdgeValues
[]>
isParametricDataGenerated()
isParametricDataGenerated(id): Promise<boolean>;
Defined in: @novorender/src/measure/modules/core/module.ts:104
Novorender attempts to generate parametric data from tesselated objects if it is not provided in the file.
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
Returns
Promise
<boolean
>
true if the parametric data is generated from novorender and not directly from parametric file *
measure()
measure(
a,
b?,
settingA?,
settingB?): Promise<undefined | MeasurementValues>;
Defined in: @novorender/src/measure/modules/core/module.ts:33
Measure object, if b is undefined then single measure values are returned else the measurement between 2 objects Standard measuring function for measure single or between 2 parametric objects.
Parameters
Parameter | Type | Description |
---|---|---|
a | MeasureEntity | The entity that is being measured, this can either be a parametric object or a single point |
b? | MeasureEntity | If this is defined then the measure function will return the measurement between a and b. |
settingA? | MeasureSettings | settings for object a |
settingB? | MeasureSettings | settings for object b |
Returns
Promise
<undefined
| MeasurementValues
>
Measurement values either for a single object or between the objects
measureLineStrip()
measureLineStrip(vertices): LineStripMeasureValues;
Defined in: @novorender/src/measure/modules/core/module.ts:231
Measure between multiple points. Will return the angles, segment length and total length
Parameters
Parameter | Type | Description |
---|---|---|
vertices | ReadonlyVec3 [] | Vertices defining the line strip to be measured |
Returns
Angles, segment length and total length of the input linestrip
pickCurveSegment()
pickCurveSegment(id): Promise<undefined | MeasureEntity>;
Defined in: @novorender/src/measure/modules/core/module.ts:70
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
Returns
Promise
<undefined
| MeasureEntity
>
the measure entity for given object if it is a single curveSegment
pickMeasureEntity()
pickMeasureEntity(
id,
selectionPosition,
tolerance?,
allowGenerated?): Promise<{
connectionPoint?: vec3;
entity: MeasureEntity;
status: LoadStatus;
}>;
Defined in: @novorender/src/measure/modules/core/module.ts:52
Returns the measure entity for given object and location, measure entity is a single part of a parametric object, such as surface, edge or vertex. If the object and position does not contain parametric data a single vertex will be returned
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
selectionPosition | ReadonlyVec3 | selected position, this is required to select the individual part of the parametric object |
tolerance? | SnapTolerance | Tolerance for picking, the distance used is in meters |
allowGenerated? | boolean | - |
Returns
Promise
<{
connectionPoint?
: vec3
;
entity
: MeasureEntity
;
status
: LoadStatus
;
}>
Selected measure entity, this will be a vertex if nothing can be selected at the location status if the object is loaded, and connection point where the parametric object has been selected.
pickMeasureEntityOnCurrentObject()
pickMeasureEntityOnCurrentObject(
id,
selectionPosition,
tolerance,
allowGenerated?): Promise<{
connectionPoint?: vec3;
entity: undefined | MeasureEntity;
status: LoadStatus;
}>;
Defined in: @novorender/src/measure/modules/core/module.ts:81
Returns the measure entity for given object and location if the current object is selected This is much faster than pickMeasureEntity and can be used for hover
Parameters
Parameter | Type | Description |
---|---|---|
id | number | The object id of selected object |
selectionPosition | ReadonlyVec3 | selected position, this is required to select the individual part of the parametric object |
tolerance | SnapTolerance | Tolerance for picking, the distance used is in meters |
allowGenerated? | boolean | - |
Returns
Promise
<{
connectionPoint?
: vec3
;
entity
: undefined
| MeasureEntity
;
status
: LoadStatus
;
}>
Selected measure entity, this will be undefined if nothing is selectable at current position *
swapCylinder()
swapCylinder(entity, to): Promise<undefined | MeasureEntity>;
Defined in: @novorender/src/measure/modules/core/module.ts:139
Swaps between inner and outer cylinder, returns undefined if there is only one
Parameters
Parameter | Type | Description |
---|---|---|
entity | MeasureEntity | Entity to be swapped |
to | "inner" | "outer" | Force cylinder to either be inner or outer |
Returns
Promise
<undefined
| MeasureEntity
>
Returns a new entity of the selected cylinder, if there is only one cylinder undefined is returned.
Properties
parent
readonly parent: MeasureView;
Defined in: @novorender/src/measure/modules/base.ts:7
Inherited from
BaseModule.parent
worker
readonly worker: MeasureWorker;
Defined in: @novorender/src/measure/modules/base.ts:6
Inherited from
BaseModule.worker