Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: question about running cgal example in qt-creator.

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: question about running cgal example in qt-creator.


Chronological Thread 
  • From: 魏华祎 <>
  • To:
  • Subject: [cgal-discuss] Re: question about running cgal example in qt-creator.
  • Date: Mon, 3 Jun 2013 20:21:31 +0800

Dear all

      I use QT Creator 2.4.1 as my IDE, and my system is Ubuntu 12.04 amd 64. My CGAL version is 4.2.  When I  run the example of CGAL/exmaple/Mesh_3/mesh_polyhedral_domain_with_features.cpp in QT Creator, I meet such a problem:

%%%%%%%%%%
Starting /home/huayiwei/work/program/meshGenerator/example/Regular_triangulation/Mesh_3/build/mesh_polyhedral_domain_with_features...

terminate called after throwing an instance of 'CGAL::Precondition_exception'

what(): CGAL ERROR: precondition violation!

Expr: !empty()

File: /usr/local/include/CGAL/AABB_tree.h

Line: 152

The program has unexpectedly finished.
%%%%%%%%%%%%%%%

But I can run the compiled program directly in my bash shell and get the result mesh.  Did anyone ever meet the same problem? Please help, thanks a lot.

Best

Huayi


2013/6/3 魏华祎 <>
Dear all

      I use QT Creator 2.4.1 as my IDE, and my system is Ubuntu 12.04 amd 64. My CGAL version is 4.2.  When I  run the example of CGAL/exmaple/Mesh_3/mesh_polyhedral_domain_with_features.cpp in QT Creator, I meet such a problem:

%%%%%%%%%%
Starting /home/huayiwei/work/program/meshGenerator/example/Regular_triangulation/Mesh_3/build/mesh_polyhedral_domain_with_features...

terminate called after throwing an instance of 'CGAL::Precondition_exception'

what(): CGAL ERROR: precondition violation!

Expr: !empty()

File: /usr/local/include/CGAL/AABB_tree.h

Line: 152

The program has unexpectedly finished.
%%%%%%%%%%%%%%%

But I can run the compiled program directly in my bash shell and get the result mesh.  Did anyone ever meet the same problem? Please help, thanks a lot.

Best

Huayi

# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.


project( Mesh_3_example )

cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}"
VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()


add_definitions(-DCGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX
-DCGAL_MESH_3_NO_DEPRECATED_C3T3_ITERATORS)

if ( MESH_3_VERBOSE )
add_definitions(-DCGAL_MESH_3_VERBOSE)
endif()

find_package(CGAL COMPONENTS ImageIO)

if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
find_package(Boost)

if ( Boost_FOUND AND Boost_VERSION GREATER 103400 )
include( CGAL_CreateSingleSourceCGALProgram )

# Compilable examples
# create_single_source_cgal_program( "mesh_implicit_sphere.cpp" )
# create_single_source_cgal_program(
"mesh_implicit_sphere_variable_size.cpp" )
# create_single_source_cgal_program(
"mesh_two_implicit_spheres_with_balls.cpp" )
# create_single_source_cgal_program( "mesh_implicit_domains.cpp"
"implicit_functions.cpp" )
# create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" )
create_single_source_cgal_program(
"mesh_polyhedral_domain_with_features.cpp" )

# create_single_source_cgal_program(
"mesh_polyhedral_implicit_function.cpp" )
# create_single_source_cgal_program(
"mesh_polyhedral_surface_tolerance_region.cpp" )
# create_single_source_cgal_program(
"mesh_polyhedral_edge_tolerance_region.cpp" )

else()
message(STATUS "NOTICE: This program requires Boost >= 1.34.1, and will
not be compiled.")
endif()

else()
message(STATUS "This program requires the CGAL library, and will not be
compiled.")
endif()

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>

#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>

// Domain 
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;

// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<
  Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;

// Criteria
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;

// To avoid verbose function and named parameters call
using namespace CGAL::parameters;

int main()
{
  // Create domain
  Mesh_domain domain("data/fandisk.off");
  
  // Get sharp features
  domain.detect_features();

  // Mesh criteria
  Mesh_criteria criteria(edge_size = 0.025,
                         facet_angle = 25, facet_size = 0.05, facet_distance = 0.005,
                         cell_radius_edge_ratio = 3, cell_size = 0.05);
  
  // Mesh generation
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);

  // Output
  std::ofstream medit_file("out.mesh");
  c3t3.output_to_medit(medit_file);
}



Archive powered by MHonArc 2.6.18.

Top of Page