Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Core::Geometry::deprecated::TopologicalMesh Class Reference

#include <Core/Geometry/deprecated/TopologicalMesh.hpp>

+ Collaboration diagram for Ra::Core::Geometry::deprecated::TopologicalMesh:

Public Member Functions

template<typename NonManifoldFaceCommand >
 TopologicalMesh (const Ra::Core::Geometry::TriangleMesh &triMesh, NonManifoldFaceCommand command)
 
 TopologicalMesh (const Ra::Core::Geometry::TriangleMesh &triMesh)
 Convenience constructor.
 
 TopologicalMesh ()
 
TriangleMesh toTriangleMesh ()
 
void updateTriangleMesh (Ra::Core::Geometry::TriangleMesh &mesh)
 
HalfedgeHandle halfedge_handle (VertexHandle vh, FaceHandle fh) const
 
const Normal & normal (VertexHandle vh, FaceHandle fh) const
 
void set_normal (VertexHandle vh, FaceHandle fh, const Normal &n)
 
void propagate_normal_to_halfedges (VertexHandle vh)
 
const OpenMesh::HPropHandleT< Index > & getInputTriangleMeshIndexPropHandle () const
 
const OpenMesh::HPropHandleT< Index > & getOutputTriangleMeshIndexPropHandle () const
 
Const access to handles of the HalfEdge properties coming from

the TriangleMesh attributes.

const std::vector< OpenMesh::HPropHandleT< Scalar > > & getFloatPropsHandles () const
 
const std::vector< OpenMesh::HPropHandleT< Vector2 > > & getVector2PropsHandles () const
 
const std::vector< OpenMesh::HPropHandleT< Vector3 > > & getVector3PropsHandles () const
 
const std::vector< OpenMesh::HPropHandleT< Vector4 > > & getVector4PropsHandles () const
 
Dealing with normals

Utils to deal with normals when modifying the mesh topology.

void createNormalPropOnFaces (OpenMesh::FPropHandleT< Normal > &fProp)
 
void clearProp (OpenMesh::FPropHandleT< Normal > &fProp)
 
void copyNormal (HalfedgeHandle input_heh, HalfedgeHandle copy_heh)
 
void copyNormalFromFace (FaceHandle fh, HalfedgeHandle heh, OpenMesh::FPropHandleT< Normal > fProp)
 
void interpolateNormal (HalfedgeHandle in_a, HalfedgeHandle in_b, HalfedgeHandle out, Scalar f)
 
void interpolateNormalOnFaces (FaceHandle fh, OpenMesh::FPropHandleT< Normal > fProp)
 
Dealing with custom properties

Utils to deal with custom properties of any type when modifying the mesh topology.

template<typename T >
void createPropsOnFaces (const std::vector< OpenMesh::HPropHandleT< T > > &input, std::vector< OpenMesh::FPropHandleT< T > > &output)
 
template<typename T >
void clearProps (std::vector< OpenMesh::FPropHandleT< T > > &props)
 
template<typename T >
void copyProps (HalfedgeHandle input_heh, HalfedgeHandle copy_heh, const std::vector< OpenMesh::HPropHandleT< T > > &props)
 
template<typename T >
void copyPropsFromFace (FaceHandle fh, HalfedgeHandle heh, const std::vector< OpenMesh::FPropHandleT< T > > &fProps, const std::vector< OpenMesh::HPropHandleT< T > > &hProps)
 
template<typename T >
void interpolateProps (HalfedgeHandle in_a, HalfedgeHandle in_b, HalfedgeHandle out, Scalar f, const std::vector< OpenMesh::HPropHandleT< T > > &props)
 
template<typename T >
void interpolatePropsOnFaces (FaceHandle fh, const std::vector< OpenMesh::HPropHandleT< T > > &hProps, const std::vector< OpenMesh::FPropHandleT< T > > &fProps)
 
Deal with all attributes* Utils to deal with the normal and

custom properties when modifying the mesh topology.

void createAllPropsOnFaces (OpenMesh::FPropHandleT< Normal > &normalProp, std::vector< OpenMesh::FPropHandleT< Scalar > > &floatProps, std::vector< OpenMesh::FPropHandleT< Vector2 > > &vec2Props, std::vector< OpenMesh::FPropHandleT< Vector3 > > &vec3Props, std::vector< OpenMesh::FPropHandleT< Vector4 > > &vec4Props)
 
void clearAllProps (OpenMesh::FPropHandleT< Normal > &normalProp, std::vector< OpenMesh::FPropHandleT< Scalar > > &floatProps, std::vector< OpenMesh::FPropHandleT< Vector2 > > &vec2Props, std::vector< OpenMesh::FPropHandleT< Vector3 > > &vec3Props, std::vector< OpenMesh::FPropHandleT< Vector4 > > &vec4Props)
 
void copyAllProps (HalfedgeHandle input_heh, HalfedgeHandle copy_heh)
 
void copyAllPropsFromFace (FaceHandle fh, HalfedgeHandle heh, OpenMesh::FPropHandleT< Normal > normalProp, std::vector< OpenMesh::FPropHandleT< Scalar > > &floatProps, std::vector< OpenMesh::FPropHandleT< Vector2 > > &vec2Props, std::vector< OpenMesh::FPropHandleT< Vector3 > > &vec3Props, std::vector< OpenMesh::FPropHandleT< Vector4 > > &vec4Props)
 
void interpolateAllProps (HalfedgeHandle in_a, HalfedgeHandle in_b, HalfedgeHandle out, Scalar f)
 
void interpolateAllPropsOnFaces (FaceHandle fh, OpenMesh::FPropHandleT< Normal > normalProp, std::vector< OpenMesh::FPropHandleT< Scalar > > &floatProps, std::vector< OpenMesh::FPropHandleT< Vector2 > > &vec2Props, std::vector< OpenMesh::FPropHandleT< Vector3 > > &vec3Props, std::vector< OpenMesh::FPropHandleT< Vector4 > > &vec4Props)
 
Topological operations
bool splitEdge (TopologicalMesh::EdgeHandle eh, Scalar f)
 
bool splitEdgeWedge (TopologicalMesh::EdgeHandle eh, Scalar f)
 

Friends

class TMOperations
 

Detailed Description

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

Todo

rename methods to respect Radium guideline (get/set/is, camelCase)

private inheritance from OpenMesh, and import relevant methods.

Definition at line 56 of file TopologicalMesh.hpp.

Constructor & Destructor Documentation

◆ TopologicalMesh() [1/3]

template<typename NonManifoldFaceCommand >
Ra::Core::Geometry::deprecated::TopologicalMesh::TopologicalMesh ( const Ra::Core::Geometry::TriangleMesh & triMesh,
NonManifoldFaceCommand command )
inlineexplicit

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.

Note
This is a costly operation.
Template Parameters
NonManifoldFaceCommandCommand executed when non-manifold faces are found. API and default implementation:
struct DefaultNonManifoldFaceCommand {
DefaultNonManifoldFaceCommand( const std::string& details = {} ) : m_details { details } {}
inline void initialize( const TriangleMesh& /*triMesh*/ ) {}
inline void process( const std::vector<TopologicalMesh::VertexHandle>& /*face_vhandles*/ ) {
LOG( logWARNING ) << "Invalid face handle returned : face not added " + m_details;
}
inline void postProcess( TopologicalMesh& /*tm*/ ) {}

Definition at line 394 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ TopologicalMesh() [2/3]

Ra::Core::Geometry::deprecated::TopologicalMesh::TopologicalMesh ( const Ra::Core::Geometry::TriangleMesh & triMesh)
explicit

◆ TopologicalMesh() [3/3]

Ra::Core::Geometry::deprecated::TopologicalMesh::TopologicalMesh ( )
explicit

Construct an empty topological mesh, only init mandatory properties.

Definition at line 79 of file TopologicalMesh.cpp.

Member Function Documentation

◆ clearAllProps()

void Ra::Core::Geometry::deprecated::TopologicalMesh::clearAllProps ( OpenMesh::FPropHandleT< Normal > & normalProp,
std::vector< OpenMesh::FPropHandleT< Scalar > > & floatProps,
std::vector< OpenMesh::FPropHandleT< Vector2 > > & vec2Props,
std::vector< OpenMesh::FPropHandleT< Vector3 > > & vec3Props,
std::vector< OpenMesh::FPropHandleT< Vector4 > > & vec4Props )
inline

Remove all the given properties from mesh.

Note
Invalidates normalProp and clears the given property containers.

Definition at line 759 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ clearProp()

void Ra::Core::Geometry::deprecated::TopologicalMesh::clearProp ( OpenMesh::FPropHandleT< Normal > & fProp)
inline

Remove face property prop from mesh.

Note
Invalidates the property handle.

Definition at line 606 of file TopologicalMesh.hpp.

◆ clearProps()

template<typename T >
void Ra::Core::Geometry::deprecated::TopologicalMesh::clearProps ( std::vector< OpenMesh::FPropHandleT< T > > & props)

Remove props from mesh.

Note
Clears props.

Definition at line 674 of file TopologicalMesh.hpp.

◆ copyAllProps()

void Ra::Core::Geometry::deprecated::TopologicalMesh::copyAllProps ( HalfedgeHandle input_heh,
HalfedgeHandle copy_heh )
inline

Copy all properties from input_heh to copy_heh.

Definition at line 771 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ copyAllPropsFromFace()

void Ra::Core::Geometry::deprecated::TopologicalMesh::copyAllPropsFromFace ( FaceHandle fh,
HalfedgeHandle heh,
OpenMesh::FPropHandleT< Normal > normalProp,
std::vector< OpenMesh::FPropHandleT< Scalar > > & floatProps,
std::vector< OpenMesh::FPropHandleT< Vector2 > > & vec2Props,
std::vector< OpenMesh::FPropHandleT< Vector3 > > & vec3Props,
std::vector< OpenMesh::FPropHandleT< Vector4 > > & vec4Props )
inline

Copy all given face properties from fh to heh.

Note
Each property must have been previously created either all at once through createAllPropsOnFaces(), or individually through createNormalPropOnFaces() and createPropsOnFaces().

Definition at line 780 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ copyNormal()

void Ra::Core::Geometry::deprecated::TopologicalMesh::copyNormal ( HalfedgeHandle input_heh,
HalfedgeHandle copy_heh )
inline

Copy the normal property from input_heh to copy_heh.

Definition at line 610 of file TopologicalMesh.hpp.

◆ copyNormalFromFace()

void Ra::Core::Geometry::deprecated::TopologicalMesh::copyNormalFromFace ( FaceHandle fh,
HalfedgeHandle heh,
OpenMesh::FPropHandleT< Normal > fProp )
inline

Copy the face normal property fProp from fh to heh.

Note
fProp must have been previously created through createNormalPropOnFaces().

Definition at line 619 of file TopologicalMesh.hpp.

◆ copyProps()

template<typename T >
void Ra::Core::Geometry::deprecated::TopologicalMesh::copyProps ( HalfedgeHandle input_heh,
HalfedgeHandle copy_heh,
const std::vector< OpenMesh::HPropHandleT< T > > & props )

Copy props properties from input_heh to copy_heh.

Definition at line 682 of file TopologicalMesh.hpp.

◆ copyPropsFromFace()

template<typename T >
void Ra::Core::Geometry::deprecated::TopologicalMesh::copyPropsFromFace ( FaceHandle fh,
HalfedgeHandle heh,
const std::vector< OpenMesh::FPropHandleT< T > > & fProps,
const std::vector< OpenMesh::HPropHandleT< T > > & hProps )

Copy face properties props from fh to heh.

Note
fProps must have been previously created through createPropsOnFaces().

Definition at line 691 of file TopologicalMesh.hpp.

◆ createAllPropsOnFaces()

void Ra::Core::Geometry::deprecated::TopologicalMesh::createAllPropsOnFaces ( OpenMesh::FPropHandleT< Normal > & normalProp,
std::vector< OpenMesh::FPropHandleT< Scalar > > & floatProps,
std::vector< OpenMesh::FPropHandleT< Vector2 > > & vec2Props,
std::vector< OpenMesh::FPropHandleT< Vector3 > > & vec3Props,
std::vector< OpenMesh::FPropHandleT< Vector4 > > & vec4Props )
inline

Create a new property for each property of mesh on faces. Outputs the new face properties handles in the corresponding output parameters.

Note
These new properties will have to be propagated onto the newly created halfedges with copyAllProps().

Definition at line 746 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ createNormalPropOnFaces()

void Ra::Core::Geometry::deprecated::TopologicalMesh::createNormalPropOnFaces ( OpenMesh::FPropHandleT< Normal > & fProp)
inline

Create a new property for normals on faces of mesh.

Note
This new property will have to be propagated onto the newly created halfedges with copyNormal().

Definition at line 597 of file TopologicalMesh.hpp.

◆ createPropsOnFaces()

template<typename T >
void Ra::Core::Geometry::deprecated::TopologicalMesh::createPropsOnFaces ( const std::vector< OpenMesh::HPropHandleT< T > > & input,
std::vector< OpenMesh::FPropHandleT< T > > & output )

Create a new property for each input properties of mesh on faces.

Note
This new property will have to be propagated onto the newly created halfedges with copyProps().

Definition at line 663 of file TopologicalMesh.hpp.

◆ getFloatPropsHandles()

const std::vector< OpenMesh::HPropHandleT< Scalar > > & Ra::Core::Geometry::deprecated::TopologicalMesh::getFloatPropsHandles ( ) const
inline

Definition at line 578 of file TopologicalMesh.hpp.

◆ getInputTriangleMeshIndexPropHandle()

const OpenMesh::HPropHandleT< TopologicalMesh::Index > & Ra::Core::Geometry::deprecated::TopologicalMesh::getInputTriangleMeshIndexPropHandle ( ) const
inline

Return a handle to the halfedge property storing vertices indices within the TriangleMesh *this has been built on.

Definition at line 568 of file TopologicalMesh.hpp.

◆ getOutputTriangleMeshIndexPropHandle()

const OpenMesh::HPropHandleT< TopologicalMesh::Index > & Ra::Core::Geometry::deprecated::TopologicalMesh::getOutputTriangleMeshIndexPropHandle ( ) const
inline

Return a handle to the halfedge property storing vertices indices within the TriangleMesh returned by toTriangleMesh().

Note
This property is valid only after toTriangleMesh() has been called.

Definition at line 573 of file TopologicalMesh.hpp.

◆ getVector2PropsHandles()

const std::vector< OpenMesh::HPropHandleT< Vector2 > > & Ra::Core::Geometry::deprecated::TopologicalMesh::getVector2PropsHandles ( ) const
inline

Definition at line 583 of file TopologicalMesh.hpp.

◆ getVector3PropsHandles()

const std::vector< OpenMesh::HPropHandleT< Vector3 > > & Ra::Core::Geometry::deprecated::TopologicalMesh::getVector3PropsHandles ( ) const
inline

Definition at line 588 of file TopologicalMesh.hpp.

◆ getVector4PropsHandles()

const std::vector< OpenMesh::HPropHandleT< Vector4 > > & Ra::Core::Geometry::deprecated::TopologicalMesh::getVector4PropsHandles ( ) const
inline

Definition at line 593 of file TopologicalMesh.hpp.

◆ halfedge_handle()

TopologicalMesh::HalfedgeHandle Ra::Core::Geometry::deprecated::TopologicalMesh::halfedge_handle ( VertexHandle vh,
FaceHandle fh ) const
inline

Return the half-edge associated with a given vertex and face.

Note
Asserts if vh is not a member of fh.

Definition at line 558 of file TopologicalMesh.hpp.

◆ interpolateAllProps()

void Ra::Core::Geometry::deprecated::TopologicalMesh::interpolateAllProps ( HalfedgeHandle in_a,
HalfedgeHandle in_b,
HalfedgeHandle out,
Scalar f )
inline

Interpolate all properties on edge center (after edge split).

Definition at line 794 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ interpolateAllPropsOnFaces()

void Ra::Core::Geometry::deprecated::TopologicalMesh::interpolateAllPropsOnFaces ( FaceHandle fh,
OpenMesh::FPropHandleT< Normal > normalProp,
std::vector< OpenMesh::FPropHandleT< Scalar > > & floatProps,
std::vector< OpenMesh::FPropHandleT< Vector2 > > & vec2Props,
std::vector< OpenMesh::FPropHandleT< Vector3 > > & vec3Props,
std::vector< OpenMesh::FPropHandleT< Vector4 > > & vec4Props )
inline

Interpolate hprops on face center.

Note
Each property must have been previously created either all at once through createAllPropsOnFaces(), or individually through createNormalPropOnFaces() and createPropsOnFaces().

Definition at line 805 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ interpolateNormal()

void Ra::Core::Geometry::deprecated::TopologicalMesh::interpolateNormal ( HalfedgeHandle in_a,
HalfedgeHandle in_b,
HalfedgeHandle out,
Scalar f )
inline

Interpolate normal property on edge center (after edge split).

Definition at line 630 of file TopologicalMesh.hpp.

◆ interpolateNormalOnFaces()

void Ra::Core::Geometry::deprecated::TopologicalMesh::interpolateNormalOnFaces ( FaceHandle fh,
OpenMesh::FPropHandleT< Normal > fProp )
inline

Interpolate normal property on face center.

Note
fProp must have been previously created through createNormalPropOnFaces().

Definition at line 639 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ interpolateProps()

template<typename T >
void Ra::Core::Geometry::deprecated::TopologicalMesh::interpolateProps ( HalfedgeHandle in_a,
HalfedgeHandle in_b,
HalfedgeHandle out,
Scalar f,
const std::vector< OpenMesh::HPropHandleT< T > > & props )

Interpolate props on edge center (after edge split).

Definition at line 703 of file TopologicalMesh.hpp.

◆ interpolatePropsOnFaces()

template<typename T >
void Ra::Core::Geometry::deprecated::TopologicalMesh::interpolatePropsOnFaces ( FaceHandle fh,
const std::vector< OpenMesh::HPropHandleT< T > > & hProps,
const std::vector< OpenMesh::FPropHandleT< T > > & fProps )

Interpolate hprops on face center.

Note
fProps must have been previously created through createPropsOnFaces().

Definition at line 715 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ normal()

const TopologicalMesh::Normal & Ra::Core::Geometry::deprecated::TopologicalMesh::normal ( VertexHandle vh,
FaceHandle fh ) const
inline

Get normal of the vertex vh, when member of fh.

Note
Asserts if vh is not a member of fh.

Definition at line 528 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ propagate_normal_to_halfedges()

void Ra::Core::Geometry::deprecated::TopologicalMesh::propagate_normal_to_halfedges ( VertexHandle vh)
inline

Set the normal n to all the halfedges that points to vh (i.e. incomming halfedges) . If you work with vertex normals, please call this function on all vertex handles before convertion with toTriangleMesh.

Definition at line 548 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ set_normal()

void Ra::Core::Geometry::deprecated::TopologicalMesh::set_normal ( VertexHandle vh,
FaceHandle fh,
const Normal & n )
inline

Set normal of the vertex vh, when member of fh.

Note
Asserts if vh is not a member of fh.

Definition at line 539 of file TopologicalMesh.hpp.

+ Here is the call graph for this function:

◆ splitEdge()

bool Ra::Core::Geometry::deprecated::TopologicalMesh::splitEdge ( TopologicalMesh::EdgeHandle eh,
Scalar f )

Apply a 2-4 edge split.

Parameters
ehThe handle to the edge to split.
fThe interpolation factor to place the new point on the edge. Must be in [0,1].
Returns
True if the edge has been split, false otherwise.
Note
Only applies on edges between 2 triangles, and if f is in [0,1].
Mesh attributes are linearly interpolated on the newly created halfedge.
f=0 correspond to halfedge_handle( eh, 0 ) (i.e. first vertex of the edge)

Definition at line 195 of file TopologicalMesh.cpp.

+ Here is the call graph for this function:

◆ toTriangleMesh()

TriangleMesh Ra::Core::Geometry::deprecated::TopologicalMesh::toTriangleMesh ( )

Return a triangleMesh from the topological mesh.

Note
This is a costly operation.

Definition at line 83 of file TopologicalMesh.cpp.

+ Here is the call graph for this function:

◆ updateTriangleMesh()

void Ra::Core::Geometry::deprecated::TopologicalMesh::updateTriangleMesh ( Ra::Core::Geometry::TriangleMesh & mesh)

Update triangle mesh data, assuming the mesh and this topo mesh has the same topology.

Warning
note implemented yet.

Friends And Related Symbol Documentation

◆ TMOperations

friend class TMOperations
friend

Definition at line 390 of file TopologicalMesh.hpp.


The documentation for this class was generated from the following files: