Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Exact_predicates_inexact_constructions_kernel - sign checks are in the wrong order?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Exact_predicates_inexact_constructions_kernel - sign checks are in the wrong order?


Chronological Thread 
  • From: Jeffrey Bush <>
  • To: "" <>
  • Subject: Re: [cgal-discuss] Exact_predicates_inexact_constructions_kernel - sign checks are in the wrong order?
  • Date: Fri, 8 Feb 2013 11:41:11 -0800

I was hoping to do something while still using doubles, which is why I went for Exact_predicates_inexact_constructions_kernel. I just tried Exact_predicates_exact_constructions_kernel like you suggested, but I get the following exception:

CGAL error: assertion violation!
_expression_ : !(i>s)
File       : C:\CGAL\CGAL-4.1\include\CGAL/Interval_nt.h
Line       : 90
Explanation:  Variable used before being initialized (or CGAL bug)
Refer to the bug-reporting instructions at http://www.cgal.org/bug_report.html

The stack trace is:
  CrossSectionCGAL.exe!CGAL::Interval_nt<0>::Interval_nt<0>(double i, double s)  Line 94 C++
  CrossSectionCGAL.exe!CGAL::Interval_nt<0>::operator-()  Line 99 + 0x6d bytes C++
  CrossSectionCGAL.exe!CGAL::PlaneC3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >::opposite()  Line 269 + 0x1a bytes C++
  CrossSectionCGAL.exe!CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >::operator()(const CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > > & p)  Line 1254 + 0x3f bytes C++
  CrossSectionCGAL.exe!CGAL::Lazy_rep_1<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >,CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >,CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >,CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >,CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>,CGAL::Simple_cartesian<CGAL::Interval_nt<0> >,CGAL::NT_converter<CGAL::Gmpq,CGAL::Interval_nt<0> > >,CGAL::Plane_3<CGAL::Epeck> >::Lazy_rep_1<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >,CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >,CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >,CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >,CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>,CGAL::Simple_cartesian<CGAL::Interval_nt<0> >,CGAL::NT_converter<CGAL::Gmpq,CGAL::Interval_nt<0> > >,CGAL::Plane_3<CGAL::Epeck> >(const CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > > & ac, const CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> > & ec, const CGAL::Plane_3<CGAL::Epeck> & l1)  Line 354 + 0x6d bytes C++
  CrossSectionCGAL.exe!CGAL::Lazy_construction<CGAL::Epeck,CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<0> > >,CGAL::CommonKernelFunctors::Construct_opposite_plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >,CGAL::Default,1>::operator()<CGAL::Plane_3<CGAL::Epeck> >(const CGAL::Plane_3<CGAL::Epeck> & l0)  Line 1381 + 0xbf bytes C++

  ... (a few really long lines)

  CrossSectionCGAL.exe!CGAL::Polyhedron_3<CGAL::Epeck,CGAL::Polyhedron_items_3,CGAL::HalfedgeDS_default,std::allocator<int> >::inside_out_geometry(CGAL::Boolean_tag<1> __formal)  Line 1474 C++
> CrossSectionCGAL.exe!CGAL::Polyhedron_3<CGAL::Epeck,CGAL::Polyhedron_items_3,CGAL::HalfedgeDS_default,std::allocator<int> >::inside_out()  Line 1482 C++


Jeff


On Thu, Feb 7, 2013 at 9:59 PM, Sebastien Loriot (GeometryFactory) <> wrote:
Check this FAQ entry:
http://www.cgal.org/FAQ.html#inexact_NT

If you use Exact_predicates_exact_constructions_kernel.h this should be OK.

Even if it's not documented and not officially supported, I suggest you to have a look at the file CGAL/intersection_of_Polyhedra_3.h

where the following function is defined:

template <typename Polyhedron, typename OutputIterator>
OutputIterator
intersection_Polyhedron_3_Polyhedron_3(const Polyhedron& P, const Polyhedron& Q, OutputIterator out)

where OutputIterator accepts std::vector<typename Kernel::Point_3> objects (to represent a polyline).

A plane can always be represented by a triangulated quad.

Sebastien.



On 02/08/2013 12:31 AM, Jeffrey Bush wrote:
Hi,

I am using AABB_tree to determine intersections between a plane (call it
"h") and a polyhedron, resulting in a vector of segments ("segs").
However the following test fails:

    h.has_on(*segs.begin())


This shouldn't be. However doing research I realized the result may be
because of using Cartesian instead of
Exact_predicates_inexact_constructions_kernel, so I switched to that.
But still the same problem!

Running the debugger I get to this function:

   inline
   Uncertain<Sign>
   sign (const  Interval_nt<Protected>  &  d)
   {
     if  (d.inf()>  0.0)return  POSITIVE;
     if  (d.sup()<  0.0)return  NEGATIVE;
     if  (d.inf() == d.sup())return  ZERO;

     return  Uncertain<Sign>::indeterminate();
   }

With the following value for d:

d = {
   _inf=5.6843418860808015e-014,
   _sup=5.6843418860808015e-014,
   tester={...}
}

It seems as though the d.inf() == d.sup() check should be first? It
seems that if sup <= inf and inf > 0 or sup < 0, then the d.inf() ==
d.sup() can only be 0 == 0... (but I guess sup > inf - I don't
understand exactly what this is all about).

Just for scale, my points have values on the order of 2500 and the plane
is <0,0,1> -300.

If this is right (and I could easily be, I don't know too much about
double-precision mathematical testing), then what am I doing wrong? My
meshes are LARGE so I don't want to use the infinite-precision numbers.

Thanks!
Jeff


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss






Archive powered by MHonArc 2.6.18.

Top of Page