Provided by: libvolpack1-dev_1.0b3-3_amd64

**NAME**

vpScanlineNormals - compute surface normal vectors and gradient magnitudes for a scanline

**SYNOPSIS**

#include <volpack.h> vpResultvpScanlineNormals(vpc,length,scalar_data,scalar_minus_y,scalar_plus_y,scalar_minus_z,scalar_plus_z,voxel_data,scalar_field,grad_field,norm_field)vpContext *vpc;intlength;unsigned char *scalar_data;unsigned char *scalar_minus_y,*scalar_plus_y;unsigned char *scalar_minus_z,*scalar_plus_z;void *voxel_data;intscalar_field;intgrad_field;intnorm_field;

**ARGUMENTS**

vpcVolPack context fromvpCreateContext.lengthSize ofscalar_dataarray in bytes.scalar_data1D array of scalar samples.scalar_minus_y1D array of scalar samples adjacent toscalar_datain the -Y direction.scalar_plus_y1D array of scalar samples adjacent toscalar_datain the +Y direction.scalar_minus_z1D array of scalar samples adjacent toscalar_datain the -Z direction.scalar_plus_z1D array of scalar samples adjacent toscalar_datain the +Z direction.voxel_data1D array of voxels for storing results.scalar_fieldVoxel field number indicating the field in which to store the scalar samples.grad_fieldVoxel field number indicating the field in which to store the gradient magnitudes of the scalar samples.norm_fieldVoxel field number indicating the field in which to store encoded surface normal vectors.

**DESCRIPTION**

vpScanlineNormalsis used to precompute values for voxel fields used in classification and shading algorithms. The input is a collection of 5 adjacent 1D arrays of scalar values; a separate routine is provided for processing a full 3D array of voxel data (see vpVolumeNormals(3)).vpScanlineNormalsis useful for loading large volumes into memory scanline-by-scanline and precomputing voxel fields incrementally, instead of loading a complete copy of the 3D scalar array in addition to the voxel array. In all other respects this routine is identical in function tovpVolumeNormals. The 1D scalar arrays must be arrays of 8-bit values (other sizes are not currently supported). Thelengthparameter indicates both the size and the number of elements in each of the scalar arrays.vpScanlineNormalsperforms the computation described in vpVolumeNormals(3), but only for the single scanline specified byscalar_data. The other four scanline arguments must be the immediately adjacent scanlines and are used to compute the gradient. The results are stored in thevoxel_dataarray which must have space for the same number of voxels as the length of one scalar scanline. The size of a voxel must be specified withvpSetVoxelSizebefore callingvpScanlineNormals,but it is not necessary to callvpSetRawVoxels.The argumentsscalar_field,grad_fieldandnorm_fieldspecify which voxel fields the computed quantities should be stored into. The field numbers must correspond to appropriately-sized voxel fields previously specified withvpSetVoxelField. Any of these arguments can be the constant VP_SKIP_FIELD, in which case the corresponding quantity is not computed or copied. The voxel fields for the scalar value and the gradient magnitude must be one-byte fields, and the field for the surface normal vector must be a two-byte field. The constants VP_SCALAR_MAX, VP_GRAD_MAX and VP_NORM_MAX give the maximum value that might be stored in each field, respectively. The value stored in the surface normal vector field is actually an encoded surface normal; see vpNormalIndex(3).

**ERRORS**

The normal return value is VP_OK. The following error return values are possible: VPERROR_BAD_VALUE One or more of the voxel fields specified is invalid, or the corresponding voxel field has the wrong size. VPERROR_BAD_VOXEL The voxel size or the voxel fields have not been specified or have been incorrectly specified.

**SEE** **ALSO**

VolPack(3), vpCreateContext(3), vpNormalIndex(3), vpVolumeNormals(3), vpSetClassifierTable(3), vpSetLookupShader(3)