Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] compile an example code on win32 to produce stand-alone binary

Subject: CGAL users discussion list

List archive

[cgal-discuss] compile an example code on win32 to produce stand-alone binary


Chronological Thread 
  • From: Qianqian Fang <>
  • To:
  • Subject: [cgal-discuss] compile an example code on win32 to produce stand-alone binary
  • Date: Mon, 02 Feb 2009 17:34:30 -0500

hi

I want to ask a favor from this list. I modified the Surface-mesher example
in CGAL 3.4beta and want to use the compiled binary for my application,
however, I was only able to get the code compiled on Linux but not
windows. I spent one day or so but still can not get it working.

I am wondering if anyone who had set up CGAL 3.4 on a windows
machine can help me to produce this binary. The modified code is
attached. I hope the resulting binary can be run stand-alone, which,
I guess, requires to link against the static libraries. I also noticed
that this code requires CGALImageIO, which depends on zlib, I can
not find any static lib for zlib, but if that's the only thing it needs, it is ok.

thank you in advance

Qianqian
#include <CGAL/Surface_mesh_default_triangulation_3.h>
#include <CGAL/Surface_mesh_default_criteria_3.h>
#include <CGAL/Complex_2_in_triangulation_3.h>
#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>
#include <fstream>
#include <CGAL/make_surface_mesh.h>
#include <CGAL/Gray_level_image_3.h>
#include <CGAL/Implicit_surface_3.h>

// default triangulation for Surface_mesher
typedef CGAL::Surface_mesh_default_triangulation_3 Tr;

// c2t3
typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;

typedef Tr::Geom_traits GT;
typedef CGAL::Gray_level_image_3<GT::FT, GT::Point_3> Gray_level_image;
typedef CGAL::Implicit_surface_3<GT, Gray_level_image> Surface_3;

int main(int argc, char** argv) {
  Tr tr;            // 3D-Delaunay triangulation
  C2t3 c2t3 (tr);   // 2D-complex in 3D-Delaunay triangulation

  // the 'function' is a 3D gray level image
  if(argc!=11){
	printf("command options:\n cgalsurf.mexglx inrfile thres x0 y0 z0 r2 ang br bd outputoff\nFor example:\n\
     ./cgalsurf.mexglx data/skull_2.9.inr 2.9 122. 102. 117. 80000 30 5. 5. out.off\n");
	exit(1);
  }
  
  Gray_level_image image(argv[1], atof(argv[2]));

  // Carefully choosen bounding sphere: the center must be inside the
  // surface defined by 'image' and the radius must be high enough so that
  // the sphere actually bounds the whole image.
  GT::Point_3 bounding_sphere_center(atof(argv[3]), atof(argv[4]), atof(argv[5]));
  GT::FT bounding_sphere_squared_radius = atof(argv[6]);
  GT::Sphere_3 bounding_sphere(bounding_sphere_center,
                                   bounding_sphere_squared_radius);

  // definition of the surface, with 10^-5 as relative precision
  Surface_3 surface(image, bounding_sphere, 1e-5);

  // defining meshing criteria
  CGAL::Surface_mesh_default_criteria_3<Tr> criteria(atof(argv[7]),
                                                     atof(argv[8]),
                                                     atof(argv[9]));

  // meshing surface, with the "manifold without boundary" algorithm
  CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Manifold_tag());
  std::ofstream out(argv[10]);
  CGAL::output_surface_facets_to_off (out, c2t3);
  std::cout << "Final number of points: " << tr.number_of_vertices() << "\n";
}



Archive powered by MHonArc 2.6.16.

Top of Page