# Voxel

Let’s assume there is a 3D grid of voxels like below. Filled voxels represent a 3D model and empty voxels represent space.

# Loop over voxels

Shown by this pseudocode, the iteration over voxels is done by their `x, y, z`

index:

```
for x := 1, Nx;
for y := 1, Ny;
for z := 1, Nz;
if voxelIsEmpty continue;
// 3D coordinates of 8 voxel corners are floating-point values.
voxelCornersX = [x1, x2, x3, x4, x5, x6, x7, x8];
voxelCornersY = [y1, y2, y3, y4, y5, y6, y7, y8];
voxelCornersZ = [z1, z2, z3, z4, z5, z6, z7, z8];
// TODO: create a hexahedral element by the 8 corners.
endfor
endfor
endfor
```

# Question

How can I create a single hex element for a filled voxel, if the voxel corner coordinates are known?

As far as I study the documentation, the CGX should be used by creating a geometry (line, surface, volume) and then creating finite elements through the geometry. The problem is that I don’t create a geometry in advance. I’m a bit confused. I appreciate any hints. Thanks.