# FreeBSD Manual Pages

vpNormalIndex(3) Library Functions Manual vpNormalIndex(3)NAMEvpNormalIndex, vpNormal - encode/decode a surface normal vectorSYNOPSIS#include <volpack.h> intvpNormalIndex(nx,ny,nz)doublenx,ny,nz;vpResultvpNormal(n,nx_ptr,ny_ptr,nz_ptr)intn;double *nx_ptr,*ny_ptr,*nz_ptr;ARGUMENTSnxX component of surface normal vector.nyY component of surface normal vector.nzZ component of surface normal vector.nEncoded surface normal vector.nx_ptrPointer to storage for returning X component of surface normal vector.ny_ptrPointer to storage for returning Y component of surface normal vector.nz_ptrPointer to storage for returning Z component of surface normal vector.DESCRIPTIONThese two routines are used to convert surface normal vectors between encoded and unencoded forms. An unencoded vector is described by its three components (stored as double-precision floating point numbers) in an orthogonal coordinate system. An encoded vector is described by a single integer that is suitable for use as an index in a shading lookup table. VolPack's built-in shading routines require the use of surface normal vectors encoded usingvpNormalIndex(or one of the higher-level normal vector computation routines,vpVolumeNormalsorvpScanlineNor-mals). User-defined shading routines or lookup tables are not required to use encoded normal vectors.vpNormalIndexcomputes an encoded vector from the components of an un- encoded vector. The vector must be normalized (nx*nx+ny*ny+nz*nz=1). The maximum possible value of an encoded normal is given by the constant VP_NORM_MAX.vpNormalcomputes the components of a vector from the encoded integer form. The encoded normal has less resolution than the unencoded form, so the vector computed byvpNormalmay not be equal to the original vector passed tovpNormalIndex.ERRORSvpNormalIndexalways returns a valid encoded normal vector.vpNormalnormally returns the value VP_OK. The following return value is possible: VPERROR_BAD_VALUE The encoded normal vector is invalid.SEE ALSOVolPack(3), vpVolumeNormals(3), vpScanlineNormals(3) VolPack vpNormalIndex(3)

NAME | SYNOPSIS | ARGUMENTS | DESCRIPTION | ERRORS | SEE ALSO

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=volpack-NormalIndex&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>