Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] halfspace_intersection_3 crash

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] halfspace_intersection_3 crash


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] halfspace_intersection_3 crash
  • Date: Wed, 11 Jan 2017 10:07:03 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:Dy2o6RXfqxU1++u/stvCfnkCiRHV8LGtZVwlr6E/grcLSJyIuqrYbByCt8tkgFKBZ4jH8fUM07OQ6PG8HzZfqs/b4DgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal8IRiyogjdrNcajIltJqos1BfEoWZDdvhLy29vOV+dhQv36N2q/J5k/SRQuvYh+NBFXK7nYak2TqFWASo/PWwt68LlqRfMTQ2U5nsBSWoWiQZHAxLE7B7hQJj8tDbxu/dn1ymbOc32Sq00WSin4qx2RhLklDsLOjgk+2zRl8d+jr9UoAi5qhJi3YDUboGbNP19cK3Tc9wVSmhOUdpeWSFaHoOxbZECA/YdMetWr4TwoUYFoxukBQmrAePi0jFEiGLo0qIhyeshCh3G3A0+ENIIrX/aqtL1NL0TUeCy0KnD0DHPYfJI1jf67YjHbAwhoeuMXLxwa8Xe1VUvFwTfjlSQrIDpMS6e2+MWs2if6OpgT+Ovi2k7qw1rpzivwtwhiobMho0Py1DE8T91z5oyJd29UUN2Z8OvHpVXtyGfLYR2Q8UiTnluuCkg0bIJopq7czYQxJs7wB7fbuSLfJSH4h35UOadOzB4hGhqeL+5mh288lCgx/XiWsWo1FtGtClIn9nWunwTyhDf9tKLRuZ+80u9wTqC1QPe5vtaLU07lKfXMYMtz7o+m5YJs0nOHin7k1jsgqCMbEUr4O2o5vznYrr4op+cMJd5igTkPaQvnsyzGOo5MgoSU2SC9+Swyb7u8VHjTLVFif02labZsJTEKsgBuqG5BApV3p4i6xa5ETimzMwVkWcbIF9BYh6KjIjkN0vQLPzlEfuzmUmgnTR3y/zeO73uGJTNLnzNkLf7erZ97lZRyBE3zdBY/ZJUC7YBIO7pVk/0sNzVFRA5MwmuzObmDNVxzJ8RWWWKAqOBKqPdrUeI5v4zI+mLfIIapDn9JOIh5/L3kHA5mEQdcrW03ZsMc3C1Be9mIkWcYXr0mNgNC2YKvgwkTOzrklKOSzBTZ2zhF547szo0AYbjAYbYTZ22m5SA2j26F9tYfDNoEFeJRD3Teo+NQOsNZSTaBsh7kzsYHfiORogk2A20pSHzwKZgNPuVsGVMrpbkztly+6vWkTk98DV1C4KW1GTbHDI8pX8BWzJjhPM3mkd60FrWiaU=
  • Organization: GeometryFactory

Exact predicates are needed.

See also:
http://www.cgal.org/FAQ.html#inexact_NT

Sebastien.

On 01/11/2017 10:03 AM, AndrewLiu wrote:
Hi all,

When I changed the Exact_predicates_inexact_constructions_kernel to
Simple_cartesian<double> in halfspace_intersection_3 example
<http://doc.cgal.org/latest/Convex_hull_3/index.html#Convex_hull_3HalfspaceIntersection>
, the program may crash in some rare cases.
Here is the code.
-----------------------------------------------
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Convex_hull_3/dual/halfspace_intersection_3.h>
#include <CGAL/point_generators_3.h>
#include <list>
//typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Simple_cartesian<double> K;
typedef K::Plane_3 Plane;
typedef K::Point_3 Point;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
// compute the tangent plane of a point
template <typename K>
typename K::Plane_3 tangent_plane (typename K::Point_3 const& p) {
typename K::Vector_3 v(p.x(), p.y(), p.z());
v = v / sqrt(v.squared_length());
typename K::Plane_3 plane(v.x(), v.y(), v.z(), -(p - CGAL::ORIGIN) * v);
return plane;
}
int main (void) {
int i = 100000;

while (i--) {
// number of generated planes
int N = 200;
// generates random planes on a sphere
std::list<Plane> planes;
CGAL::Random_points_on_sphere_3<Point> g;
for (int i = 0; i < N; i++) {
planes.push_back(tangent_plane<K>(*g++));
}
// define polyhedron to hold the intersection
Polyhedron_3 P;
// compute the intersection
// if no point inside the intersection is provided, one
// will be automatically found using linear programming
CGAL::halfspace_intersection_3(planes.begin(),
planes.end(),
P,
boost::make_optional(Point(0, 0, 0)) );
}
std::cout << "Finished." << std::endl;

return 0;
}
-----------------------------------------------
I was wondering if there is any restriction of the Kernel used in
halfspace_intersection_3.
Am I supposed to use exact predicate only when using this function?

Thanks,

Andrew



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/halfspace-intersection-3-crash-tp4662456.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page