Step four : advanced features
Q & A
- Can I create raw files with the vol library ?"
- What sort of operations can I do between two volumes ?
- How do I change the bounds of my volume ?
- I'd love to reinvent wheel but I do not have much time, what else the Vol class provides ?
- Where can I find more documentation on libvol ?
Can I create raw files with the vol library ?
Of course ! There is a member function called dumpRaw. You can alors convert a vol file in raw format with vol2raw program that comes with the library.
up
What sort of operations can I do between two volumes ?
There are three builtin operations provided by the Vol class :
- Union :
Vol v = v1 | v2;
Every non-transparent voxel in v1 or v2 will be in v.
- Intersection :
Vol v = v1 & v2;
Every non-transparent voxel in v1 and v2 will be in v.
- Substraction :
Vol v = v1 - v2;
Every non-transparent voxel in v1 that is transparent in v2 will be in v.
What happen if the operands don't have the same size ?
- A copy of the left operand is made, then it is resized. The old voxels are centered in the new volume.
What do the colors become ?
- The colors of the result are often the colors of the left operand. But you should not count on this.
up
How do I change the bounds of my volume ?
You cannot resize a volume, there will always be the same number of voxel in each dimension (you can know these number with the member functions sizeT where T is X, Y or Z).
But you can change the center of a volume (the default is the point (0, 0, 0)). Use the member function setVolumeCenter. At any time, you can know the center of the volume with the member functions cX(), cY() and cZ().
up
I'd love to reinvent wheel but I do not have much time, what else the Vol class provides ?
- invert() : inverts the volume, as in the program we made in step 2.
- symetry( int maxx, int maxy, int maxz ) :
- All points (x, y, z) where x is in [0,maxx[, y in [0, maxy[, z in [0, maxz[ are used to make a symetry of the volume. Example :
-
- inBounds( int x, int y, int z ) : returns true if this point is in the volume.
up
Where can I find more documentation on libvol ?
A doxygen documentation was generated at compile-time if doxygen is available.
If this link doesn't work, try to recompile libvol and pass option --doc=yes to the configure script.
up