Question about delaunay precision.

14 views
Skip to first unread message

Willie Maddox

unread,
Sep 25, 2013, 11:30:13 AM9/25/13
to cgal-bindi...@googlegroups.com
Hello,

Here is a a sample of some saved Delaunay Triangulaiton data using the "write_to_file" function:

4366 8728 2
-932.286 -456.86
-949.082 -399.486
-951.241 -190.631
...
...
-841.686 -490.896
-841.689 -520.968
-841.689 -522.191

793 794 3 
2 804 805 
783 784 20 
...
...
8484 8487 8724 
8727 8682 8519 
8 8686 8726 
...

For a particular application, however, I needed more precision. 
I tried modifying line 181 in SWIG_CGAL/Triangulations_2/Triangulation_2.h from:

else out << get_data();
to,
else out << std::fixed << std::setprecision(15) << get_data();

and the result looks promising:

4366 8728 2
-932.286071777343750 -456.860137939453125
-949.081542968750000 -399.486114501953125
-951.240783691406250 -190.631210327148438
...
...
-841.686491834052504 -490.895905242047320
-841.689236670315040 -520.967833910861259
-841.689348307647606 -522.190912295210637

793 794 3 
2 804 805 
783 784 20 
...
...
8484 8487 8724 
8727 8682 8519 
8 8686 8726 
...

Is there a way to make this a keyword option of "write_to_file" rather than a 'hard coded' mod?
Maybe something with the flavor,

dt.write_to_file(filename, prec=15)
or
dt.write_to_file(filename, prec=1e-15)
or
dt.write_to_file(filename, prec=machine_precision)

Thoughts?

-Will Maddox

Sebastien Loriot (GeometryFactory)

unread,
Sep 26, 2013, 1:19:13 AM9/26/13
to cgal-bindi...@googlegroups.com
Done.
> --
> You received this message because you are subscribed to the Google
> Groups "CGAL Bindings discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cgal-bindings-di...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Willie Maddox

unread,
Sep 26, 2013, 1:05:06 PM9/26/13
to cgal-bindi...@googlegroups.com
Thanks Sebastien,

Would you mind commenting on the usage?

dt.write_to_file(filename, prec=15)

returns,

TypeError: write_to_file() got an unexpected keyword argument 'prec'

and

dt.write_to_file(filename, 15)

returns,

TypeError: Internal_Triangulation_2_Internal_Contrained_triangulation_2_Constrained_Delaunay_triangulation_2_write_to_file() takes exactly 2 arguments (3 given)

NOTE: I am actually using constrained Delaunay. This shouldn't matter right?

Thanks,

-Will

Sebastien Loriot (GeometryFactory)

unread,
Sep 26, 2013, 1:23:33 PM9/26/13
to cgal-bindi...@googlegroups.com
On 09/26/2013 07:05 PM, Willie Maddox wrote:
> Thanks Sebastien,
>
> Would you mind commenting on the usage?
>
> dt.write_to_file(filename, prec=15)
not sure named parmaters are supported.

>
> returns,
>
> TypeError: write_to_file() got an unexpected keyword argument 'prec'
>
> and
>
> dt.write_to_file(filename, 15)

This one should be correct.

>
> returns,
>
> TypeError:
> Internal_Triangulation_2_Internal_Contrained_triangulation_2_Constrained_Delaunay_triangulation_2_write_to_file()
> takes exactly 2 arguments (3 given)
>
> NOTE: I am actually using constrained Delaunay. This shouldn't matter right?

Try to "touch" CGAL_Triangulation_2.i to be sure the interface is
rebuilt by swig (otherwise only the lib is rebuilt).

Sebastien.

>
> Thanks,
>
> -Will

Willie Maddox

unread,
Oct 1, 2013, 8:07:11 AM10/1/13
to cgal-bindi...@googlegroups.com
That's what it was.  Thanks for adding this.
Reply all
Reply to author
Forward
0 new messages