SFML community forums

Help => General => Topic started by: kneegurr433 on January 19, 2018, 08:27:10 pm

Title: Thor: segfault with thor::triangulate
Post by: kneegurr433 on January 19, 2018, 08:27:10 pm
I need to use delaunay triangulation from Thor. I downloaded v2.0 SDK and built with CMake. Everytime I run example code (https://github.com/Bromeon/Thor/blob/master/examples/Triangulation.cpp (https://github.com/Bromeon/Thor/blob/master/examples/Triangulation.cpp)) occurs segmentation fault:

Program received signal SIGSEGV, Segmentation fault.
thor::detail::AdvancedVertex::getPosition (this=<optimized out>) at Triangulation.cpp:141
141                     return mPosition;

call stack:
#0  thor::detail::AdvancedVertex::getPosition (this=<optimized out>) at Triangulation.cpp:141
#1  thor::detail::setBoundaryPositions (allVertices=<error reading variable: Cannot access memory at address 0x43ae0048>,
    boundaryTriangle=...) at Triangulation.cpp:780
#2  0x0000000100005e0b in thor::detail::triangulateImpl<__gnu_cxx::__normal_iterator<sf::Vector2<float>*, std::vector<sf::Vector2<float>, std::allocator<sf::Vector2<float> > > >, std::back_insert_iterator<std::vector<thor::Triangle<sf::Vector2<float> >, std::allocator<thor::Triangle<sf::Vector2<float> > > > >, thor::detail::ConstrainedTrDetails<__gnu_cxx::__normal_iterator<thor::Edge<sf::Vector2<float> >*, std::vector<thor::Edge<sf::Vector2<float> >, std::allocator<thor::Edge<sf::Vector2<float> > > > > > > (verticesBegin=
  {x = 348, y = 180}, verticesEnd={x = 2.11876659e+11, y = 211109360}, trianglesOut=..., details=...)
    at /usr/local/include/Thor/Math/Detail/Triangulation.inl:415
#3  0x0000000100005b01 in thor::triangulateConstrained<__gnu_cxx::__normal_iterator<sf::Vector2<float>*, std::vector<sf::Vector2<float>, std::allocator<sf::Vector2<float> > > >, __gnu_cxx::__normal_iterator<thor::Edge<sf::Vector2<float> >*, std::vector<thor::Edge<sf::Vector2<float> >, std::allocator<thor::Edge<sf::Vector2<float> > > > >, std::back_insert_iterator<std::vector<thor::Triangle<sf::Vector2<float> >, std::allocator<thor::Triangle<sf::Vector2<float> > > > > > (verticesBegin={x = 348, y = 180}, verticesEnd=
  {x = 2.11876659e+11, y = 211109360}, constrainedEdgesBegin=non-dereferenceable iterator for std::vector,
    constrainedEdgesEnd=non-dereferenceable iterator for std::vector, trianglesOut=...)
    at /usr/local/include/Thor/Math/Detail/Triangulation.inl:448
#4  0x0000000100003c5f in thor::triangulate<__gnu_cxx::__normal_iterator<sf::Vector2<float>*, std::vector<sf::Vector2<float>, std::allocator<sf::Vector2<float> > > >, std::back_insert_iterator<std::vector<thor::Triangle<sf::Vector2<float> >, std::allocator<thor::Triangle<sf::Vector2<float> > > > > > (verticesBegin={x = 348, y = 180}, verticesEnd={x = 2.11876659e+11, y = 211109360},
    trianglesOut=...) at /usr/local/include/Thor/Math/Detail/Triangulation.inl:441
#5  0x0000000100002fa5 in handleEvents (window=..., vertices=std::vector of length 1, capacity 1 = {...},
    triangles=std::vector of length 0, capacity 0) at main.cpp:143
#6  0x00000001000027bd in main () at main.cpp:42
It seems like calling createBoundaryPoints function never happen.

I don't know what to do about that error so I'm asking here.
I use Arch Linux, Clang++-5.0, SFML 2.4.2 (dynamic linking).
Title: Re: Thor: segfault with thor::triangulate
Post by: eXpl0it3r on January 19, 2018, 09:42:03 pm
What do you mean with v2.0 SDK?
The master branch isn't on version 2.0, as such the example from the master branch isn't guaranteed to work with version 2.0.
Title: Re: Thor: segfault with thor::triangulate
Post by: kneegurr433 on January 19, 2018, 10:35:46 pm
I tried with Thor 2.0 and that one from the master branch. Neither of them works.