vpClassifyScalars(3)

πŸ’– vpClassifyScalars(3) πŸ’–

okay bestie, so this is a library functions manual page for vpClassifyScalars(3), and it's literally the shortcut queen of the VolPack world. let's get into it 🫢


✨ NAME ✨

vpClassifyScalars β€” create a preclassified volume from scalar data. that's it, that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

#include <volpack.h>

vpResult
vpClassifyScalars(vpc, scalar_data, length, scalar_field,
        gradient_field, norm_field)
    vpContext *vpc;
    unsigned char *scalars;
    int size;
    int scalar_field, gradient_field, norm_field;

πŸ¦‹ ARGUMENTS πŸ¦‹

  • vpc β€” the VolPack context you got from vpCreateContext. your main character.
  • scalar_data β€” a 3D array holding one 8-bit scalar value for each voxel in the volume. every voxel gets exactly one lil byte, no more no less.
  • length β€” size of scalar_data in bytes. yes, bytes. πŸ‘‘
  • scalar_field β€” field number identifying a voxel field for storing the scalar value.
  • gradient_field β€” field number identifying a voxel field for storing the gradient magnitude of the scalar value.
  • norm_field β€” field number identifying a voxel field for storing the surface normal vector for the voxel.

πŸ’… DESCRIPTION πŸ’…

vpClassifyScalars is giving combo move energy: it smooshes together the functionality of vpVolumeNormals and vpClassifyVolume so you can produce a preclassified volume directly from a 3D array of scalar values β€” no 3D voxel array needed. periodt.

it's highkey made for preparing large data sets for rendering with a fixed classification function, especially when the 3D voxel array would be too big to fit in main memory. like, if it doesn't fit, this is your girl. πŸ’–

the primary limitation (and bestie, we must talk about it): the only fields each voxel may contain are the fields produced by vpVolumeNormals β€” that's an 8-bit scalar value, and an 8-bit gradient and/or a 16-bit surface normal vector. that's the whole menu, no substitutions.

also, if you want to process one scanline of a scalar array at a time instead, go look at vpClassifyScanline. 🌈

how to actually use it, step by step 🧚

  1. first, define the volume size, voxel size, and voxel fields exactly like you would before calling vpVolumeNormals.
  2. however β€” and this is the slay part β€” there is no need to call vpSetRawVoxels. skip it. not needed. πŸ™ˆ
  3. also define the opacity transfer function (see vpSetClassifierTable(3)).
  4. then call vpClassifyScalars with the same arguments you would use for vpVolumeNormals β€” peep vpVolumeNormals(3) for more details.
  5. the result is a preclassified volume, as described in vpClassifyVolume(3). iconic.

if a voxel array has been declared, it is not used or modified. it's just sitting there, unbothered, moisturized, in its lane. πŸ’…

⚠️ heads up: any existing preclassified volume data is destroyed. gone. say bye. πŸ’€

⭐ STATE VARIABLES ⭐

you can retrieve info about the current preclassified volume with these state variable codes (see vpGeti(3)):

  • VP_VIEW_X_SIZE
  • VP_VIEW_Y_SIZE
  • VP_VIEW_Z_SIZE
  • VP_VIEW_X_AXIS
  • VP_VIEW_Y_AXIS
  • VP_VIEW_Z_AXIS

😭 ERRORS 😭

the normal return value is VP_OK. but sometimes things go sideways, and these are the possible error return values:

  • VPERROR_BAD_VOXEL β€” the voxel size or the voxel fields have not been specified, or have been incorrectly specified. bestie. you forgot a step.
  • VPERROR_BAD_CLASSIFIER β€” the opacity transfer function tables have invalid sizes, or are associated with invalid voxel fields, or have been incorrectly specified. the classifier said no. πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

VolPack(3), vpCreateContext(3), vpVolumeNormals(3), vpSetClassifierTable(3), vpClassifyVolume(3), vpClassifyScanline(3)


that's the whole page, bestie, no cap πŸ’œ this came out of the VolPack library β€” volume rendering royalty β€” and it's the vpClassifyScalars(3) page, so if you ever forget, just remember: VolPack, vpClassifyScalars(3), and you're set. slay, go classify some scalars. βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from