Requirements for running code
-
Computational Geometric Algorithms
library : My code used version 2.0
-
Geomview : Used
for viewing generated octrees
Installing
The installation part is tricky as you have
to first install CGAL -2.0 or higher. The way the code has been integrated
with CGAL, it is better if you follow the following procedure
-
Install CGAL.
-
Now untar the src archive file octree.tar.gz in the CGAL
home directory.
cd CGAL_HOME;
tar xvzf octree.tar.gz
-
Now you will have to edit the makefile in octree/ directory
- as CGAL installation will change certain path names. Typically you have
to make the following changes
-
Set the variable CGAL_MAKEFILE accordingly.
-
Set the include flags - so that compiler looks for header
files in octree/include directory
-
Now set the path variable so that it includes the directory
octree/3dpmc. This is where the program for 3dpmc used by the code is there.
set PATH=$PATH:${CGAL_HOME}/octree/3dpmc
-
Now to compile 3dpmc program.
cd octree/3dpmc
gcc 3d_pmc.c -lm -o 3dpmc
-
Now to compile octree programs
cd octree
make test_octree
make cgal_poly_to_poly
Installation complete
Making it Run
-
Generating input files :
-
Input file for polyhedron : This has to be a file in
OFF format. Examples in octree/data.
-
Input file for 3dpmc program : This is generated from
file above.
cgal_poly_to_poly <off_file> > 3dpmc.in
Note : you must redirect the output
to 3dpmc.in - no other filename
-
Running the program :
test_octree <off_file> <result_file> <depth>
where,
off_file = input file in off format (see above)
result file = file to be used for viewing in geomview
depth = max depth of a node in the octree.
-
Finally viewing the file :
-
The program sometimes runs out of memory - so the output
file - might be broken in sequence resulting in breaks in file. So some
corrections have to be perfromed by hand. Edit the result file - the format
is easy
LIST {
{
}
{
}
....
{
}
}
The LIST opening brace (show in purple) specifies a list of OFF
objects octants in our case and the braces one level below
(shown in red) are the octants : you need to insert one brace after
the first opening brace for LIST. At the end if any octant is left out
delete the octant and then close the LIST brace.
-
Now open the file in Geomview Voila !!!