Subject: CGAL users discussion list
List archive
- From: Ronaldo Carpio <>
- To: "" <>
- Subject: [cgal-discuss] Assertion fail when locating point outside S in Delaunay_d
- Date: Fri, 1 Feb 2013 07:22:30 -0800 (PST)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=3SK+xFlifRPNpKGjqgZxdb+8JV1WZrRa7i3nHzDV83O1DF7cYQbKyhVDijrA/yJqvEyKoPy0NvHBMs2kkyEJZLaAjBjYplbxS9pSniYjMzuH1/LDXT+Wp11DkiyWUscKGrQqTA5vAROhHNh/+dvSL1A0QnJeKqovYSTz8G0ibLo=;
Hello,
I'm using CGAL 4.1 on Linux compiled with g++ 4.7.2. I'm trying to use the Delaunay_d module to approximate
a function via linear interpolation. When I try to call "locate" on a point outside the convex hull of the points I've
inserted, I get an assertion failure:
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: check_independence(first,last)
File: /home/rncarpio/CGAL-4.1/include/CGAL/Kernel_d/function_objectsCd.h
Line: 326
Explanation: Contained_in_simplex_d: A not affinely independent.
what(): CGAL ERROR: assertion violation!
Expr: check_independence(first,last)
File: /home/rncarpio/CGAL-4.1/include/CGAL/Kernel_d/function_objectsCd.h
Line: 326
Explanation: Contained_in_simplex_d: A not affinely independent.
The docs say this should return
Simplex_handle(). I've attached my test program and a stack trace.
Thank you,
Ronaldo Carpio
#include <vector>
#include <functional>
#include <CGAL/Cartesian_d.h>
#include <CGAL/Quotient.h>
#include <CGAL/Delaunay_d.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Object.h>
#include <CGAL/constructions_d.h>
using std::vector;
typedef CGAL::MP_Float NT;
typedef CGAL::Quotient<NT> RT;
typedef CGAL::Cartesian_d<RT> Kernel;
typedef Kernel::LA LA;
typedef LA::Matrix Matrix;
typedef LA::Vector LA_Vector;
typedef CGAL::Convex_hull_d<Kernel> Convex_hull_d;
typedef CGAL::Delaunay_d<Kernel> Delaunay_d;
typedef CGAL::Hyperplane_d<Kernel> Hyperplane;
typedef CGAL::Direction_d<Kernel> Direction;
typedef CGAL::Ray_d<Kernel> Ray;
typedef Delaunay_d::Point_d Point;
typedef Delaunay_d::Vector_d Vector;
typedef Delaunay_d::Simplex_handle Simplex_handle;
typedef Delaunay_d::Vertex_handle Vertex_handle;
typedef CGAL::Object Object;
template <class IterT>
vector<RT> doubles_to_RTvec(IterT doubles_begin, IterT doubles_end) {
int n = doubles_end - doubles_begin;
vector<RT> result(n);
std::transform(doubles_begin, doubles_end, result.begin(), [] (double x) ->
RT { return RT(x); } );
return result;
}
double RT_to_double(RT const &x) {
return to_double(x);
}
template <class IterT>
Point coords_to_point(IterT coords_begin, IterT coords_end) {
int n_dims = (coords_end - coords_begin);
vector<RT> coords = doubles_to_RTvec(coords_begin, coords_end);
return Point(n_dims, coords.begin(), coords.end());
}
int main(int argc, char **argv) {
Delaunay_d triang(2);
double x0, x1;
double x[2];
for (x0=-2.0; x0 <= 2.0; x0 += 1.0) {
for (x1=-2.0; x1 <= 2.0; x1 += 1.0) {
x[0] = x0;
x[1] = x1;
Point p = coords_to_point(x, x+2);
printf("inserting %f, %f\n", x0, x1);
triang.insert(p);
}
}
x[0] = -3.;
x[1] = -3.;
Point p = coords_to_point(x, x+2);
triang.locate(p);
return 0;
}
Program received signal SIGABRT, Aborted.
0x00007ffff6abc1b5 in raise () from /lib/libc.so.6
(gdb) where
#0 0x00007ffff6abc1b5 in raise () from /lib/libc.so.6
#1 0x00007ffff6abefc0 in abort () from /lib/libc.so.6
#2 0x00007ffff72e2d6d in __gnu_cxx::__verbose_terminate_handler ()
at
/home/rncarpio/local/src/gcc-4.7.2/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007ffff72e0e66 in __cxxabiv1::__terminate (handler=Unhandled dwarf
expression opcode 0xf3
)
at
/home/rncarpio/local/src/gcc-4.7.2/libstdc++-v3/libsupc++/eh_terminate.cc:40
#4 0x00007ffff72e0e93 in std::terminate ()
at
/home/rncarpio/local/src/gcc-4.7.2/libstdc++-v3/libsupc++/eh_terminate.cc:50
#5 0x00007ffff72e10be in __cxa_throw (obj=0x649710, tinfo=Unhandled dwarf
expression opcode 0xf3
)
at
/home/rncarpio/local/src/gcc-4.7.2/libstdc++-v3/libsupc++/eh_throw.cc:83
#6 0x00007ffff759fa85 in CGAL::assertion_fail(char const*, char const*, int,
char const*) ()
from /home/rncarpio/CGAL-4.1/lib/libCGAL.so.10
#7 0x000000000040cebe in
CGAL::Contained_in_simplexCd<CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > >
>::operator()<__gnu_cxx::__normal_iterator<CGAL::Point_d<CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > > >*,
std::vector<CGAL::Point_d<CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > > >,
std::allocator<CGAL::Point_d<CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > > > > > > >
(this=0x7fffffffe21f,
first=..., last=..., p=...)
at /home/rncarpio/CGAL-4.1/include/CGAL/Kernel_d/function_objectsCd.h:325
#8 0x000000000040882b in
CGAL::Delaunay_d<CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > >,
CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > > >::contains
(this=0x7fffffffe450, s=..., x=...)
at /home/rncarpio/CGAL-4.1/include/CGAL/Delaunay_d.h:806
#9 0x00000000004050f3 in
CGAL::Delaunay_d<CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > >,
CGAL::Cartesian_d<CGAL::Quotient<CGAL::MP_Float>,
CGAL::Linear_algebraCd<CGAL::Quotient<CGAL::MP_Float>,
std::allocator<CGAL::Quotient<CGAL::MP_Float> > > > >::locate
(this=0x7fffffffe450, x=...)
at /home/rncarpio/CGAL-4.1/include/CGAL/Delaunay_d.h:846
#10 0x0000000000401dce in main (argc=1, argv=0x7fffffffe6a8) at
test_delaunay.cpp:68
- [cgal-discuss] Assertion fail when locating point outside S in Delaunay_d, Ronaldo Carpio, 02/01/2013
Archive powered by MHonArc 2.6.18.