Radium Engine
1.5.20
|
#include <Core/Geometry/TopologicalMesh.hpp>
Classes | |
class | WedgeData |
Public Types | |
using | WedgeIndex = Ra::Core::Utils::Index |
using | WedgeAttribIndex = Ra::Core::Utils::Index |
Public Member Functions | |
TopologicalMesh () | |
template<typename MeshIndex > | |
TopologicalMesh (const Ra::Core::Geometry::IndexedGeometry< MeshIndex > &mesh) | |
Convenience constructor. | |
TopologicalMesh (const Ra::Core::Geometry::MultiIndexedGeometry &mesh, const Ra::Core::Geometry::MultiIndexedGeometry::LayerKeyType &layerKey) | |
Convenience constructor. | |
template<typename MeshIndex , typename NonManifoldFaceCommand > | |
TopologicalMesh (const Ra::Core::Geometry::IndexedGeometry< MeshIndex > &mesh, NonManifoldFaceCommand command) | |
template<typename NonManifoldFaceCommand > | |
TopologicalMesh (const Ra::Core::Geometry::MultiIndexedGeometry &mesh, const Ra::Core::Geometry::MultiIndexedGeometry::LayerKeyType &layerKey, NonManifoldFaceCommand command) | |
void | initWithWedge (const Ra::Core::Geometry::MultiIndexedGeometry &mesh, const Ra::Core::Geometry::MultiIndexedGeometry::LayerKeyType &layerKey) |
template<typename NonManifoldFaceCommand > | |
void | initWithWedge (const Ra::Core::Geometry::MultiIndexedGeometry &mesh, const Ra::Core::Geometry::MultiIndexedGeometry::LayerKeyType &layerKey, NonManifoldFaceCommand command) |
TriangleMesh | toTriangleMesh () |
PolyMesh | toPolyMesh () |
LineMesh | toLineMesh () |
void | updateTriangleMesh (Ra::Core::Geometry::MultiIndexedGeometry &mesh) |
void | updateTriangleMeshNormals (Ra::Core::Geometry::MultiIndexedGeometry &mesh) |
void | updateTriangleMeshNormals (AttribArrayGeometry::NormalAttribHandle::Container &normals) |
void | update (const Ra::Core::Geometry::MultiIndexedGeometry &mesh) |
void | updateNormals (const Ra::Core::Geometry::MultiIndexedGeometry &mesh) |
void | updatePositions (const Ra::Core::Geometry::MultiIndexedGeometry &mesh) |
void | updatePositions (const AttribArrayGeometry::PointAttribHandle::Container &vertices) |
HalfedgeHandle | halfedge_handle (VertexHandle vh, FaceHandle fh) const |
void | propagate_normal_to_wedges (VertexHandle vh) |
const OpenMesh::HPropHandleT< Index > & | getInputTriangleMeshIndexPropHandle () const |
const OpenMesh::HPropHandleT< Index > & | getOutputTriangleMeshIndexPropHandle () const |
void | copyPointsPositionToWedges () |
std::set< WedgeIndex > | getVertexWedges (OpenMesh::VertexHandle vh) const |
WedgeIndex | getWedgeIndex (OpenMesh::HalfedgeHandle heh) const |
const WedgeData & | getWedgeData (const WedgeIndex &idx) const |
template<typename T > | |
const T & | getWedgeData (const WedgeIndex &idx, const std::string &name) const |
template<typename T > | |
const T & | getWedgeAttrib (const WedgeIndex &idx, const std::string &name) const |
unsigned int | getWedgeRefCount (const WedgeIndex &idx) const |
void | setWedgeData (WedgeIndex widx, const WedgeData &wd) |
template<typename T > | |
bool | setWedgeData (const WedgeIndex &idx, const std::string &name, const T &value) |
template<typename T > | |
bool | setWedgeAttrib (const WedgeIndex &idx, const std::string &name, const T &value) |
WedgeData | newWedgeData () const |
WedgeData | newWedgeData (HalfedgeHandle he) const |
WedgeIndex | replaceWedge (OpenMesh::HalfedgeHandle he, const WedgeData &wd) |
template<typename T > | |
WedgeAttribIndex | addWedgeAttrib (const std::string &name, T value={}) |
void | replaceWedgeIndex (OpenMesh::HalfedgeHandle he, const WedgeIndex &widx) |
void | mergeEqualWedges () |
void | mergeEqualWedges (OpenMesh::VertexHandle vh) |
void | garbage_collection () |
Remove deleted element from the mesh, including wedges. | |
void | clean () |
const std::vector< std::string > & | getVec4AttribNames () const |
const std::vector< std::string > & | getVec3AttribNames () const |
const std::vector< std::string > & | getVec2AttribNames () const |
const std::vector< std::string > & | getFloatAttribNames () const |
bool | isFeatureVertex (const VertexHandle &vh) const |
true if more than one wedge arount vertex vh, false if only one wedge | |
bool | isFeatureEdge (const EdgeHandle &eh) const |
const OpenMesh::HPropHandleT< WedgeIndex > & | getWedgeIndexPph () const |
void | delete_face (FaceHandle _fh, bool _delete_isolated_vertices=true) |
bool | isManifold (VertexHandle vh) const |
bool | checkIntegrity () const |
void | triangulate () |
Dealing with normals | |
Utils to deal with normals when modifying the mesh topology. | |
void | updateWedgeNormals () |
Topological operations | |
bool | splitEdge (TopologicalMesh::EdgeHandle eh, Scalar f) |
void | collapse (HalfedgeHandle he, bool keepFromVertex=false) |
void | collapseWedge (TopologicalMesh::HalfedgeHandle he, bool keepFromVertex=false) |
Friends | |
class | TMOperations |
This class represents a mesh with topological information on the vertex graph, using a half-edge representation.
This integration is inspired by: https://gist.github.com/Unril/03fa353d0461ed6bd41d
rename methods to respect Radium guideline (get/set/is, camelCase)
private inheritance from OpenMesh, and import relevant methods.
Definition at line 55 of file TopologicalMesh.hpp.
using Ra::Core::Geometry::TopologicalMesh::WedgeAttribIndex = Ra::Core::Utils::Index |
Definition at line 68 of file TopologicalMesh.hpp.
using Ra::Core::Geometry::TopologicalMesh::WedgeIndex = Ra::Core::Utils::Index |
Definition at line 67 of file TopologicalMesh.hpp.
|
explicit |
Construct an empty topological mesh, only initialize mandatory properties.
Definition at line 183 of file TopologicalMesh.cpp.
|
explicit |
Convenience constructor.
Definition at line 1035 of file TopologicalMesh.hpp.
|
inlineexplicit |
Convenience constructor.
Definition at line 1045 of file TopologicalMesh.hpp.
|
explicit |
Construct a topological mesh from a triangle mesh. This operation merges vertex with same position, but keeps vertex attributes on halfedges, so that TriangleMesh vertices with the same 3D position are represented only once in the topological mesh.
NonManifoldFaceCommand | Command executed when non-manifold faces are found. API and default implementation: struct DefaultNonManifoldFaceCommand {
DefaultNonManifoldFaceCommand( const std::string& details = {} ) : m_details { details } {}
LOG( logWARNING ) << "Invalid face handle returned : face not added " + m_details;
}
inline void postProcess( TopologicalMesh& ) {}
private:
std::string m_details;
};
|
Definition at line 1039 of file TopologicalMesh.hpp.
|
explicit |
Construct a topological mesh from a triangle mesh. This operation merges vertex with same position, but keeps vertex attributes on halfedges, so that TriangleMesh vertices with the same 3D position are represented only once in the topological mesh.
NonManifoldFaceCommand | Command executed when non-manifold faces are found. API and default implementation: struct DefaultNonManifoldFaceCommand {
DefaultNonManifoldFaceCommand( const std::string& details = {} ) : m_details { details } {}
LOG( logWARNING ) << "Invalid face handle returned : face not added " + m_details;
}
inline void postProcess( TopologicalMesh& ) {}
private:
std::string m_details;
};
|
Definition at line 1051 of file TopologicalMesh.hpp.
|
inline |
Definition at line 306 of file TopologicalMesh.hpp.
bool Ra::Core::Geometry::TopologicalMesh::checkIntegrity | ( | ) | const |
Check if evrything looks right in the data structure
Definition at line 68 of file TopologicalMesh.cpp.
|
inline |
Definition at line 330 of file TopologicalMesh.hpp.
void Ra::Core::Geometry::TopologicalMesh::collapse | ( | HalfedgeHandle | he, |
bool | keepFromVertex = false ) |
Halfedge collapes he. vo=from_vertex_handle(he) is deleted. After collapse vo incoming halfedges points to vh = to_vertex_handle(he). Wedge indices are updated to reflect the change in topology. For detailed topological modifications see 3D objects (a.k.a. Meshes).
he | halfedge's hangle to collapse. |
keepFromVertex | whether the remaining vertex is from or to vertex of he |
Definition at line 783 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::collapseWedge | ( | TopologicalMesh::HalfedgeHandle | he, |
bool | keepFromVertex = false ) |
Definition at line 946 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::copyPointsPositionToWedges | ( | ) |
update wedge's position to correspond to current point position, which might not be the case if point(handle) = something; has been used.
Definition at line 497 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::delete_face | ( | FaceHandle | _fh, |
bool | _delete_isolated_vertices = true ) |
Definition at line 974 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::garbage_collection | ( | ) |
Remove deleted element from the mesh, including wedges.
Definition at line 950 of file TopologicalMesh.cpp.
|
inline |
Definition at line 1427 of file TopologicalMesh.hpp.
|
inline |
Return a handle to the halfedge property storing vertices indices within the TriangleMesh *this has been built on.
Definition at line 1325 of file TopologicalMesh.hpp.
|
inline |
Return a handle to the halfedge property storing vertices indices within the TriangleMesh returned by toTriangleMesh().
Definition at line 1330 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1424 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1421 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1418 of file TopologicalMesh.hpp.
|
inline |
Return the set of WedgeIndex incident to a given Vertex vh. only valid non deleted wedges are present in the set.
Definition at line 1335 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1385 of file TopologicalMesh.hpp.
|
inline |
Access to wedge data.
idx | must be valid and correspond to a non delete wedge index. |
Definition at line 1374 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1379 of file TopologicalMesh.hpp.
|
inline |
get the wedge index associated with an halfedge
Definition at line 1346 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1448 of file TopologicalMesh.hpp.
|
inline |
Return the wedge refcount, for debug purpose.
Definition at line 1350 of file TopologicalMesh.hpp.
|
inline |
Return the half-edge associated with a given vertex and face.
Definition at line 1315 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1059 of file TopologicalMesh.hpp.
void Ra::Core::Geometry::TopologicalMesh::initWithWedge | ( | const Ra::Core::Geometry::MultiIndexedGeometry & | mesh, |
const Ra::Core::Geometry::MultiIndexedGeometry::LayerKeyType & | layerKey, | ||
NonManifoldFaceCommand | command ) |
Definition at line 1068 of file TopologicalMesh.hpp.
|
inline |
true if at least one of edge's vertex as two different wedge arount the edge. false if the two vertices have the same wedge for both face aside the edge.
Definition at line 1435 of file TopologicalMesh.hpp.
|
inline |
true if more than one wedge arount vertex vh, false if only one wedge
Definition at line 1431 of file TopologicalMesh.hpp.
bool Ra::Core::Geometry::TopologicalMesh::isManifold | ( | VertexHandle | vh | ) | const |
is the vertex a "bow tie" vertex ?
Definition at line 64 of file TopologicalMesh.cpp.
|
inline |
call mergeEquelWedges( vh ) for every vertices of the mesh.
Definition at line 1404 of file TopologicalMesh.hpp.
|
inline |
Merge (make same index) wegdes with the same data around vh
vh | vertex handle to process |
Definition at line 1410 of file TopologicalMesh.hpp.
|
inline |
return a WedgeData with all attrib initialized to default values
Definition at line 291 of file TopologicalMesh.hpp.
|
inline |
return a WedgeData with position (and vertex handle) initialized from the value of he's to vertex.
Definition at line 294 of file TopologicalMesh.hpp.
|
inline |
Set the normal n to all the wedges that share to vh. If you work with vertex normals, please call this function on all vertex handles before convertion with toTriangleMesh.
Definition at line 1301 of file TopologicalMesh.hpp.
|
inline |
Replace the wedge data associated with an halfedge. The old wedge is "deleted". If wedge data correspond to an already present wedge, it's index is used.
Definition at line 1390 of file TopologicalMesh.hpp.
|
inline |
Replace the wedge index associated with an halfedge. The old wedge is "deleted". The new wedge reference count is incremented.
Definition at line 1398 of file TopologicalMesh.hpp.
|
inline |
Definition at line 1362 of file TopologicalMesh.hpp.
|
inline |
Change the WedgeData associated for idx, for attrib name to value. The data is changed for all halfedges referencing this wedge.
Definition at line 1355 of file TopologicalMesh.hpp.
|
inline |
set WedgeData wd to the wedge with index widx. All halfedge that point to widx will get the new values.
widx | index of the wedge |
wd | data to set to wedge that correspond to widx |
Definition at line 1368 of file TopologicalMesh.hpp.
bool Ra::Core::Geometry::TopologicalMesh::splitEdge | ( | TopologicalMesh::EdgeHandle | eh, |
Scalar | f ) |
Apply a 2-4 edge split.
eh | The handle to the edge to split. |
f | The interpolation factor to place the new point on the edge. Must be in [0,1]. |
Definition at line 647 of file TopologicalMesh.cpp.
LineMesh Ra::Core::Geometry::TopologicalMesh::toLineMesh | ( | ) |
Wedges are output vertices !
Definition at line 258 of file TopologicalMesh.cpp.
PolyMesh Ra::Core::Geometry::TopologicalMesh::toPolyMesh | ( | ) |
Return a triangleMesh from the topological mesh.
add attribs to out
Wedges are output vertices !
Definition at line 316 of file TopologicalMesh.cpp.
TriangleMesh Ra::Core::Geometry::TopologicalMesh::toTriangleMesh | ( | ) |
Return a triangleMesh from the topological mesh.
add attribs to out
Wedges are output vertices !
Definition at line 206 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::triangulate | ( | ) |
Definition at line 114 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::update | ( | const Ra::Core::Geometry::MultiIndexedGeometry & | mesh | ) |
Definition at line 419 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updateNormals | ( | const Ra::Core::Geometry::MultiIndexedGeometry & | mesh | ) |
Definition at line 452 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updatePositions | ( | const AttribArrayGeometry::PointAttribHandle::Container & | vertices | ) |
Definition at line 443 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updatePositions | ( | const Ra::Core::Geometry::MultiIndexedGeometry & | mesh | ) |
Definition at line 439 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updateTriangleMesh | ( | Ra::Core::Geometry::MultiIndexedGeometry & | mesh | ) |
Update triangle mesh data, assuming the mesh and this topo mesh has the same topology.
Wedges are output vertices !
Definition at line 373 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updateTriangleMeshNormals | ( | AttribArrayGeometry::NormalAttribHandle::Container & | normals | ) |
Definition at line 401 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updateTriangleMeshNormals | ( | Ra::Core::Geometry::MultiIndexedGeometry & | mesh | ) |
Definition at line 413 of file TopologicalMesh.cpp.
void Ra::Core::Geometry::TopologicalMesh::updateWedgeNormals | ( | ) |
Definition at line 460 of file TopologicalMesh.cpp.
|
friend |
Definition at line 634 of file TopologicalMesh.hpp.