Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] straight skeleton anomaly ?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] straight skeleton anomaly ?


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] straight skeleton anomaly ?
  • Date: Tue, 19 Mar 2013 10:53:56 +0100
  • Organization: GeometryFactory

I now fully understand what is happening. What is wrong is the output in double.

The kernel used rely on a lazy constructions of the points. In particular, the approximate version of the points (using intervals)
is used to print the point coordinates (by taking the middle of the intervals). If you want this interval to be smaller and more accurate,
you need to evaluate exactly the construction.

Thus calling CGAL::exact(p) in the print_point function before
printing the point produce a better looking solution.

Adding the following code in print_point

typename K::Point_2::Approximate_type pa=CGAL::approx(p);
std::cout << "precision x " << pa.x().sup() - pa.x().inf() << std::endl;
std::cout << "precision y " << pa.y().sup() - pa.y().inf() << std::endl;

you will see that the precision of the incorrectly placed point
is

precision x 10.4218660132028162479400634765625
precision y 4.7394369542598724365234375

which is way larger that the distance between the points.

If you want to avoid exactly evaluating the points when it is
not needed, you can use the interval length printed above to
check when you want to refine the interval.

Note that the two methods I mention in my first email are also
valid alternatives.

Sebastien.

On 03/19/2013 10:12 AM, Sebastien Loriot (GeometryFactory) wrote:
It is indeed a problem bug due to a numerical issue.

This comes from the fact that you have two points that are
closed together while the coordinates of your points are very large.

If you translate the polygon, by doing:

FT dx = CGAL::Gmpq(650950);
FT dy = CGAL::Gmpq(6861560);
Point_2 p(x-dx, y-dy);

you'll see that the result looks better.

I will investigate to see if there is an easy fix and post on the list
when I have an update.

In the meantime, you can either simplify the input polygon (say if an
edge is below a chosen threshold you ignore it) or translate your
polygon close to the origin using a translation with integer
coordinates.

Thanks for the report,

Sebastien.

On 03/17/2013 09:59 PM, Myirci wrote:
Dear all CGAL users,

I've a weird output from CGAL Straight Skeleton. I attached my output
and the simple code to regenerate the output. My OS is Ubuntu 12.10
32-bit and I'm using CGAL 4.1. Could you please check the output? Is
this a bug or am I doing something wrong?

In my analysis, I checked the approximation of the exact numbers to
double by printing the intervals using CGAL::to_interval() for the
skeleton vertices and there seems to be an anomaly for the point S3 (see
the figures). The interval is given as: [(650950.772473049,
650961.1943390622) (6861561.907245005, 6861566.64668196)] for that
point. I think this is the source of the error. Is there a method for
narrowing down the interval?

Thank you for your time and considerations.

Best wishes

--
Murat Yirci





Archive powered by MHonArc 2.6.18.

Top of Page