From 1d5bbbcf6bed665affcd858146eaa2ac5ab6f930 Mon Sep 17 00:00:00 2001 From: Oliver Gloth Date: Thu, 17 Jul 2014 15:06:55 +0200 Subject: [PATCH] ray forward and backward --- src/libengrid/cgaltricadinterface.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libengrid/cgaltricadinterface.cpp b/src/libengrid/cgaltricadinterface.cpp index 47140d61..2f17bc97 100644 --- a/src/libengrid/cgaltricadinterface.cpp +++ b/src/libengrid/cgaltricadinterface.cpp @@ -264,15 +264,22 @@ void CgalTriCadInterface::computeIntersections(vec3_t x, vec3_t v, QVector inters; m_TriangleTree.all_intersections(ray, std::back_inserter(inters)); - intersections.resize(inters.size()); int i_intersections = 0; for (std::list::iterator i = inters.begin(); i != inters.end(); ++i) { + if (i->first.type() == typeid(Point)) { + ++i_intersections; + } + } + intersections.resize(i_intersections); + i_intersections = 0; + for (std::list::iterator i = inters.begin(); i != inters.end(); ++i) { int id = (i->second - m_Triangles.begin()); if (i->first.type() == typeid(Point)) { intersections[i_intersections].second = m_Tri2Grid[id]; Point p = boost::get(i->first); vec3_t xs(p[0], p[1], p[2]); intersections[i_intersections].first = xs; + ++i_intersections; } } } catch (CGAL::Failure_exception) { -- 2.11.4.GIT