Howto to compile with the vol library |
| Here is some stuff that you should use in your makefiles. |
CC=g++ |
|
LIB=-lm -L/path/to/libvol/lib -lvol |
|
INCLUDE=-I/path/to/libvol/include |
|
|
hello-vol : hello-vol.o $(CC) -o hello-vol hello-vol.o $(LIB) hello-vol.o : hello-vol.cc $(CC) -c hello-vol.cc $(INCLUDE) |
hello-vol.cc |
#include <vol.h>
#include <stdio.h>
int main() {
Vol myvolume( 16, 16, 16, 0 );
|
|
printf( "Here are the bounds of my volume object :\n\
X : [ %d, %d [,\n\
Y : [ %d, %d [,\n\
Z : [ %d, %d [.\n",
myvolume.minX(), myvolume.maxX(),
myvolume.minY(), myvolume.maxY(),
myvolume.minZ(), myvolume.maxZ()
);
|
|
Here are the bounds of my volume object :
X : [ -8, 8 [,
Y : [ -8, 8 [,
Z : [ -8, 8 [.
|
|
// We want to color every voxel of coordinates (x, y, z) where x*y*z >= 0.
for (int i = myvolume.minX(); i < myvolume.maxX(); ++i) {
for (int j = myvolume.minY(); j < myvolume.maxY(); ++j) {
for (int k = myvolume.minZ(); k < myvolume.maxZ(); ++k) {
|
|
if (i*j*k >= 0) if (i*j*k >= 0)
myvolume( i, j, k ) = 100; myvolume.set( i, j, k, 100 );
|
|
}
}
}
myvolume.dumpVol( "hello.vol" );
|
|
return 0; } |
|
[user@host ~]$ vol2geom hello |
| Vol2geom will produce a file called 'hello.geom'. |