Skip to content
Last updated

API / geotoolkit3d / scene / reservoir / hexahedral / voxel / VoxelGrid / VoxelGrid

Class: VoxelGrid

voxel.VoxelGrid.VoxelGrid

A 3D Voxel grid object. It is similar to ReservoirGrid feature wise, but is optimized for more regular structures like voxels, where each cell is identical.<br> The cell shape is defined by 3 vectors, each defining the three axes of the hexahedral cell.<br>

This object represents the 3D visualization of a voxel grid with an optional attribute used for coloring.<br> The voxel cell's geometry and values are defined by the given VoxelGridData, and the cell visibility is determined by user-defined filters.

Note: VoxelGrid works with transparent colors, but for correct visualization occlusion will be switched off. So performance in case of transparent colors will be worse than with only opaque colors.

Hierarchy

Implements

Table of contents

Constructors
  • [new VoxelGrid(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit3d.scene-3.reservoir-2.hexahedral-1.voxel.voxelgrid.voxelgrid.md#new voxelgrid(options))
Methods

Contents

Constructors

new VoxelGrid(options)

• new VoxelGrid(options)

Parameters

Name Type
optionsOptions

Overrides

AbstractReservoirGrid.constructor

Methods

add

▸ add(object): VoxelGrid

Adds object as child of this object.

Parameters

Name Type Description
objectObject3D<Object3DEventMap&gt; | Object3D<Object3DEventMap&gt;[]object

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.add


afterRender

▸ afterRender(scene, camera, plot, renderer): VoxelGrid

This function is called after rendering and can update this object's content.<br> <br> It should not trigger any invalidateObject though.<br> Note that it is not necessary nor recommended to explicitly call afterRender on this object's children as beforeRender will be called on all nodes present in the scene.<br> <br> This will be executed after the transformations simplification.<br> <br>

See

Plot for more details on the render steps

Parameters

Name Type Description
sceneSceneThe scene
cameraCameraThe camera used for this render phase.
plotPlotThe 3D plot
rendererWebGLRendererThe renderer

Returns

VoxelGrid

Inherited from

AbstractReservoirGrid.afterRender


beforeRender

▸ beforeRender(scene, camera, plot, renderer): VoxelGrid

This function is called prior to rendering and can update this object's content.<br> <br> It should not trigger any invalidateObject though.<br> Note that it is not necessary nor recommended to explicitly call beforeRender on this object's children as beforeRender will be called on all nodes present in the scene.<br> <br> This will be executed after the transformations simplification.<br> <br>

See

Plot for more details on the render steps

Parameters

Name Type Description
sceneSceneThe scene
cameraCameraThe camera used for this render phase.
plotPlotThe 3D plot
rendererWebGLRendererThe renderer

Returns

VoxelGrid

Inherited from

AbstractReservoirGrid.beforeRender


deleteAdditionalCellData

▸ deleteAdditionalCellData(name): void

Delete a previously defined additional cell data.<br>

Parameters

Name Type Description
namestringThe name of the additional data to delete.

Returns

void


dispose

▸ dispose(): void

Dispose this grid visual, along its VoxelGridData.

Returns

void

Overrides

AbstractReservoirGrid.dispose


getBoundingBox

▸ getBoundingBox(): Box3

Get the bounding box of this Voxel Grid (in local coordinates).

Returns

Box3

bbox


getClassName

▸ getClassName(): string

Returns

string

Implementation of

IIntersectablePolyhedron.getClassName

Inherited from

AbstractReservoirGrid.getClassName


getColorProvider

▸ getColorProvider(): ColorProvider

Return the colorProvider for this Grid.

Returns

ColorProvider

Implementation of

IIntersectablePolyhedron.getColorProvider


getData

▸ getData(): VoxelGridData

Get the grid data, holding the cells positions and values.

Returns

VoxelGridData

data


getFilteredCellsCount

▸ getFilteredCellsCount(): number

Return the number of cells resulting from the user's filter.

Returns

number


getFilteredCellsVolume

▸ getFilteredCellsVolume(): number

Return the volume occupied by the remaining cells resulting from the user's filter.<br> Each cell volume is computed based on the cell's xyz corner coordinates.<br> The unit of the volume measurement is based on the unit used in cells coordinates, to user discretion. (ex: if cells coordinates are in meters, then the volume will be in cubic meters. If feet, then cubic feet, and so on.)

Returns

number

the total filtered cells volume.


getGridFullVolume

▸ getGridFullVolume(): number

Returns the total volume of this grid.<br> Computed by the sum of the volume of every valid cell, filters are ignored.<br> The unit of the volume measurement is based on the unit used in cells coordinates, to user discretion. (ex: if cells coordinates are in meters, then the volume will be in cubic meters. If feet, then cubic feet, and so on.)

Returns

number


getMesh

▸ getMesh(): Mesh<BufferGeometry<NormalBufferAttributes&gt;, Material | Material[], Object3DEventMap&gt;

Return the mesh representing the polyhderons to be intersected.

Returns

Mesh<BufferGeometry<NormalBufferAttributes&gt;, Material | Material[], Object3DEventMap&gt;

Implementation of

IIntersectablePolyhedron.getMesh


getOptions

▸ getOptions(): OptionsBaseOut

Get this Grid options.

Returns

OptionsBaseOut

Overrides

AbstractReservoirGrid.getOptions


getPolyhedron

▸ getPolyhedron(polyhedronIndex, target): void

Return the polyhedron data at given index.<br> Vertices coordinates must be in the local coordinate space of the mesh returned by getMesh method.

Parameters

Name Type Description
polyhedronIndexnumberthe index of the polyhedron
targetPolyhedronCellDataresult

Returns

void

Implementation of

IIntersectablePolyhedron.getPolyhedron


getPolyhedronCount

▸ getPolyhedronCount(): number

Return the total number of Polyhedrons contained by this object.

Returns

number

Implementation of

IIntersectablePolyhedron.getPolyhedronCount


getPolyhedronsBoundingBox

▸ getPolyhedronsBoundingBox(target): void

Return the bounding box of the polyhedrons.<br> The bounding box should be calculated directly from the polyhedrons' geometry vertex positions, representing the bounding box in the polyhedrons' local space.<br> The box coordinates must be in the local coordinate space of the mesh returned by getMesh method.

Parameters

Name Type Description
targetBox3result

Returns

void

Implementation of

IIntersectablePolyhedron.getPolyhedronsBoundingBox


getSelectedProperties

▸ getSelectedProperties(): PickingCellData

Get IJK info of selected/highlighted cell.

Returns

PickingCellData


getVisible

▸ getVisible(): boolean

Get visible

Returns

boolean

true, if object is visible

Inherited from

AbstractReservoirGrid.getVisible


highlightCellByIJK

▸ highlightCellByIJK(ijk?): boolean

Highlight the designated cell ijk in the format [i, j, k]. Set the argument to null to remove the current cell highlight.<br> Only one cell can be highlighted at the same time. Cells highlighted using this method will not be automatically removed by selection tools, unless another cell from this grid is selected.

Parameters

Name Type Description
Optional ijknumber[]the cell ijk position to highlight, or null to remove previous highlight.

Returns

boolean

true if the cell ijk is valid, false if the given ijk match no cell. Null/no value is valid and returns true.


highlightCellByIndex

▸ highlightCellByIndex(index?): boolean

Highlight the designated cell index. Set the index to null to remove the current cell highlight. Only one cell can be highlighted at the same time.<br> Cells highlighted using this method will not be automatically removed by selection tools, unless another cell from this grid is selected.

Parameters

Name Type Description
Optional indexnumberthe cell index to highlight, or null to remove previous highlight.

Returns

boolean

true if the cell index is valid, false if the index is out of bounds. Null/no value is valid and returns true.


invalidateObject

▸ invalidateObject<T&gt;(event?): VoxelGrid

Notifies this object and its parent that this object has been invalidated.<br> If this object is in a Plot, it will be marked as dirty and will trigger a rendering cycle.<br>

Type parameters

Name
T

Parameters

Name Type Description
Optional eventEvent<T&gt;The event to fire

Returns

VoxelGrid

Inherited from

AbstractReservoirGrid.invalidateObject


isCellIndexFilteredOut

▸ isCellIndexFilteredOut(index): boolean

Return true if the cell of the given index is filtered out (is not displayed), based on both IJK filter, value filter, and the user filter.

Parameters

Name Type
indexnumber

Returns

boolean


isDisposed

▸ isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

AbstractReservoirGrid.isDisposed


isIJKValidInFilter

▸ isIJKValidInFilter(ijk): boolean

Return true if the given IJK is valid by the IJK filter of the VoxelGrid, false if is filtered out.

Parameters

Name Type
ijknumber[] | IJKIndex

Returns

boolean


isPolyhedronIndexFilteredOut

▸ isPolyhedronIndexFilteredOut(polyhedronIndex): boolean

Return if the polyhedron at given index is filtered out.<br> Polyhedron objects like ReservoirGrid can contain multiple polyhedrons, which can be filtered out by user settings. <br> This method allow to express whether this specific polyhedron is filtered out (and should be excluded from intersection).

Parameters

Name Type
polyhedronIndexnumber

Returns

boolean

true if filtered out, otherwise false

Implementation of

IIntersectablePolyhedron.isPolyhedronIndexFilteredOut


isSelectable

▸ isSelectable(): boolean

Return if this object can be picked/selected (see RendererPicking).<br>

Returns

boolean

Inherited from

AbstractReservoirGrid.isSelectable


isValueValidInFilter

▸ isValueValidInFilter(value): boolean

Return true if the given value is bounded by the value filter of this Grid, false if the value is filtered out.<br> Also return false if the value is not a number or equal to the defined nullvalue.

Parameters

Name Type
valuenumber

Returns

boolean


notify

▸ notify<E&gt;(type, source, args?): VoxelGrid

  • Notify listeners. Parent nodes will also be notified if they are instances of geotoolkit3d.scene.Object3D

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceVoxelGridof the event
Optional argsEventMap[E]arguments of the event

Returns

VoxelGrid

this

Overrides

AbstractReservoirGrid.notify


off

▸ off<E&gt;(type?, callback?): VoxelGrid

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: VoxelGrid, args: EventMap[E]) => voidfunction to be called

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.off


on

▸ on<E&gt;(type, callback): VoxelGrid

Attach listener on event that will be called whenever the specified event is delivered to the target <p> If the callback function is already in the list of event listeners for this target, the function is not added a second time. </p> <p> If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target. </p>

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: VoxelGrid, args: EventMap[E]) => voidto be called

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.on


onStatsUpdated

▸ onStatsUpdated(metrics): VoxelGrid

This function is called when the plot has updated performance metric.<br> It will be called every set number of frames.<br> The number of frame is customizable in the plot options advancedrendering.performancemetrics.updateframeperiod and is 100 by default.

Parameters

Name Type Description
metricsPerformanceMetricsThe performance metrics.

Returns

VoxelGrid

Inherited from

AbstractReservoirGrid.onStatsUpdated


onVisibilityChanged

▸ Protected onVisibilityChanged(): void

This method is called if visibility is changed. Send event Events.VisibilityChanged

Returns

void

Inherited from

AbstractReservoirGrid.onVisibilityChanged


remove

▸ remove(object): VoxelGrid

Removes object as child of this object.

Parameters

Name Type Description
objectObject3D<Object3DEventMap&gt; | Object3D<Object3DEventMap&gt;[]object

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.remove


removeHighlightShape

▸ removeHighlightShape(): void

Remove the current cell highlight effect on this grid.

Returns

void

Overrides

AbstractReservoirGrid.removeHighlightShape


setCellsValues

▸ setCellsValues(cellsValues): VoxelGrid

Change the cells values, and/or define additional cell data.<br> Changing cell values will change the active cells properties used with the colormap, and reset the "value" filter.<br> Additional cell data are named properties that can be then used in a custom filter function.<br> To remove additional cell data, please use VoxelGridData.deleteAdditionalCellData.

Parameters

Name Type
cellsValuesCellsValues

Returns

VoxelGrid


setColorProvider

▸ setColorProvider(colorProvider): VoxelGrid

Set the colorProvider for this Grid.

Parameters

Name Type Description
colorProviderColorProviderthe color provider

Returns

VoxelGrid


setOptions

▸ setOptions(options): VoxelGrid

Set this Grid options.<br> Changing position data using setOptions is not allowed, as it is more expensive than creating a new Grid.

Parameters

Name Type
optionsOptionsBase

Returns

VoxelGrid

Overrides

AbstractReservoirGrid.setOptions


setPosition

▸ setPosition(position): VoxelGrid

Set Object's local position.

Parameters

Name Type Description
positionObjectlocal position
Optional position.xnumber
Optional position.ynumber
Optional position.znumber

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.setPosition


setRotation

▸ setRotation(x, y, z, order?): VoxelGrid

Set Object's local rotation (Euler angles), in radians.

Parameters

Name Type Description
xnumberx angle
ynumbery angle
znumberz angle
Optional orderEulerOrdereuler order

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.setRotation


setSelectable

▸ setSelectable(selectable): void

Set if this object can be picked/selected (see RendererPicking).<br>

Parameters

Name Type Description
selectablebooleanif can be selected

Returns

void

Inherited from

AbstractReservoirGrid.setSelectable


setVisible

▸ setVisible(visible, silent?): VoxelGrid

Set visible

Parameters

Name Type Description
visiblebooleantrue, if object is visible
Optional silentbooleantrue, if object shouldn't be invalidated

Returns

VoxelGrid

this

Inherited from

AbstractReservoirGrid.setVisible


updateCellFilter

▸ updateCellFilter(): VoxelGrid

Rebuild the grid geometry depending on filters.<br> Calling VoxelGrid.setOptions() also rebuilds the grid.<br> The main use of this updateCellFilter() function is to manually update the grid when the custom filter is updated via closure variables, and VoxelGrid.setOptions() is not called to update filters.

Returns

VoxelGrid


updateObject

▸ updateObject(scene, camera): VoxelGrid

This function is called prior to rendering and can update this object's content.<br> <br> It should not trigger any invalidateObject though.<br> Note that it is not necessary nor recommended to explicitly call updateObject on this object's children as updateObject will be called on all nodes present in the scene.<br> <br> This will be executed before the transformations simplification.<br> <br>

See

Plot for more details on the render steps

Parameters

Name Type Description
sceneSceneThe scene
cameraCameraThe camera

Returns

VoxelGrid

Inherited from

AbstractReservoirGrid.updateObject


useOwnHighlight

▸ useOwnHighlight(): boolean

Used by the rendering pass to know whether this object have its own highlight mechanism, or should the pass itself generate a generic one.

Returns

boolean

Overrides

AbstractReservoirGrid.useOwnHighlight


getClassName

▸ Static getClassName(): string

Returns

string

Inherited from

AbstractReservoirGrid.getClassName


register

▸ Static register(): void

Register object for special processing through a callback function<br>

Example

geotoolkit3d.util.ObjectProcessor.getDefaultInstance().registerObject(this.getClassName(), callback);

Deprecated

since 5.0, to allow custom object highlighting, please instead make your Object implement the interface geotoolkit3d/scene/ICustomHighlight.

Returns

void

Inherited from

AbstractReservoirGrid.register