Problem in 3D Triangulation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem in 3D Triangulation

Yang Liu-5
Dear all,

Recently I am using CGAL to compute 3D triangulation.
For some input data,  the 3D triangulation does not work.

My simple test code is attached at the end of this email.

I am using Microsoft Visual Studio 2008 and CGAL-3.3.1.
The CGAL library is recompiled under VS2008.

My program always reports "Microsoft C++ exception: CGAL::Uncertain_conversion_exception at memory location ..." in debug mode.

In release mode, the program stops at some place, the call stack is attached after my sample code.


I have tried to use Exact_predicates_exact_constructions_kernel,
the problem is still there.

Does anyone know how to solve this problem ?


Thanks.

Yang Liu

INRIA - LORIA


-----------------------------------------------------------------------------------------

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_3.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_3<K>  Triangulation3D;
typedef Triangulation3D::Point    Point3D;

#include <iostream>
#include <fstream>

int main()
{
Triangulation3D DT;

std::ifstream mout("c:\\test.txt");
for (int i = 0; i < 7; i++)
{
double x, y, z;
mout >> x >> y >> z;
DT.insert(Point3D(x,y,z));
}
mout.close();

return 0;
}
-------------------------------------------------------------------
test.txt

5.2797039788822553e-002 -1.0000000000000000e+000 -8.5052301668333641e-001
-6.4775641845221166e-001 -1.0000000000000000e+000 8.8775770697145473e-001
4.9765656210897458e-001 -2.5474338749700953e-001 5.0567501274491111e-001
1.0000000000000000e+000 -1.0000000000000000e+000 1.2851343478562227e-001
1.0000000000000000e+000 -1.0000000000000000e+000 -5.0824290316902976e-001
-3.1646143449986469e-001 -1.0000000000000000e+000 1.0000000000000000e+000
-3.0282326636478069e-001 -8.4918673507225406e-001 1.0000000000000000e+000

-----------------------------
Call stack in release mode

testcgal.exe!std::vector<short,std::allocator<short> >::_Ufill(short * _Ptr=0x005f74fc, unsigned int _Count=1, const short & _Val=8422)  Line 1259 + 0x19 bytes

testcgal.exe!std::vector<short,std::allocator<short> >::_Insert_n()  + 0x10d bytes

testcgal.exe!std::vector<short,std::allocator<short> >::insert()  + 0x4e bytes

testcgal.exe!std::vector<short,std::allocator<short> >::push_back()  + 0x62 bytes

testcgal.exe!CGAL::MP_Float::construct_from_builtin_fp_type<double>()  + 0x144 bytes

testcgal.exe!CGAL::MP_Float::MP_Float()  + 0x46 bytes

testcgal.exe!CGAL::Split_double<CGAL::MP_Float>::operator()(double d=0.12851343478562227, CGAL::MP_Float & num={...}, CGAL::MP_Float & den={...})  Line 70 + 0x13 bytes

testcgal.exe!CGAL::Quotient<CGAL::MP_Float>::Quotient<CGAL::MP_Float>(const double & n=0.12851343478562227)  Line 94

testcgal.exe!CGAL::NT_converter<double,CGAL::Quotient<CGAL::MP_Float> >::operator()(const double & a=)  Line 39 + 0xf bytes

testcgal.exe!CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Simple_cartesian<CGAL::Quotient<CGAL::MP_Float> >,CGAL::NT_converter<double,CGAL::Quotient<CGAL::MP_Float> > >::operator()(const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & a={...})  Line 225 + 0x13 bytes

testcgal.exe!CGAL::Filtered_predicate<CGAL::CartesianKernelFunctors::Orientation_3<CGAL::Simple_cartesian<CGAL::Quotient<CGAL::MP_Float> > >,CGAL::CartesianKernelFunctors::Orientation_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >,CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Simple_cartesian<CGAL::Quotient<CGAL::MP_Float> >,CGAL::NT_converter<double,CGAL::Quotient<CGAL::MP_Float> > >,CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Simple_cartesian<CGAL::Interval_nt<0> >,CGAL::NT_converter<double,CGAL::Interval_nt<0> > >,1>::operator()<CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > >(const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & a1={...}, const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & a2={...}, const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & a3={...}, const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & a4={...})  Line 457 + 0xf bytes

testcgal.exe!CGAL::SF_Orientation_3<CGAL::Filtered_kernel_base<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > >,CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > > >::operator()(const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & p={...}, const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & q={...}, const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & r={...}, const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & s={...})  Line 127

testcgal.exe!CGAL::TR3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS3<CGAL::T_vb3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS_vb3<void> >,CGAL::T_cb3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS_cb3<void> > > >::locate(const CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> > > & p={...}, CGAL::TR3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS3<CGAL::T_vb3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS_vb3<void> >,CGAL::T_cb3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS_cb3<void> > > >::Locate_type & lt=OUTSIDE_CONVEX_HULL, int & li=0, int & lj=2090193940, CGAL::TDS3<CGAL::T_vb3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS_vb3<void> >,CGAL::T_cb3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<double> >,CGAL::TDS_cb3<void> > >::Cell_handle start={...})  Line 1517 + 0x19 bytes

testcgal.exe!main()  Line 21 + 0x47 bytes

testcgal.exe!_encode_pointer(void * ptr=0x00000000)  Line 114 + 0x5 bytes

00393358()

kernel32.dll!7c817067()

[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]

---------------------------



Reply | Threaded
Open this post in threaded view
|

Re: Problem in 3D Triangulation

Sylvain Pion
Administrator
Yang Liu a écrit :

> Dear all,
>
> Recently I am using CGAL to compute 3D triangulation.
> For some input data,  the 3D triangulation does not work.
>
> My simple test code is attached at the end of this email.
>
> I am using Microsoft Visual Studio 2008 and CGAL-3.3.1.
> The CGAL library is recompiled under VS2008.
>
> My program always reports "Microsoft C++ exception:
> CGAL::Uncertain_conversion_exception at memory location ..." in debug mode.
This issue has already been raised on the list.  Please have a look at
the archive for details.  I have also added it to the FAQ:
http://www.cgal.org/FAQ.html#uncertain_exception .

Maybe there is a way to tell the debugger to ignore it.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem in 3D Triangulation

Sylvain Pion
Administrator
Sylvain Pion a écrit :

> Yang Liu a écrit :
>> Dear all,
>>
>> Recently I am using CGAL to compute 3D triangulation.
>> For some input data,  the 3D triangulation does not work.
>>
>> My simple test code is attached at the end of this email.
>>
>> I am using Microsoft Visual Studio 2008 and CGAL-3.3.1.
>> The CGAL library is recompiled under VS2008.
>>
>> My program always reports "Microsoft C++ exception:
>> CGAL::Uncertain_conversion_exception at memory location ..." in debug
>> mode.
>
> This issue has already been raised on the list.  Please have a look at
> the archive for details.  I have also added it to the FAQ:
> http://www.cgal.org/FAQ.html#uncertain_exception .
>
> Maybe there is a way to tell the debugger to ignore it.
Further investigation showed that there is actually an issue in CGAL 3.3.1.
Please use the replacement file attached for include/CGAL/number_utils_classes.h .

This should reduce/eliminate many uses of those internal exceptions.
As a bonus, it may give a speedup for some degenerate data sets.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

// Copyright (c) 1997  Utrecht University (The Netherlands),
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
// and Tel-Aviv University (Israel).  All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/trunk/Algebraic_foundations/include/CGAL/number_utils_classes.h $
// $Id: number_utils_classes.h 44021 2008-07-08 07:03:41Z hemmer $
//
//
// Author(s)     : Michael Hoffmann <[hidden email]>
//               : Michael Hemmer <[hidden email]>

// to be included by number_utils.h

#ifndef CGAL_NUMBER_UTILS_CLASSES_H
#define CGAL_NUMBER_UTILS_CLASSES_H 1

#include <CGAL/number_type_basic.h>
#include <algorithm>
#include <utility>

CGAL_BEGIN_NAMESPACE

/* Defines functors:
   - Is_zero
   - Is_one
   - Is_negative
   - Is_positive
   - Sgn
   - Abs
   - Compare
   - Square
   - Sqrt
   - Div
   - Gcd
   - To_double
   - To_interval
*/

template < class NT >
struct Is_negative : Real_embeddable_traits<NT>::Is_negative {};
template < class NT >
struct Is_positive : Real_embeddable_traits<NT>::Is_positive {};
template < class NT >
struct Abs : Real_embeddable_traits<NT>::Abs{};
template < class NT >
struct To_double : Real_embeddable_traits<NT>::To_double{};
template < class NT >
struct To_interval : Real_embeddable_traits<NT>::To_interval{};

// Sign would result in a name clash with enum.h
template < class NT >
struct Sgn : Real_embeddable_traits<NT>::Sign {};


template < class NT >
struct Square : Algebraic_structure_traits<NT>::Square{};
template < class NT >
struct Sqrt : Algebraic_structure_traits<NT>::Sqrt {};
template < class NT >
struct Div : Algebraic_structure_traits<NT>::Div{};
template < class NT >
struct Gcd : Algebraic_structure_traits<NT>::Gcd{};
template < class NT >
struct Is_one : Algebraic_structure_traits<NT>::Is_one {};

// This is due to the fact that Is_zero may be provided by
// Algebraic_structure_traits as well as Real_embeddable_traits
// Of course it is not possible to derive from both since this
// would cause an ambiguity.
namespace CGALi{
template <class AST_Is_zero, class RET_Is_zero>
struct Is_zero_base : AST_Is_zero {} ;
template <class RET_Is_zero>
struct Is_zero_base <CGAL::Null_functor, RET_Is_zero >: RET_Is_zero {} ;
} // namespace CGALi
template < class NT >
struct Is_zero :
  CGALi::Is_zero_base
  <typename Algebraic_structure_traits<NT>::Is_zero,
   typename Real_embeddable_traits<NT>::Is_zero>{};


// This is due to the fact that CGAL::Compare is used for other
// non-realembeddable types as well.
// In this case we try to provide a default implementation
namespace CGALi {
template <class NT, class Compare> struct Compare_base: public Compare {};
template <class NT> struct Compare_base<NT,Null_functor>
  :public Binary_function< NT, NT, Comparison_result > {
  Comparison_result operator()( const NT& x, const NT& y) const
  {
    if (x < y) return SMALLER;
    if (x > y) return LARGER;
    CGAL_postcondition(x == y);
    return EQUAL;  
  }
};
} // namespace CGALi

template < class NT >
struct Compare
  :public CGALi::Compare_base
  <NT,typename Real_embeddable_traits<NT>::Compare>{};



CGAL_END_NAMESPACE

#endif // CGAL_NUMBER_UTILS_CLASSES_H

smime.p7s (5K) Download Attachment