Comments (11)
Still occurring in current PostGIS trunk (2.2.0dev) -- sounds worth a ticket on the PostGIS side
from sfcgal.
PostGIS ticket existed already, for the record: https://trac.osgeo.org/postgis/ticket/3107
from sfcgal.
I've reproduced the problem with sfcgal master, postgis trunk and postgres 9.3.
If I compile in debug, I get a nice and clean:
ERROR: CGAL failed to create straightSkeleton
Which is due to CGAL not beeing able to perform the operation (added unit test in SFCGAL to check that). Normally an exception is raised by CGAL and the exception is trapped in sfcgal_c.cpp and converted to an error. And the output should be the one above.
If I compile in release... well I said I reproduced the problem.
from sfcgal.
Apparently CGAL has no problem with this polygon when alone.
Another strange thing is that the unit test that I made (see branch issue75) fails if run within the test suite, but not if ran alone.
//g++ -O3 sfcgal_issue_75.cpp -lCGAL -lCGAL_Core -lboost_thread -lgmp -lmpfr
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/create_straight_skeleton_from_polygon_with_holes_2.h>
int main ()
{
using namespace CGAL;
typedef Exact_predicates_exact_constructions_kernel Kernel ;
typedef Straight_skeleton_2<Kernel> Straight_skeleton_2 ;
Polygon_2<Kernel> outer;
outer.push_back ( Point_2<Kernel>(1347259.25, 7184745.94) );
outer.push_back ( Point_2<Kernel>(1347273.17, 7184758.16) );
outer.push_back ( Point_2<Kernel>(1347280.39, 7184749.95) );
outer.push_back ( Point_2<Kernel>(1347278.04, 7184747.88) );
outer.push_back ( Point_2<Kernel>(1347281.66, 7184743.76) );
outer.push_back ( Point_2<Kernel>(1347284.01, 7184745.83) );
outer.push_back ( Point_2<Kernel>(1347293.5, 7184735.05) );
outer.push_back ( Point_2<Kernel>(1347279.61, 7184722.85) );
outer.push_back ( Point_2<Kernel>(1347269.29, 7184734.6) );
outer.push_back ( Point_2<Kernel>(1347270.35, 7184735.51) );
outer.push_back ( Point_2<Kernel>(1347267.31, 7184738.96) );
outer.push_back ( Point_2<Kernel>(1347266.22, 7184738.01) );
std::vector< Polygon_2<Kernel> > holes(2);
holes[0].push_back ( Point_2<Kernel>(1347267.31, 7184738.96) );
holes[0].push_back ( Point_2<Kernel>(1347269.31, 7184736.7) );
holes[0].push_back ( Point_2<Kernel>(1347272.57, 7184739.55) );
holes[0].push_back ( Point_2<Kernel>(1347270.56, 7184741.83) );
Polygon_with_holes_2<Kernel> polygon( outer, holes.begin(), holes.end() );
boost::shared_ptr< Straight_skeleton_2 > skeleton = create_interior_straight_skeleton_2( polygon );
std::cerr << skeleton.get() << "\n";
return 0;
}
from sfcgal.
The case seems to be using a lot of RAM.
Run under valgrind it ends up out of memory pretty soon.
Under GDB here's a backtrace (as of current master: 3d79a70)
Program received signal SIGSEGV, Segmentation fault.
CGAL::Straight_skeleton_converter_2<CGAL::Straight_skeleton_2<CGAL::Epick, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::Straight_s
keleton_2<CGAL::Epeck, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::Straight_skeleton_items_converter_2<CGAL::Straight_skeleton_2<
CGAL::Epick, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::Straight_skeleton_2<CGAL::Epeck, CGAL::Straight_skeleton_items_2, std::a
llocator<int> >, CGAL::NT_converter<double, CGAL::Lazy_exact_nt<CGAL::Gmpq> > > >::create_unconnected_copy (this=this@entry=0x7fffffffc5d0,
aSource=...) at /usr/local/include/CGAL/HalfedgeDS_list.h:454
454 Vertex_const_iterator vertices_begin() const{ return vertices.begin();}
(gdb) bt
#0 CGAL::Straight_skeleton_converter_2<CGAL::Straight_skeleton_2<CGAL::Epick, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::Straight_skeleton_2<CGAL::Epeck, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::Straight_skeleton_items_converter_2<CGAL::Straight_skeleton_2<CGAL::Epick, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::Straight_skeleton_2<CGAL::Epeck, CGAL::Straight_skeleton_items_2, std::allocator<int> >, CGAL::NT_converter<double, CGAL::Lazy_exact_nt<CGAL::Gmpq> > > >::create_unconnected_copy (this=this@entry=0x7fffffffc5d0,
aSource=...) at /usr/local/include/CGAL/HalfedgeDS_list.h:454
#1 0x00007ffff7922ee8 in operator() (aSkeleton=..., this=0x7fffffffc5d0) at /usr/local/include/CGAL/Straight_skeleton_converter_2.h:129
#2 convert_straight_skeleton_2<CGAL::Straight_skeleton_2<CGAL::Epeck>, CGAL::Straight_skeleton_2<CGAL::Epick> > (aSrc=...)
at /usr/local/include/CGAL/Straight_skeleton_converter_2.h:293
#3 SFCGAL::algorithm::straightSkeleton (poly=...) at /usr/src/sfcgal/SFCGAL/src/algorithm/straightSkeleton.cpp:97
#4 0x00007ffff79231bc in SFCGAL::algorithm::straightSkeleton (g=..., innerOnly=innerOnly@entry=false)
at /usr/src/sfcgal/SFCGAL/src/algorithm/straightSkeleton.cpp:159
#5 0x00007ffff7923625 in SFCGAL::algorithm::straightSkeleton (g=..., autoOrientation=autoOrientation@entry=true, innerOnly=innerOnly@entry=false)
at /usr/src/sfcgal/SFCGAL/src/algorithm/straightSkeleton.cpp:112
#6 0x00007ffff792375a in SFCGAL::algorithm::straightSkeleton (g=..., autoOrientation=autoOrientation@entry=true, innerOnly=innerOnly@entry=false)
at /usr/src/sfcgal/SFCGAL/src/algorithm/straightSkeleton.cpp:126
#7 0x00000000005b363b in SFCGAL_algorithm_StraightSkeletonTest::testPostgisIssue3107::test_method (this=this@entry=0x7fffffffca1f)
at /usr/src/sfcgal/SFCGAL/test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp:131
#8 0x00000000005b389e in SFCGAL_algorithm_StraightSkeletonTest::testPostgisIssue3107_invoker ()
at /usr/src/sfcgal/SFCGAL/test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp:128
#9 0x0000000000529fb7 in invoke<void (*)()> (this=<optimized out>, f=<optimized out>) at /usr/include/boost/test/utils/callback.hpp:56
#10 boost::unit_test::ut_detail::callback0_impl_t<boost::unit_test::ut_detail::unused, void (*)()>::invoke (this=<optimized out>)
at /usr/include/boost/test/utils/callback.hpp:89
#11 0x00007ffff71511f1 in operator() (this=<optimized out>) at ./boost/test/utils/callback.hpp:118
#12 operator() (this=<optimized out>) at ./boost/test/impl/unit_test_monitor.ipp:41
from sfcgal.
The CGAL only test actually fails for me:
[strk@cdb:/usr/src/sfcgal/SFCGAL(master)] valgrind ./a.out
==20081== Memcheck, a memory error detector
==20081== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==20081== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info
==20081== Command: ./a.out
==20081==
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: -CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1)
File: /usr/local/include/CGAL/Interval_nt.h
Line: 209
Explanation: Wrong rounding: did you forget the -frounding-math option if you use GCC (or -fp-model strict for Intel)?
==20081==
==20081== Process terminating with default action of signal 6 (SIGABRT): dumping core
==20081== at 0x5ECCCC9: raise (raise.c:56)
==20081== by 0x5ED00D7: abort (abort.c:89)
==20081== by 0x59DC6B4: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==20081== by 0x59DA835: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==20081== by 0x59DA862: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==20081== by 0x59DAAA1: __cxa_throw (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19)
==20081== by 0x4E4B7F8: CGAL::assertion_fail(char const*, char const*, int, char const*) (assertions.cpp:117)
==20081== by 0x40A417: CGAL::Interval_nt<false>::Test_runtime_rounding_modes::Test_runtime_rounding_modes() (in /usr/src/sfcgal/SFCGAL/a.out)
==20081== by 0x404AC2: _GLOBAL__sub_I_main (in /usr/src/sfcgal/SFCGAL/a.out)
==20081== by 0x42ACEC: __libc_csu_init (in /usr/src/sfcgal/SFCGAL/a.out)
==20081== by 0x5EB7E54: (below main) (libc-start.c:246)
==20081==
from sfcgal.
Forgive me, the valgrind report only shows that valgrind cannot be used. GDB reports no crash.
from sfcgal.
judging by the backtrace the problem may be in manipulating the skeleton (converting it with current master, or maybe just iterating it to convert to linestring in previous version). None of that is done by the standalone CGAL test as far as I can tell.
from sfcgal.
Rebuilding with -frounding-math allows to run under valgrind, but when doing so the error goes away !
from sfcgal.
The ring intersection checking code is suspicious, there might be an off-by-one there
from sfcgal.
Bingo, it's a case of touching interior rings, and the check is bogus.
See also #91
from sfcgal.
Related Issues (20)
- Bundled build HOT 2
- Replace auto_ptr by unique_ptr HOT 2
- Memory leak in extrude HOT 4
- PostGIS make error HOT 17
- unit-test & garden-test timeout with Boost 1.67 HOT 19
- Red warnings upon build of SFGCAL 1.3.6 HOT 1
- 1.3.6 build error on Fedora 30 (CGAL 4.14, gcc 9.0.1) HOT 19
- Undefined behaviour in CGAL when using difference3D HOT 2
- Crash under sfcgal_geometry_triangulate_2dz / SFCGAL::algorithm::isValid HOT 5
- "Geometry& operator= " is not implemented HOT 8
- CGAL 5.0 support HOT 6
- SFCGAL generates incorrect 3D intersection HOT 5
- Segfault on isValid HOT 6
- Installation creates both (prefix)/lib AND (prefix)/lib64 HOT 1
- Failing ApproximateMedialAxis and StraightSkeleton unit tests on Mac OS X HOT 2
- Broken libtoolize HOT 6
- Valid Solid shells cannot be converted to CGAL polyhedra HOT 16
- make is error HOT 4
- Could not find a configuration file for package "CGAL" on SFCGAL-1.3.7 HOT 2
- [IMPORTANT] Gitlab migration HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfcgal.