Skip to content

Commit

Permalink
Fixing dangling reference issue with tmesh
Browse files Browse the repository at this point in the history
  • Loading branch information
Pupillen committed Jul 9, 2023
1 parent 602d022 commit 7c71cee
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class Polygon_mesh_slicer

/// member variables
const AABBTree* m_tree_ptr;
TriangleMesh& m_tmesh;
TriangleMesh m_tmesh;
VertexPointMap m_vpmap;
Traits m_traits;
bool m_own_tree;
Expand Down Expand Up @@ -397,15 +397,13 @@ class Polygon_mesh_slicer
* Constructor using `edges(tmesh)` to initialize the
* internal `AABB_tree`.
* @param tmesh the triangulated surface mesh to be sliced.
* It must be valid and non modified as long
* as the functor is used.
* @param vpmap an instance of the vertex point property map associated to `tmesh`
* @param traits a traits class instance, can be omitted
*/
Polygon_mesh_slicer(const TriangleMesh& tmesh,
VertexPointMap vpmap,
const Traits& traits = Traits())
: m_tmesh(const_cast<TriangleMesh&>(tmesh))
: m_tmesh(tmesh)
, m_vpmap(vpmap)
, m_traits(traits)
, m_own_tree(true)
Expand All @@ -419,8 +417,6 @@ class Polygon_mesh_slicer
/**
* Constructor using a pre-built `AABB_tree` of edges provided by the user.
* @param tmesh the triangulated surface mesh to be sliced.
* It must be valid and non modified as long
* as the functor is used.
* @param tree must be initialized with all the edges of `tmesh`
* @param vpmap an instance of the vertex point property map associated to `tmesh`
* @param traits a traits class instance, can be omitted
Expand All @@ -430,7 +426,7 @@ class Polygon_mesh_slicer
VertexPointMap vpmap,
const Traits& traits = Traits())
: m_tree_ptr(&tree)
, m_tmesh(const_cast<TriangleMesh&>(tmesh))
, m_tmesh(tmesh)
, m_vpmap(vpmap)
, m_traits(traits)
, m_own_tree(false)
Expand All @@ -441,13 +437,11 @@ class Polygon_mesh_slicer
* internal `AABB_tree`. The vertex point property map used
* is `get(CGAL::vertex_point, tmesh)`
* @param tmesh the triangulated surface mesh to be sliced.
* It must be valid and non modified as long
* as the functor is used.
* @param traits a traits class instance, can be omitted
*/
Polygon_mesh_slicer(const TriangleMesh& tmesh,
const Traits& traits = Traits())
: m_tmesh(const_cast<TriangleMesh&>(tmesh))
: m_tmesh(tmesh)
, m_vpmap(get(boost::vertex_point, m_tmesh))
, m_traits(traits)
, m_own_tree(true)
Expand All @@ -462,16 +456,14 @@ class Polygon_mesh_slicer
* Constructor using a `AABB_tree` provided by the user.
* The vertex point property map used is `get(CGAL::vertex_point, tmesh)`
* @param tmesh the triangulated surface mesh to be sliced.
* It must be valid and non modified as long
* as the functor is used.
* @param tree must be initialized with all the edges of `tmesh`
* @param traits a traits class instance, can be omitted
*/
Polygon_mesh_slicer(const TriangleMesh& tmesh,
const AABBTree& tree,
const Traits& traits = Traits())
: m_tree_ptr(&tree)
, m_tmesh(const_cast<TriangleMesh&>(tmesh))
, m_tmesh(tmesh)
, m_vpmap(get(boost::vertex_point, m_tmesh))
, m_traits(traits)
, m_own_tree(false)
Expand Down

0 comments on commit 7c71cee

Please sign in to comment.