diff --git a/MeshGeoToolsLib/GeoMapper.cpp b/MeshGeoToolsLib/GeoMapper.cpp index 3553dba8350f0230a35fdfd66099972f2b86b75e..8cdc88c46506465b00a800848165ee40fcdd8096 100644 --- a/MeshGeoToolsLib/GeoMapper.cpp +++ b/MeshGeoToolsLib/GeoMapper.cpp @@ -230,20 +230,13 @@ double GeoMapper::getMeshElevation( return (*(_surface_mesh->getNode(pnt->getID())))[2]; } -unsigned getIndexInPntVec(GeoLib::Point const* const pnt, - std::vector<GeoLib::Point*> const& points) -{ - auto it (std::find(points.begin(), points.end(), pnt)); - return static_cast<unsigned>(std::distance(points.begin(), it)); -} - std::unique_ptr<std::vector<GeoLib::Polyline*>> copyPolylinesVector( - std::vector<GeoLib::Polyline*> const& polylines, - std::vector<GeoLib::Point*> const& points) + std::vector<GeoLib::Polyline*> const& polylines, + std::vector<GeoLib::Point*> const& points) { std::size_t nLines = polylines.size(); auto new_lines = std::unique_ptr<std::vector<GeoLib::Polyline*>>( - new std::vector<GeoLib::Polyline*>(nLines)); + new std::vector<GeoLib::Polyline*>(nLines)); for (std::size_t i=0; i<nLines; ++i) { @@ -292,9 +285,7 @@ void GeoMapper::advancedMapOnMesh( (*mesh->getNode(i))[1], 0.0, mesh->getNode(i)->getID()); GeoLib::Point* pnt = grid.getNearestPoint(zero_coords); dist[i] = MathLib::sqrDist(*pnt, zero_coords); - closest_geo_point[i] = (dist[i] <= max_segment_length) - ? getIndexInPntVec(pnt, *new_points) - : -1; + closest_geo_point[i] = (dist[i]<=max_segment_length) ? pnt->getID() : -1; } // store for each point the line segment to which it was added.