API / geotoolkit3d / scene / reservoir / hexahedral / 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.
↳
VoxelGrid
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
Methods
▸ add(object): VoxelGrid
Adds object as child of this object.
| Name | Type | Description |
|---|---|---|
object | Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[] | object |
this
▸ 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
| Name | Type | Description |
|---|---|---|
scene | Scene | The scene |
camera | Camera | The camera used for this render phase. |
plot | Plot | The 3D plot |
renderer | WebGLRenderer | The renderer |
AbstractReservoirGrid.afterRender
▸ 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
| Name | Type | Description |
|---|---|---|
scene | Scene | The scene |
camera | Camera | The camera used for this render phase. |
plot | Plot | The 3D plot |
renderer | WebGLRenderer | The renderer |
AbstractReservoirGrid.beforeRender
▸ deleteAdditionalCellData(name): void
Delete a previously defined additional cell data.<br>
| Name | Type | Description |
|---|---|---|
name | string | The name of the additional data to delete. |
void
▸ dispose(): void
Dispose this grid visual, along its VoxelGridData.
void
▸ getBoundingBox(): Box3
Get the bounding box of this Voxel Grid (in local coordinates).
Box3
bbox
▸ getClassName(): string
string
IIntersectablePolyhedron.getClassName
AbstractReservoirGrid.getClassName
▸ getColorProvider(): ColorProvider
Return the colorProvider for this Grid.
IIntersectablePolyhedron.getColorProvider
▸ getData(): VoxelGridData
Get the grid data, holding the cells positions and values.
data
▸ getFilteredCellsCount(): number
Return the number of cells resulting from the user's filter.
number
▸ 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.)
number
the total filtered cells volume.
▸ 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.)
number
▸ getMesh(): Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>
Return the mesh representing the polyhderons to be intersected.
Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>
IIntersectablePolyhedron.getMesh
▸ getOptions(): OptionsBaseOut
Get this Grid options.
AbstractReservoirGrid.getOptions
▸ 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.
| Name | Type | Description |
|---|---|---|
polyhedronIndex | number | the index of the polyhedron |
target | PolyhedronCellData | result |
void
IIntersectablePolyhedron.getPolyhedron
▸ getPolyhedronCount(): number
Return the total number of Polyhedrons contained by this object.
number
IIntersectablePolyhedron.getPolyhedronCount
▸ 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.
| Name | Type | Description |
|---|---|---|
target | Box3 | result |
void
IIntersectablePolyhedron.getPolyhedronsBoundingBox
▸ getSelectedProperties(): PickingCellData
Get IJK info of selected/highlighted cell.
▸ getVisible(): boolean
Get visible
boolean
true, if object is visible
AbstractReservoirGrid.getVisible
▸ 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.
| Name | Type | Description |
|---|---|---|
Optional ijk | number[] | the cell ijk position to highlight, or null to remove previous highlight. |
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(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.
| Name | Type | Description |
|---|---|---|
Optional index | number | the cell index to highlight, or null to remove previous highlight. |
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<T>(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>
| Name |
|---|
T |
| Name | Type | Description |
|---|---|---|
Optional event | Event<T> | The event to fire |
AbstractReservoirGrid.invalidateObject
▸ 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.
| Name | Type |
|---|---|
index | number |
boolean
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
AbstractReservoirGrid.isDisposed
▸ isIJKValidInFilter(ijk): boolean
Return true if the given IJK is valid by the IJK filter of the VoxelGrid, false if is filtered out.
| Name | Type |
|---|---|
ijk | number[] | IJKIndex |
boolean
▸ 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).
| Name | Type |
|---|---|
polyhedronIndex | number |
boolean
true if filtered out, otherwise false
IIntersectablePolyhedron.isPolyhedronIndexFilteredOut
▸ isSelectable(): boolean
Return if this object can be picked/selected (see RendererPicking).<br>
boolean
AbstractReservoirGrid.isSelectable
▸ 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.
| Name | Type |
|---|---|
value | number |
boolean
▸ notify<E>(type, source, args?): VoxelGrid
- Notify listeners. Parent nodes will also be notified if they are instances of geotoolkit3d.scene.Object3D
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | VoxelGrid | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ off<E>(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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: VoxelGrid, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(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>
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: VoxelGrid, args: EventMap[E]) => void | to be called |
this
▸ 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.
| Name | Type | Description |
|---|---|---|
metrics | PerformanceMetrics | The performance metrics. |
AbstractReservoirGrid.onStatsUpdated
▸ Protected onVisibilityChanged(): void
This method is called if visibility is changed. Send event Events.VisibilityChanged
void
AbstractReservoirGrid.onVisibilityChanged
▸ remove(object): VoxelGrid
Removes object as child of this object.
| Name | Type | Description |
|---|---|---|
object | Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[] | object |
this
▸ removeHighlightShape(): void
Remove the current cell highlight effect on this grid.
void
AbstractReservoirGrid.removeHighlightShape
▸ 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.
| Name | Type |
|---|---|
cellsValues | CellsValues |
▸ setColorProvider(colorProvider): VoxelGrid
Set the colorProvider for this Grid.
| Name | Type | Description |
|---|---|---|
colorProvider | ColorProvider | the color provider |
▸ 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.
| Name | Type |
|---|---|
options | OptionsBase |
AbstractReservoirGrid.setOptions
▸ setPosition(position): VoxelGrid
Set Object's local position.
| Name | Type | Description |
|---|---|---|
position | Object | local position |
Optional position.x | number | |
Optional position.y | number | |
Optional position.z | number |
this
AbstractReservoirGrid.setPosition
▸ setRotation(x, y, z, order?): VoxelGrid
Set Object's local rotation (Euler angles), in radians.
| Name | Type | Description |
|---|---|---|
x | number | x angle |
y | number | y angle |
z | number | z angle |
Optional order | EulerOrder | euler order |
this
AbstractReservoirGrid.setRotation
▸ setSelectable(selectable): void
Set if this object can be picked/selected (see RendererPicking).<br>
| Name | Type | Description |
|---|---|---|
selectable | boolean | if can be selected |
void
AbstractReservoirGrid.setSelectable
▸ setVisible(visible, silent?): VoxelGrid
Set visible
| Name | Type | Description |
|---|---|---|
visible | boolean | true, if object is visible |
Optional silent | boolean | true, if object shouldn't be invalidated |
this
AbstractReservoirGrid.setVisible
▸ 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.
▸ 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
| Name | Type | Description |
|---|---|---|
scene | Scene | The scene |
camera | Camera | The camera |
AbstractReservoirGrid.updateObject
▸ 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.
boolean
AbstractReservoirGrid.useOwnHighlight
▸ Static getClassName(): string
string
AbstractReservoirGrid.getClassName
▸ 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.
void