Added split copy operations, which copy properties of splitted elements to the newly created ones. ( Thanks to Duncan Paterson for the patch ).
Improved documentation on the split functions refs #971 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@683 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -939,16 +939,6 @@ void PolyConnectivity::triangulate()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void PolyConnectivity::split(FaceHandle fh, VertexHandle vh)
|
void PolyConnectivity::split(FaceHandle fh, VertexHandle vh)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Split an arbitrary face into triangles by connecting
|
|
||||||
each vertex of fh to vh.
|
|
||||||
|
|
||||||
- fh will remain valid (it will become one of the
|
|
||||||
triangles)
|
|
||||||
- the halfedge handles of the new triangles will
|
|
||||||
point to the old halfeges
|
|
||||||
*/
|
|
||||||
|
|
||||||
HalfedgeHandle hend = halfedge_handle(fh);
|
HalfedgeHandle hend = halfedge_handle(fh);
|
||||||
HalfedgeHandle hh = next_halfedge_handle(hend);
|
HalfedgeHandle hh = next_halfedge_handle(hend);
|
||||||
|
|
||||||
@@ -989,6 +979,17 @@ void PolyConnectivity::split(FaceHandle fh, VertexHandle vh)
|
|||||||
set_halfedge_handle(vh, hold);
|
set_halfedge_handle(vh, hold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PolyConnectivity::split_copy(FaceHandle fh, VertexHandle vh) {
|
||||||
|
|
||||||
|
// Split the given face (fh will still be valid)
|
||||||
|
split(fh, vh);
|
||||||
|
|
||||||
|
// Copy the property of the original face to all new faces
|
||||||
|
for(VertexFaceIter vf_it = vf_iter(vh); vf_it; ++vf_it)
|
||||||
|
copy_all_properties(fh, vf_it);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
uint PolyConnectivity::valence(VertexHandle _vh) const
|
uint PolyConnectivity::valence(VertexHandle _vh) const
|
||||||
{
|
{
|
||||||
@@ -1071,5 +1072,19 @@ void PolyConnectivity::split_edge(EdgeHandle _eh, VertexHandle _vh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace OpenMesh
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void PolyConnectivity::split_edge_copy(EdgeHandle _eh, VertexHandle _vh)
|
||||||
|
{
|
||||||
|
// Split the edge (handle is kept!)
|
||||||
|
split_edge(_eh, _vh);
|
||||||
|
|
||||||
|
// Navigate to the new edge
|
||||||
|
EdgeHandle eh0 = edge_handle( next_halfedge_handle( halfedge_handle(_eh, 1) ) );
|
||||||
|
|
||||||
|
// Copy the property from the original to the new edge
|
||||||
|
copy_all_properties(_eh, eh0);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace OpenMesh
|
||||||
|
|
||||||
|
|||||||
@@ -684,9 +684,35 @@ public:
|
|||||||
*/
|
*/
|
||||||
HalfedgeHandle insert_edge(HalfedgeHandle _prev_heh, HalfedgeHandle _next_heh);
|
HalfedgeHandle insert_edge(HalfedgeHandle _prev_heh, HalfedgeHandle _next_heh);
|
||||||
|
|
||||||
/// Face split (= 1-to-n split)
|
/** \brief Face split (= 1-to-n split).
|
||||||
|
*
|
||||||
|
* Split an arbitrary face into triangles by connecting each vertex of fh to vh.
|
||||||
|
*
|
||||||
|
* \note fh will remain valid (it will become one of the triangles)
|
||||||
|
* \note the halfedge handles of the new triangles will point to the old halfeges
|
||||||
|
*
|
||||||
|
* \note The properties of the new faces and all other new primitives will be undefined!
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _vh Vertex handle of the new vertex that will be inserted in the face
|
||||||
|
*/
|
||||||
void split(FaceHandle _fh, VertexHandle _vh);
|
void split(FaceHandle _fh, VertexHandle _vh);
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-n split).
|
||||||
|
*
|
||||||
|
* Split an arbitrary face into triangles by connecting each vertex of fh to vh.
|
||||||
|
*
|
||||||
|
* \note fh will remain valid (it will become one of the triangles)
|
||||||
|
* \note the halfedge handles of the new triangles will point to the old halfeges
|
||||||
|
*
|
||||||
|
* \note The properties of the new faces will be adjusted to the properties of the original faces
|
||||||
|
* \note Properties of the new edges and halfedges will be undefined
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _vh Vertex handle of the new vertex that will be inserted in the face
|
||||||
|
*/
|
||||||
|
void split_copy(FaceHandle _fh, VertexHandle _vh);
|
||||||
|
|
||||||
/** \brief Triangulate the face _fh
|
/** \brief Triangulate the face _fh
|
||||||
|
|
||||||
Split an arbitrary face into triangles by connecting
|
Split an arbitrary face into triangles by connecting
|
||||||
@@ -706,9 +732,31 @@ public:
|
|||||||
*/
|
*/
|
||||||
void triangulate();
|
void triangulate();
|
||||||
|
|
||||||
/// Edge split (inserts a vertex on the edge only)
|
/** Edge split (inserts a vertex on the edge only)
|
||||||
|
*
|
||||||
|
* This edge split only splits the edge without introducing new faces!
|
||||||
|
* As this is for polygonal meshes, we can have valence 2 vertices here.
|
||||||
|
*
|
||||||
|
* \note The properties of the new edges and halfedges will be undefined!
|
||||||
|
*
|
||||||
|
* @param _eh Handle of the edge, that will be splitted
|
||||||
|
* @param _vh Handle of the vertex that will be inserted at the edge
|
||||||
|
*/
|
||||||
void split_edge(EdgeHandle _eh, VertexHandle _vh);
|
void split_edge(EdgeHandle _eh, VertexHandle _vh);
|
||||||
|
|
||||||
|
/** Edge split (inserts a vertex on the edge only)
|
||||||
|
*
|
||||||
|
* This edge split only splits the edge without introducing new faces!
|
||||||
|
* As this is for polygonal meshes, we can have valence 2 vertices here.
|
||||||
|
*
|
||||||
|
* \note The properties of the new edge will be copied from the splitted edge
|
||||||
|
* \note Properties of the new halfedges will be undefined
|
||||||
|
*
|
||||||
|
* @param _eh Handle of the edge, that will be splitted
|
||||||
|
* @param _vh Handle of the vertex that will be inserted at the edge
|
||||||
|
*/
|
||||||
|
void split_edge_copy(EdgeHandle _eh, VertexHandle _vh);
|
||||||
|
|
||||||
|
|
||||||
/** \name Generic handle derefertiation.
|
/** \name Generic handle derefertiation.
|
||||||
Calls the respective vertex(), halfedge(), edge(), face()
|
Calls the respective vertex(), halfedge(), edge(), face()
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ void TriConnectivity::flip(EdgeHandle _eh)
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void TriConnectivity::split(EdgeHandle _eh, VertexHandle _vh)
|
void TriConnectivity::split(EdgeHandle _eh, VertexHandle _vh)
|
||||||
{
|
{
|
||||||
HalfedgeHandle h0 = halfedge_handle(_eh, 0);
|
HalfedgeHandle h0 = halfedge_handle(_eh, 0);
|
||||||
@@ -479,4 +480,17 @@ void TriConnectivity::split(EdgeHandle _eh, VertexHandle _vh)
|
|||||||
set_halfedge_handle(v2, t1);
|
set_halfedge_handle(v2, t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void TriConnectivity::split_copy(EdgeHandle _eh, VertexHandle _vh)
|
||||||
|
{
|
||||||
|
// Split the halfedge ( handle will be preserved)
|
||||||
|
split(_eh, _vh);
|
||||||
|
|
||||||
|
// Copy the properties of the original edge to all neighbor edges that
|
||||||
|
// have been created
|
||||||
|
for(VEIter ve_it = ve_iter(_vh); ve_it; ++ve_it)
|
||||||
|
copy_all_properties(_eh, ve_it);
|
||||||
|
}
|
||||||
|
|
||||||
}// namespace OpenMesh
|
}// namespace OpenMesh
|
||||||
|
|||||||
@@ -146,13 +146,49 @@ public:
|
|||||||
Check for topological correctness first using is_flip_ok(). */
|
Check for topological correctness first using is_flip_ok(). */
|
||||||
void flip(EdgeHandle _eh);
|
void flip(EdgeHandle _eh);
|
||||||
|
|
||||||
/// Edge split (= 2-to-4 split)
|
|
||||||
|
/** \brief Edge split (= 2-to-4 split)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* The function will introduce two new faces ( non-boundary case) or
|
||||||
|
* one additional face (if edge is boundary)
|
||||||
|
*
|
||||||
|
* \note The properties of the new edges, halfedges, and faces will be undefined!
|
||||||
|
*
|
||||||
|
* @param _eh Edge handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the edge
|
||||||
|
*/
|
||||||
void split(EdgeHandle _eh, VertexHandle _vh);
|
void split(EdgeHandle _eh, VertexHandle _vh);
|
||||||
|
|
||||||
/// Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
/** \brief Edge split (= 2-to-4 split)
|
||||||
|
*
|
||||||
|
* The function will introduce two new faces ( non-boundary case) or
|
||||||
|
* one additional face (if edge is boundary)
|
||||||
|
*
|
||||||
|
* \note The properties of the new edges will be adjusted to the properties of the original edge
|
||||||
|
* \note The properties of the new faces and halfedges will be undefined
|
||||||
|
*
|
||||||
|
* @param _eh Edge handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the edge
|
||||||
|
*/
|
||||||
|
void split_copy(EdgeHandle _eh, VertexHandle _vh);
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the face
|
||||||
|
*/
|
||||||
inline void split(FaceHandle _fh, VertexHandle _vh)
|
inline void split(FaceHandle _fh, VertexHandle _vh)
|
||||||
{ PolyConnectivity::split(_fh, _vh); }
|
{ PolyConnectivity::split(_fh, _vh); }
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the face
|
||||||
|
*/
|
||||||
|
inline void split_copy(FaceHandle _fh, VertexHandle _vh)
|
||||||
|
{ PolyConnectivity::split_copy(_fh, _vh); }
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -178,19 +178,89 @@ public:
|
|||||||
|
|
||||||
/// Edge split (= 2-to-4 split)
|
/// Edge split (= 2-to-4 split)
|
||||||
/// Do not call PolyMeshT function below as this does the wrong operation
|
/// Do not call PolyMeshT function below as this does the wrong operation
|
||||||
|
|
||||||
|
/** \brief Edge split (= 2-to-4 split)
|
||||||
|
*
|
||||||
|
* The properties of the new edges will be undefined!
|
||||||
|
*
|
||||||
|
* @param _eh Edge handle that should be splitted
|
||||||
|
* @param _p New point position that will be inserted at the edge
|
||||||
|
* @return Vertex handle of the newly added vertex
|
||||||
|
*/
|
||||||
inline VertexHandle split(EdgeHandle _eh, const Point& _p)
|
inline VertexHandle split(EdgeHandle _eh, const Point& _p)
|
||||||
{ const VertexHandle vh = this->add_vertex(_p); Kernel::split(_eh, vh); return vh; }
|
{ const VertexHandle vh = this->add_vertex(_p); Kernel::split(_eh, vh); return vh; }
|
||||||
|
|
||||||
|
/** \brief Edge split (= 2-to-4 split)
|
||||||
|
*
|
||||||
|
* The properties of the new edges will be adjusted to the properties of the original edge
|
||||||
|
*
|
||||||
|
* @param _eh Edge handle that should be splitted
|
||||||
|
* @param _p New point position that will be inserted at the edge
|
||||||
|
* @return Vertex handle of the newly added vertex
|
||||||
|
*/
|
||||||
|
inline VertexHandle split_copy(EdgeHandle _eh, const Point& _p)
|
||||||
|
{ const VertexHandle vh = this->add_vertex(_p); Kernel::split_copy(_eh, vh); return vh; }
|
||||||
|
|
||||||
|
/** \brief Edge split (= 2-to-4 split)
|
||||||
|
*
|
||||||
|
* The properties of the new edges will be undefined!
|
||||||
|
*
|
||||||
|
* @param _eh Edge handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the edge
|
||||||
|
*/
|
||||||
inline void split(EdgeHandle _eh, VertexHandle _vh)
|
inline void split(EdgeHandle _eh, VertexHandle _vh)
|
||||||
{ Kernel::split(_eh, _vh); }
|
{ Kernel::split(_eh, _vh); }
|
||||||
|
|
||||||
/// Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
/** \brief Edge split (= 2-to-4 split)
|
||||||
|
*
|
||||||
|
* The properties of the new edges will be adjusted to the properties of the original edge
|
||||||
|
*
|
||||||
|
* @param _eh Edge handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the edge
|
||||||
|
*/
|
||||||
|
inline void split_copy(EdgeHandle _eh, VertexHandle _vh)
|
||||||
|
{ Kernel::split_copy(_eh, _vh); }
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
||||||
|
*
|
||||||
|
* The properties of the new faces will be undefined!
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _p New point position that will be inserted in the face
|
||||||
|
*/
|
||||||
inline void split(FaceHandle _fh, const Point& _p)
|
inline void split(FaceHandle _fh, const Point& _p)
|
||||||
{ PolyMesh::split(_fh, _p); }
|
{ PolyMesh::split(_fh, _p); }
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
||||||
|
*
|
||||||
|
* The properties of the new faces will be adjusted to the properties of the original face
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _p New point position that will be inserted in the face
|
||||||
|
*/
|
||||||
|
inline void split_copy(FaceHandle _fh, const Point& _p)
|
||||||
|
{ PolyMesh::split_copy(_fh, _p); }
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
||||||
|
*
|
||||||
|
* The properties of the new faces will be undefined!
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the face
|
||||||
|
*/
|
||||||
inline void split(FaceHandle _fh, VertexHandle _vh)
|
inline void split(FaceHandle _fh, VertexHandle _vh)
|
||||||
{ PolyMesh::split(_fh, _vh); }
|
{ PolyMesh::split(_fh, _vh); }
|
||||||
|
|
||||||
|
/** \brief Face split (= 1-to-3 split, calls corresponding PolyMeshT function).
|
||||||
|
*
|
||||||
|
* The properties of the new faces will be adjusted to the properties of the original face
|
||||||
|
*
|
||||||
|
* @param _fh Face handle that should be splitted
|
||||||
|
* @param _vh Vertex handle that will be inserted at the face
|
||||||
|
*/
|
||||||
|
inline void split_copy(FaceHandle _fh, VertexHandle _vh)
|
||||||
|
{ PolyMesh::split_copy(_fh, _vh); }
|
||||||
|
|
||||||
/** \name Normal vector computation
|
/** \name Normal vector computation
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|||||||
Reference in New Issue
Block a user