Skip to content
Snippets Groups Projects
Commit 0ca79a31 authored by Tom Fischer's avatar Tom Fischer
Browse files

[MGTL] Deep copy of seg to avoid modifying orig. pnts.

parent 1092652b
No related branches found
No related tags found
No related merge requests found
...@@ -413,14 +413,17 @@ static void mapPointOnSurfaceElement(MeshLib::Element const& elem, ...@@ -413,14 +413,17 @@ static void mapPointOnSurfaceElement(MeshLib::Element const& elem,
static std::vector<MeshLib::Element const*> static std::vector<MeshLib::Element const*>
getCandidateElementsForLineSegmentIntersection( getCandidateElementsForLineSegmentIntersection(
MeshLib::MeshElementGrid const& mesh_element_grid, MeshLib::MeshElementGrid const& mesh_element_grid,
GeoLib::LineSegment segment) GeoLib::LineSegment const& segment)
{ {
GeoLib::LineSegment seg_deep_copy(
new GeoLib::Point(segment.getBeginPoint()),
new GeoLib::Point(segment.getEndPoint()), true);
// modify z coordinates such that all surface elements around the line // modify z coordinates such that all surface elements around the line
// segment are found // segment are found
segment.getBeginPoint()[2] = mesh_element_grid.getMinPoint()[2]; seg_deep_copy.getBeginPoint()[2] = mesh_element_grid.getMinPoint()[2];
segment.getEndPoint()[2] = mesh_element_grid.getMaxPoint()[2]; seg_deep_copy.getEndPoint()[2] = mesh_element_grid.getMaxPoint()[2];
std::array<MathLib::Point3d, 2> const pnts{ std::array<MathLib::Point3d, 2> const pnts{
{segment.getBeginPoint(), segment.getEndPoint()}}; {seg_deep_copy.getBeginPoint(), seg_deep_copy.getEndPoint()}};
GeoLib::AABB aabb(pnts.cbegin(), pnts.cend()); GeoLib::AABB aabb(pnts.cbegin(), pnts.cend());
auto candidate_elements = mesh_element_grid.getElementsInVolume( auto candidate_elements = mesh_element_grid.getElementsInVolume(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment