1vpScanlineNormals(3)       Library Functions Manual       vpScanlineNormals(3)
2
3
4

NAME

6       vpScanlineNormals  - compute surface normal vectors and gradient magni‐
7       tudes for a scanline
8

SYNOPSIS

10       #include <volpack.h>
11
12       vpResult
13       vpScanlineNormals(vpc,     length,     scalar_data,     scalar_minus_y,
14               scalar_plus_y,   scalar_minus_z,   scalar_plus_z,   voxel_data,
15               scalar_field, grad_field, norm_field)
16           vpContext *vpc;
17           int length;
18           unsigned char *scalar_data;
19           unsigned char *scalar_minus_y, *scalar_plus_y;
20           unsigned char *scalar_minus_z, *scalar_plus_z;
21           void *voxel_data;
22           int scalar_field;
23           int grad_field;
24           int norm_field;
25

ARGUMENTS

27       vpc    VolPack context from vpCreateContext.
28
29       length Size of scalar_data array in bytes.
30
31       scalar_data
32              1D array of scalar samples.
33
34       scalar_minus_y
35              1D array of scalar samples adjacent to  scalar_data  in  the  -Y
36              direction.
37
38       scalar_plus_y
39              1D  array  of  scalar  samples adjacent to scalar_data in the +Y
40              direction.
41
42       scalar_minus_z
43              1D array of scalar samples adjacent to  scalar_data  in  the  -Z
44              direction.
45
46       scalar_plus_z
47              1D  array  of  scalar  samples adjacent to scalar_data in the +Z
48              direction.
49
50       voxel_data
51              1D array of voxels for storing results.
52
53       scalar_field
54              Voxel field number indicating the field in which  to  store  the
55              scalar samples.
56
57       grad_field
58              Voxel  field  number  indicating the field in which to store the
59              gradient magnitudes of the scalar samples.
60
61       norm_field
62              Voxel field number  indicating  the  field  in  which  to  store
63              encoded surface normal vectors.
64

DESCRIPTION

66       vpScanlineNormals is used to precompute values for voxel fields used in
67       classification and shading algorithms.  The input is a collection of  5
68       adjacent 1D arrays of scalar values; a separate routine is provided for
69       processing a full 3D array  of  voxel  data  (see  vpVolumeNormals(3)).
70       vpScanlineNormals is useful for loading large volumes into memory scan‐
71       line-by-scanline and precomputing voxel fields  incrementally,  instead
72       of  loading  a  complete copy of the 3D scalar array in addition to the
73       voxel array.  In all other respects this routine is identical in  func‐
74       tion to vpVolumeNormals.
75
76       The  1D  scalar  arrays must be arrays of 8-bit values (other sizes are
77       not currently supported).  The length parameter indicates both the size
78       and  the  number  of  elements in each of the scalar arrays.  vpScanli‐
79       neNormals performs the computation described in vpVolumeNormals(3), but
80       only  for the single scanline specified by scalar_data.  The other four
81       scanline arguments must be the immediately adjacent scanlines  and  are
82       used to compute the gradient.
83
84       The  results  are  stored in the voxel_data array which must have space
85       for the same number of voxels as the length  of  one  scalar  scanline.
86       The  size of a voxel must be specified with vpSetVoxelSize before call‐
87       ing vpScanlineNormals, but it is not necessary to call  vpSetRawVoxels.
88       The  arguments  scalar_field,  grad_field  and norm_field specify which
89       voxel fields the computed quantities should be stored into.  The  field
90       numbers  must correspond to appropriately-sized voxel fields previously
91       specified with vpSetVoxelField.  Any of these arguments can be the con‐
92       stant  VP_SKIP_FIELD,  in  which case the corresponding quantity is not
93       computed or copied.  The voxel fields for the scalar value and the gra‐
94       dient  magnitude must be one-byte fields, and the field for the surface
95       normal vector must be a two-byte field.  The  constants  VP_SCALAR_MAX,
96       VP_GRAD_MAX and VP_NORM_MAX give the maximum value that might be stored
97       in each field, respectively.  The value stored in  the  surface  normal
98       vector  field  is  actually  an encoded surface normal; see vpNormalIn‐
99       dex(3).
100

ERRORS

102       The normal return value is VP_OK.  The following  error  return  values
103       are possible:
104
105       VPERROR_BAD_VALUE
106              One  or  more  of  the voxel fields specified is invalid, or the
107              corresponding voxel field has the wrong size.
108
109       VPERROR_BAD_VOXEL
110              The voxel size or the voxel fields have not  been  specified  or
111              have been incorrectly specified.
112

SEE ALSO

114       VolPack(3),  vpCreateContext(3),  vpNormalIndex(3), vpVolumeNormals(3),
115       vpSetClassifierTable(3), vpSetLookupShader(3)
116
117
118
119VolPack                                                   vpScanlineNormals(3)
Impressum