Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## vfill

Syntax:

         vfill  FILE using x:y:z:radius:(<expression>)
         vgfill FILE using x:y:z:radius:(<expression>)

The vfill command acts analogously to a plot command except that instead of creating a plot it modifies voxels in the currently active voxel grid. For each point read from the input file, the voxel containing that point and also all other voxels within a sphere of given radius centered about (x,y,z) are incremented as follows:

- user variable VoxelDistance is set to the distance from (x,y,z) to that voxel's origin in user coordinates (vx,vy,vz).
- user variable GridDistance is set to the distance from (x,y,z) to that voxel's origin in grid coordinates.
- The expression provided in the 5th using specifier is evaluated. This expression can use the new value of VoxelDistance and/or GridDistance.
- voxel(vx,vy,vz) += result of evaluating <expression>

Examples:

         vfill "file.dat" using 1:2:3:(3.0):(1.0)

This command adds 1 to the value of every voxel within a sphere of radius 3.0 around each point in file.dat. The number of voxels that this sphere impinges on depends on the grid spacing in user coordinates, which may be different along the x, y, and z directions.

         vgfill "file.dat" using 1:2:3:(2):(1.0)

This command adds 1 to the value of voxels within a 5x5x5 cube of voxels centered on the current point. The radius "2" is interpreted as extending exactly 2 voxels in either direction along x, 2 voxels in either direction along y, etc, regardless of the relative scaling of user coordinates along those axes.

Example:

         vfill "file.dat" using 1:2:3:4:(VoxelDistance < 1 ? 1 : 1/VoxelDistance)

This command modifies all voxels in a sphere whose radius is determined for each point by the content of column 4. The increment added to a voxel decreases with its distance from the data point.

Note that vfill and vgfill always increments existing values in the current voxel grid. To reset a single voxel to zero, use voxel(x,y,z) = 0. To reset the entire grid to zero, use vclear.