Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Segment Delaunay, error finding circumcenter of face.

Subject: CGAL users discussion list

List archive

[cgal-discuss] Segment Delaunay, error finding circumcenter of face.


Chronological Thread 
  • From: Pablo Miranda Carranza <>
  • To:
  • Subject: [cgal-discuss] Segment Delaunay, error finding circumcenter of face.
  • Date: Thu, 2 May 2013 02:23:28 -0700 (PDT)

Hi,
I have been using the 2D Segment Delaunay Graphs library for a while now,
and after changing the precision of my input data (from floats to doubles),
my program has started to fail. This happens with exact number types. The
calculation of the Segment Delaunay seems to be alright, at least on the
graphic output that I get, but when I try to get the centre of the
circumscribed circle of the face, that is the voronoi vertex (through
primal() or circumcenter()), it often crashes, depending of the input data.
I have tested with CGAL 4.0 and 4.2. Any help solving this would be very
appreciated!

I include below a small sample program that crashes, the error message I
get, and details about my setup. Thanks!

Pablo.

Setup:
OS X 10.7.5
XCode using LLVM 4.2.
Libraries: boost 1.53, gmp 5.1.1.


Error Message:

CGAL error: assertion violation!
Expression : is_finite(d)
File : /usr/local/include/CGAL/GMP/Gmpq_type.h
Line : 132
Explanation:
Refer to the bug-reporting instructions at
http://www.cgal.org/bug_report.html
terminate called throwing an exception(lldb)



Test Program:


#include <iostream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Segment_Delaunay_graph_hierarchy_2.h>


//THIS PRODUCES THE ERROR WITH THE DATA BELOW
typedef CGAL::Gmpq ENT;
typedef CGAL::Simple_cartesian<ENT > Kernel;
typedef
CGAL::Segment_Delaunay_graph_traits_without_intersections_2<Kernel,CGAL::Integral_domain_without_division_tag>

Gt;
typedef CGAL::Segment_Delaunay_graph_hierarchy_2<Gt> SDG_2;
typedef SDG_2::Point_2 Point2;

int main(int argc, char *argv[]){

//THESE ARE FORE TEST OF CIRCUMCENTER
const int testSize=13;
Point2 ptData[testSize]={
Point2(1.332704343819863 ,-3.234509458692383),
Point2(1.33270434381988 ,-3.960250275513072),
Point2(4.077897868315539 ,-3.960250275513072),
Point2(4.077897868315539 ,-2.086883444718023),
Point2(6.830519119689221 ,-2.086883444718023),
Point2(6.830519119689221 ,1.844058601492879),
Point2(5.856631741136617 ,1.844058601492879),
Point2(5.856631741136617 ,0.813012233221162),
Point2(3.129327456684925 ,0.8130122332211747),
Point2(3.129327456684926 ,-2.666538384658775),
Point2(2.247768851985107 ,-2.666538384658775),
Point2(2.247768851985107 ,-3.234509458692383),
};


SDG_2 sdg;

//create segment sites for the closed polygon with the points as
vertices
std::cout<< "Calculating Segment Delaunay:"<<std::endl;

for (int i = 0; i &lt; testSize; ++i) {
std::cout&lt;&lt; &quot;processing &quot;&lt;&lt; i
&lt;&lt;&quot; of
&quot;&lt;&lt;testSize &lt;&lt; std::endl;
int next = (i + 1) % testSize;

const SDG_2::Site_2
&amp;site=SDG_2::Site_2::construct_site_2(ptData[i],
ptData[next]);
sdg.insert(site);
}

std::cout&lt;&lt; &quot;Testing Circumcenter
(Primal):&quot;&lt;&lt;std::endl;

for(auto fit=sdg.finite_faces_begin(); fit!= sdg.finite_faces_end();
++fit){

//if this is commented off, that is, if we skip faces with 2
segments and a point, it works
/*
//we count the number of point vertices to see what type of face
makes it fail
int numberOfPointVertices=0;
for(int
i=0;i&lt;3;i++){numberOfPointVertices+=fit->vertex(i)->is_point()? 1:0;}
if( numberOfPointVertices==1){continue;} //obviously the other
vertices are segments
*/

Point2 center = sdg.primal(fit);
}

std::cout<< "Done " << std::endl;

}











--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Segment-Delaunay-error-finding-circumcenter-of-face-tp4657333.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page