Convex Hull 3D problem

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

Convex Hull 3D problem

MirJafar
Hello,

I was trying to execute the sample example of ConvexHull in 3D from:
File: examples/Convex_hull_3/quickhull_3.cpp

and it produces the following message.  What are these and how can I get rid of
them ?

Thanks.
csv
Poona, India


CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)

Reply | Threaded
Open this post in threaded view
|

Re: Convex Hull 3D problem

Sylvain Pion
Administrator
This was due to a poor choice of kernel in the example program.
This has been fixed since 3.3.1.  Find attached the updated example
program as you will find it in the next CGAL release.

Chaman Singh Verma wrote:

> Hello,
>
> I was trying to execute the sample example of ConvexHull in 3D from:
>
> *File: *examples/Convex_hull_3/quickhull_3.cpp
>
>  <http://www.cgal.org/Manual/3.3/examples/Convex_hull_3/quickhull_3.cpp>
>
> and it produces the following message.  What are these and how can I get
> rid of
> them ?
>
> Thanks.
> csv
> Poona, India
>
>
> CGAL warning: check violation!
> Expr: is_integer(d)
> File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
> Line: 100
> Explanation:Gmpz constructed from non-integer double value
> CGAL warning: check violation!
> Expr: is_integer(d)
> File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
> Line: 100
> Explanation:Gmpz constructed from non-integer double value
> CGAL warning: check violation!
> Expr: is_integer(d)
> File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
> Line: 100
> Explanation:Gmpz constructed from non-integer double value
> CGAL warning: check violation!
> Expr: is_integer(d)
>

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

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/algorithm.h>
#include <CGAL/Convex_hull_traits_3.h>
#include <CGAL/convex_hull_3.h>
#include <vector>


typedef CGAL::Exact_predicates_inexact_constructions_kernel  K;
typedef CGAL::Convex_hull_traits_3<K>             Traits;
typedef Traits::Polyhedron_3                      Polyhedron_3;
typedef K::Segment_3                              Segment_3;

// define point creator
typedef K::Point_3                                Point_3;
typedef CGAL::Creator_uniform_3<double, Point_3>  PointCreator;


int main()
{
  CGAL::Random_points_in_sphere_3<Point_3, PointCreator> gen(100.0);

  // generate 250 points randomly on a sphere of radius 100.0
  // and copy them to a vector
  std::vector<Point_3> points;
  CGAL::copy_n( gen, 250, std::back_inserter(points) );

  // define object to hold convex hull
  CGAL::Object ch_object;

  // compute convex hull
  CGAL::convex_hull_3(points.begin(), points.end(), ch_object);

  // determine what kind of object it is
  if (CGAL::object_cast<Segment_3>(&ch_object) )
     std::cout << "convex hull is a segment " << std::endl;
  else if (CGAL::object_cast<Polyhedron_3>(&ch_object) )
     std::cout << "convex hull is a polyhedron " << std::endl;
  else
     std::cout << "convex hull error!" << std::endl;

  return 0;
}

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

Re: Convex Hull 3D problem

MirJafar


On Sat, Nov 29, 2008 at 7:43 PM, Sylvain Pion <[hidden email]> wrote:
This was due to a poor choice of kernel in the example program.
This has been fixed since 3.3.1.  Find attached the updated example
program as you will find it in the next CGAL release.

Chaman Singh Verma wrote:
Hello,

I was trying to execute the sample example of ConvexHull in 3D from:

*File: *examples/Convex_hull_3/quickhull_3.cpp

 <http://www.cgal.org/Manual/3.3/examples/Convex_hull_3/quickhull_3.cpp>


and it produces the following message.  What are these and how can I get rid of
them ?

Thanks.
csv
Poona, India


CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)



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

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/algorithm.h>
#include <CGAL/Convex_hull_traits_3.h>
#include <CGAL/convex_hull_3.h>
#include <vector>


typedef CGAL::Exact_predicates_inexact_constructions_kernel  K;
typedef CGAL::Convex_hull_traits_3<K>             Traits;
typedef Traits::Polyhedron_3                      Polyhedron_3;
typedef K::Segment_3                              Segment_3;

// define point creator
typedef K::Point_3                                Point_3;
typedef CGAL::Creator_uniform_3<double, Point_3>  PointCreator;


int main()
{
 CGAL::Random_points_in_sphere_3<Point_3, PointCreator> gen(100.0);

 // generate 250 points randomly on a sphere of radius 100.0
 // and copy them to a vector
 std::vector<Point_3> points;
 CGAL::copy_n( gen, 250, std::back_inserter(points) );

 // define object to hold convex hull
 CGAL::Object ch_object;

 // compute convex hull
 CGAL::convex_hull_3(points.begin(), points.end(), ch_object);

 // determine what kind of object it is
 if (CGAL::object_cast<Segment_3>(&ch_object) )
    std::cout << "convex hull is a segment " << std::endl;
 else if (CGAL::object_cast<Polyhedron_3>(&ch_object) )
    std::cout << "convex hull is a polyhedron " << std::endl;
 else
    std::cout << "convex hull error!" << std::endl;

 return 0;
}

Hello,

Does this means that we should never use CGAL::Cartesian<double> in future ?

Thanks.
csv

Reply | Threaded
Open this post in threaded view
|

Re: Convex Hull 3D problem

MirJafar


On Sat, Nov 29, 2008 at 8:11 PM, Chaman Singh Verma <[hidden email]> wrote:


On Sat, Nov 29, 2008 at 7:43 PM, Sylvain Pion <[hidden email]> wrote:
This was due to a poor choice of kernel in the example program.
This has been fixed since 3.3.1.  Find attached the updated example
program as you will find it in the next CGAL release.

Chaman Singh Verma wrote:
Hello,

I was trying to execute the sample example of ConvexHull in 3D from:

*File: *examples/Convex_hull_3/quickhull_3.cpp

 <http://www.cgal.org/Manual/3.3/examples/Convex_hull_3/quickhull_3.cpp>


and it produces the following message.  What are these and how can I get rid of
them ?

Thanks.
csv
Poona, India


CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)
File: /home/csv610/Software/CompGeom/CGAL/include/CGAL/GMP/Gmpz_type.h
Line: 100
Explanation:Gmpz constructed from non-integer double value
CGAL warning: check violation!
Expr: is_integer(d)



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

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/algorithm.h>
#include <CGAL/Convex_hull_traits_3.h>
#include <CGAL/convex_hull_3.h>
#include <vector>


typedef CGAL::Exact_predicates_inexact_constructions_kernel  K;
typedef CGAL::Convex_hull_traits_3<K>             Traits;
typedef Traits::Polyhedron_3                      Polyhedron_3;
typedef K::Segment_3                              Segment_3;

// define point creator
typedef K::Point_3                                Point_3;
typedef CGAL::Creator_uniform_3<double, Point_3>  PointCreator;


int main()
{
 CGAL::Random_points_in_sphere_3<Point_3, PointCreator> gen(100.0);

 // generate 250 points randomly on a sphere of radius 100.0
 // and copy them to a vector
 std::vector<Point_3> points;
 CGAL::copy_n( gen, 250, std::back_inserter(points) );

 // define object to hold convex hull
 CGAL::Object ch_object;

 // compute convex hull
 CGAL::convex_hull_3(points.begin(), points.end(), ch_object);

 // determine what kind of object it is
 if (CGAL::object_cast<Segment_3>(&ch_object) )
    std::cout << "convex hull is a segment " << std::endl;
 else if (CGAL::object_cast<Polyhedron_3>(&ch_object) )
    std::cout << "convex hull is a polyhedron " << std::endl;
 else
    std::cout << "convex hull error!" << std::endl;

 return 0;
}

Hello,

Does this means that we should never use CGAL::Cartesian<double> in future ?

Thanks.
csv


Hello,

With the modifications you made, the code worked. But I have one question, with
this kernel, how we specify the datatype i.e. double, float, int etc ?

Thanks.
csv
 

Reply | Threaded
Open this post in threaded view
|

Re: Convex Hull 3D problem

Sylvain Pion
Administrator
Chaman Singh Verma wrote:
>     Does this means that we should never use CGAL::Cartesian<double> in
>     future ?

It depends on the problem.

My advice is: if you do not know what you are doing, you should most probably
not be using Cartesian<double>.

By "know what you are doing", I mean that one should understand all the
robustness issues potentially linked with the algorithms that one uses.
It can also depends on the kind of degeneracies you can expect from the data
sets your algorithms are going to run on.

If you know what you are doing, well, you don't need my advice :)

There is a good deal of literature on these robustness issues already, e.g. :

  "Classroom Examples of Robustness Problems in Geometric Computations"
  Lutz Kettner, Kurt Mehlhorn, Sylvain Pion, Stefan Schirra and Chee Yap,
  In Computational Geometry: Theory and Applications, volume 40, issue 1, pages 61-78, May 2008.

You can find other links on cgal's web site.

> With the modifications you made, the code worked. But I have one
> question, with
> this kernel, how we specify the datatype i.e. double, float, int etc ?

Exact_predicates_inexact_constructions_kernel is only a typedef.
It's meant to quickly answer many robustness issues.  The type
used for the coordinates is double.  If you need something else,
just have a look at how this typedef is defined, and you will
find how to change this.  Namely, for choosing float, it will be:
Filtered_kernel< Simple_cartesian<float> >.

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

smime.p7s (5K) Download Attachment