Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 2D Polygon difference asserting in error

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 2D Polygon difference asserting in error


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] 2D Polygon difference asserting in error
  • Date: Wed, 24 Jul 2013 12:39:05 +0200
  • Organization: GeometryFactory

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

you're missing -lgmp -lmpfr and probably -frounding-math

Sebastien.


On 07/24/2013 01:23 AM, Willy Lambert wrote:
Sry for noise, last message went out too quickly an error paste is
missing. Corrected inside the email


2013/7/24 Willy Lambert
<
<mailto:>>

(should I top post or down post on this list ?)

Thanks for answering. Could you tell me a bit more about what this
would change ? It's not very clear for me what the Kernel is.

I modified the typedef and add :
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>

Then I run into 2 types of problems :
_ I doesn't link (missing gmpq and mpfr)(build log at the end),
should I add anything (cmake config ? libraries to download) ?
_ I can't use A[0].x() to print things into console (it says :
../src/test_cgal.cpp:105:37: error: invalid cast from type
‘CGAL::cpp11::result_of<CGAL::Lazy_construction_nt<CGAL::Epeck,

CGAL::CartesianKernelFunctors::Compute_x_2<CGAL::Simple_cartesian<CGAL::Interval_nt<false>
> >,

CGAL::CartesianKernelFunctors::Compute_x_2<CGAL::Simple_cartesian<CGAL::Gmpq>
> >(CGAL::Point_2<CGAL::Epeck>)>::type {aka
CGAL::Lazy_exact_nt<CGAL::Gmpq>}’ to type ‘int’)

Here is the build error :
Building target: test_cgal
Invoking: GCC C++ Linker
g++ -L/home/robot/workspace/CGAL-4.2/build/lib -o "test_cgal"
./src/test_cgal.o -lCGAL -lboost_thread-mt -lboost_system-mt
./src/test_cgal.o: In function `CGAL::Gmpq_rep::Gmpq_rep()':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:51:
undefined reference to `__gmpq_init'
./src/test_cgal.o: In function `CGAL::Gmpq_rep::~Gmpq_rep()':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:52:
undefined reference to `__gmpq_clear'
./src/test_cgal.o: In function `CGAL::Gmpq::Gmpq(int)':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:87:
undefined reference to `__gmpq_set_si'
./src/test_cgal.o: In function `CGAL::Gmpq::operator==(CGAL::Gmpq
const&) const':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:193:
undefined reference to `__gmpq_equal'
./src/test_cgal.o: In function `CGAL::Gmpq::operator<(CGAL::Gmpq
const&) const':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:194:
undefined reference to `__gmpq_cmp'
./src/test_cgal.o: In function `CGAL::Gmpq::operator==(int) const':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:213:
undefined reference to `__gmpq_cmp_si'
./src/test_cgal.o: In function `CGAL::Gmpq::operator<(int) const':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:214:
undefined reference to `__gmpq_cmp_si'
./src/test_cgal.o: In function `CGAL::Gmpq::operator-() const':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:260:
undefined reference to `__gmpq_neg'
./src/test_cgal.o: In function `CGAL::Gmpq::operator+=(CGAL::Gmpq
const&)':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:276:
undefined reference to `__gmpq_add'
./src/test_cgal.o: In function `CGAL::Gmpq::operator-=(CGAL::Gmpq
const&)':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:286:
undefined reference to `__gmpq_sub'
./src/test_cgal.o: In function `CGAL::Gmpq::operator*=(CGAL::Gmpq
const&)':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:296:
undefined reference to `__gmpq_mul'
./src/test_cgal.o: In function `CGAL::Gmpq::operator/=(CGAL::Gmpq
const&)':
/home/robot/workspace/CGAL-4.2/include/CGAL/GMP/Gmpq_type.h:307:
undefined reference to `__gmpq_div'
./src/test_cgal.o: In function

`CGAL::Real_embeddable_traits<CGAL::Gmpq>::To_interval::operator()(CGAL::Gmpq
const&) const':
/home/robot/workspace/CGAL-4.2/include/CGAL/Gmpq.h:92: undefined
reference to `mpfr_init2'
/home/robot/workspace/CGAL-4.2/include/CGAL/Gmpq.h:93: undefined
reference to `mpfr_set_q'
/home/robot/workspace/CGAL-4.2/include/CGAL/Gmpq.h:94: undefined
reference to `mpfr_get_d'
/home/robot/workspace/CGAL-4.2/include/CGAL/Gmpq.h:95: undefined
reference to `mpfr_set_q'
/home/robot/workspace/CGAL-4.2/include/CGAL/Gmpq.h:96: undefined
reference to `mpfr_get_d'
/home/robot/workspace/CGAL-4.2/include/CGAL/Gmpq.h:97: undefined
reference to `mpfr_clear'
collect2: error: ld returned 1 exit status


2013/7/23 Sebastien Loriot (GeometryFactory)
<

<mailto:>>

The first thing to try is to replace


typedef CGAL::Cartesian<Number_type> Kernel;
by
typedef CGAL::Exact_predicates_exact___constructions_kernel Kernel;

Sebastien.


On 07/23/2013 08:47 PM, Willy Lambert wrote:

Hi all,

I'm quite new to cgal, and I'm trying to use it in robotics path
planning. To do so I create a polygon with holes which show
reachable
areas. I initiate a polygon set with the "outer" map and
then do a
difference with each obstacles thougth eating borders of the
map or
creating an hole.

It is working for many obstacles except one, which is
asserting when I
do the difference. I didn't used cgal enougth to be able to
find if it
is a cgal bug or a mis-use so I'm asking some help here to
clarify this.

Here is a simple code to reproduce :

typedef float Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<__Kernel>
Polygon_with_holes_2;
typedef CGAL::Polygon_set_2<Kernel> Polygon_set_2;

Polygon_2 A,B;

A.push_back(Point_2(1350, -850));
A.push_back(Point_2(1350, 850));
A.push_back(Point_2(-1350, -850));

B.push_back(Point_2(1003, -116));
B.push_back(Point_2(947, -251));
B.push_back(Point_2(984, -1000));

Polygon_set_2 S;
S.insert(A);
S.difference(B);


It compiles and throw at execution :

(atlantronic) robot@ard-host ~/workspace/test_cgal/Debug $
./test_cgal
terminate called after throwing an instance of
'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: comp_f(object, parentP->object) != SMALLER
File: /home/robot/workspace/CGAL-4.__2/include/CGAL/Multiset.h
Line: 2129
Aborted (core dumped)

Here is a screen shot if it can help visualizing the problem.

http://cgal-discuss.949826.n4.__nabble.com/file/n4657830/cgal___problem.png

<http://cgal-discuss.949826.n4.nabble.com/file/n4657830/cgal_problem.png>


Let me know if you need any further information or if I need to
re-formulate my demand which standard debug information set.

Regards.



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








Archive powered by MHonArc 2.6.18.

Top of Page