eulerjs API / @eulerjs/core / Voxels
Voxels
Defined in: packages/core/src/Voxels.ts:35
A solid approximated by equal cubes, in the frame of the geometry it was built from. Used to sample how much of a hull is under water, and to give open meshes mass properties.
Constructors
Constructor
new Voxels(cellSize, cells): Voxels;Defined in: packages/core/src/Voxels.ts:40
Parameters
| Parameter | Type |
|---|---|
cellSize | number |
cells | readonly Vector3[] |
Returns
Voxels
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
cells | readonly | readonly Vector3[] | Centres of the cells inside the solid. | packages/core/src/Voxels.ts:38 |
cellSize | readonly | number | - | packages/core/src/Voxels.ts:36 |
Accessors
cellVolume
Get Signature
get cellVolume(): number;Defined in: packages/core/src/Voxels.ts:45
Returns
number
volume
Get Signature
get volume(): number;Defined in: packages/core/src/Voxels.ts:49
Returns
number
Methods
fromGeometry()
static fromGeometry(geometry, options?): Voxels;Defined in: packages/core/src/Voxels.ts:66
Fills a grid of cells over the geometry's bounding box and keeps those inside the surface.
A cell is inside when lines through it along at least two of the three axes cross the surface an odd number of times before reaching it. Voting across axes makes the result robust to holes: an open deck fools the vertical lines but not the horizontal ones. Faces count from both sides, so winding and material settings don't matter.
Parameters
| Parameter | Type |
|---|---|
geometry | BufferGeometry |
options? | VoxelizeOptions |
Returns
Voxels
massProperties()
massProperties(specification): MassProperties;Defined in: packages/core/src/Voxels.ts:54
Mass properties of the voxelized solid with uniform density, from its total mass or its density.
Parameters
| Parameter | Type |
|---|---|
specification | number | MassSpecification |
