$darkmode
VCG Library
Classes | Functions
vcg::face Namespace Reference

Classes

class  EmptyCore
 
class  VertexRef
 The references to the vertexes of a triangular face. More...
 
class  NormalAbs
 
class  WedgeNormal
 
class  WedgeRealNormal
 
class  WedgeRealNormal3s
 
class  WedgeRealNormal3f
 
class  WedgeRealNormal3d
 
class  Normal3s
 
class  Normal3f
 
class  Normal3d
 
class  WedgeTexCoord
 
class  WedgeTexCoord2s
 
class  WedgeTexCoord2f
 
class  WedgeTexCoord2d
 
class  BitFlags
 Component: Per face Flags More...
 
class  Color
 
class  WedgeColor
 
class  WedgeColor4b
 
class  WedgeColor4f
 
class  Color4b
 
class  Quality
 
class  Qualitys
 
class  Qualityf
 
class  Qualityd
 
class  Quality3
 
class  Quality3s
 
class  Quality3f
 
class  Quality3d
 
class  Mark
 Per vertex Incremental Mark. More...
 
struct  CurvatureDirBaseType
 
class  CurvatureDir
 
class  CurvatureDirf
 
class  CurvatureDird
 
class  VFAdj
 Component: Per Face Vertex-Face adjacency relation More...
 
class  EFAdj
 
class  FFAdj
 Component: Per Face Face-Face adjacency relation More...
 
class  FEAdj
 
class  FHAdj
 

Functions

template<class FaceType >
bool IsManifold (FaceType const &f, const int j)
 
template<class FaceType >
bool IsBorder (FaceType const &f, const int j)
 
template<class FaceType >
FaceType::ScalarType DihedralAngleRad (FaceType &f, const int i)
 Compute the signed dihedral angle between the normals of two adjacent faces. More...
 
template<class FaceType >
FaceType::ScalarType WedgeAngleRad (FaceType &f, const int i)
 Return the internal angle (in radians) of the i-th wedge of the triangle.
 
template<class FaceType >
int BorderCount (FaceType const &f)
 Count border edges of the face.
 
template<class FaceType >
int ComplexSize (FaceType &f, const int e)
 Counts the number of incident faces in a complex edge.
 
template<class FaceType >
bool FFCorrectness (FaceType &f, const int e)
 
template<class FaceType >
void FFDetachManifold (FaceType &f, const int e)
 
template<class FaceType >
void FFDetach (FaceType &f, const int e)
 
template<class FaceType >
void FFAttach (FaceType &f, int z1, FaceType &f2, int z2)
 
template<class FaceType >
void FFAttachManifold (FaceType *f1, int z1, FaceType *f2, int z2)
 
template<class FaceType >
void FFSetBorder (FaceType *f1, int z1)
 
template<class FaceType >
void AssertAdj (FaceType &f)
 
template<class FaceType >
bool CheckOrientation (FaceType &f, int z)
 
template<class FaceType >
void SwapEdge (FaceType &f, const int z)
 
template<class FaceType , bool UpdateTopology>
void SwapEdge (FaceType &f, const int z)
 
template<class FaceType >
bool FFLinkCondition (FaceType &f, const int z)
 
template<class MeshType >
void FFEdgeCollapse (MeshType &m, typename MeshType::FaceType &f, const int z)
 a simple edge collapse using only FF adjacency More...
 
template<class FaceType >
bool CheckFlipEdgeNormal (FaceType &f, const int z, const float angleRad)
 
template<class FaceType >
bool CheckFlipEdge (FaceType &f, int z)
 
template<class FaceType >
bool checkFlipEdgeNotManifold (FaceType &f, const int z)
 
template<class FaceType >
void FlipEdge (FaceType &f, const int z)
 
template<class FaceType >
void FlipEdgeNotManifold (FaceType &f, const int z)
 
template<class FaceType >
void TriSplit (FaceType *fToSplit, FaceType *newf0, FaceType *newf1, typename FaceType::VertexType *newVert)
 
template<class FaceType >
void VFDetach (FaceType &f)
 
template<class FaceType >
void VFDetach (FaceType &f, int z)
 
template<class FaceType >
void VFAppend (FaceType *f, int z)
 Append a face in VF list of vertex f->V(z)
 
template<class FaceType >
void VVStarVF (typename FaceType::VertexType *vp, std::vector< typename FaceType::VertexType * > &starVec)
 Compute the set of vertices adjacent to a given vertex using VF adjacency. More...
 
template<class FaceType >
void VVExtendedStarVF (typename FaceType::VertexType *vp, const int num_step, std::vector< typename FaceType::VertexType * > &vertVec)
 Compute the set of vertices adjacent to a given vertex using VF adjacency. More...
 
template<class FaceType >
void VFStarVF (typename FaceType::VertexType *vp, std::vector< FaceType * > &faceVec, std::vector< int > &indexes)
 Compute the set of faces adjacent to a given vertex using VF adjacency. More...
 
template<class FaceType >
void EFStarFF (FaceType *fp, int ei, std::vector< FaceType * > &faceVec, std::vector< int > &indVed)
 Compute the set of faces incident onto a given edge using FF adjacency. More...
 
template<class FaceType >
void VFExtendedStarVF (typename FaceType::VertexType *vp, const int num_step, std::vector< FaceType * > &faceVec)
 Compute the set of faces adjacent to a given vertex using VF adjacency. More...
 
template<class FaceType >
void VVOrderedStarFF (const Pos< FaceType > &startPos, std::vector< typename FaceType::VertexType * > &vertexVec)
 Compute the ordered set of vertices adjacent to a given vertex using FF adjacency. More...
 
template<class FaceType >
void VVOrderedStarFF (const Pos< FaceType > &startPos, std::vector< typename FaceType::VertexType * > &vertexVec, const bool ccw)
 Compute the ordered set of vertices adjacent to a given vertex using FF adjacency. More...
 
template<class FaceType >
void VFOrderedStarFF (const Pos< FaceType > &startPos, std::vector< Pos< FaceType > > &posVec)
 Compute the ordered set of faces adjacent to a given vertex using FF adjacency. More...
 
template<class FaceType >
void VFOrderedStarFF (const Pos< FaceType > &startPos, std::vector< Pos< FaceType > > &posVec, const bool ccw)
 Compute the ordered set of faces adjacent to a given vertex using FF adjacency. More...
 
template<class FaceType >
void VFOrderedStarFF (const Pos< FaceType > &startPos, std::vector< FaceType * > &faceVec, std::vector< int > &edgeVec)
 Compute the ordered set of faces adjacent to a given vertex using FF adjacency. More...
 
template<class FaceType >
bool ShareEdgeFF (FaceType *f0, FaceType *f1, int *i0=0, int *i1=0)
 
template<class FaceType >
int CountSharedVertex (FaceType *f0, FaceType *f1)
 
template<class FaceType >
bool FindSharedVertex (FaceType *f0, FaceType *f1, int &i, int &j)
 
template<class FaceType >
bool FindSharedEdge (FaceType *f0, FaceType *f1, int &i, int &j)
 
template<class FaceType >
bool FindSharedFaces (typename FaceType::VertexType *v0, typename FaceType::VertexType *v1, FaceType *&f0, FaceType *&f1, int &e0, int &e1)
 

Detailed Description

Global algorithms and classes working on generic faces are defined in this namespace. Typical example are the topological surgery functions (like vcg::face::Detach and vcg::face::IsBorder) and the class vcg::face::Pos for defining positions over a mesh. Note that for sake of brevity the main face class is defined outside this namespace.

Function Documentation

◆ CheckFlipEdge()

template<class FaceType >
bool vcg::face::CheckFlipEdge ( FaceType &  f,
int  z 
)

Perform a Topological check to see if the z-th edge of the face f can be flipped. No Geometric test are done. (see CheckFlipEdgeNormal)

Parameters
fpointer to the face
zthe edge index

◆ CheckFlipEdgeNormal()

template<class FaceType >
bool vcg::face::CheckFlipEdgeNormal ( FaceType &  f,
const int  z,
const float  angleRad 
)

Perform a Geometric Check about the normals of a edge flip. return trues if after the flip the normals does not change more than the given threshold angle; it assumes that the flip is topologically correct.

Parameters
fthe face
zthe edge index
angleRadthe threshold angle

oldD1 ___________ newD1 |\ | | \ | | \ | | f z\ | | \ | |__________| newD0 oldD0

◆ CheckOrientation()

template<class FaceType >
bool vcg::face::CheckOrientation ( FaceType &  f,
int  z 
)

Check if the given face is oriented as the one adjacent to the specified edge.

Parameters
fFace to check the orientation
zIndex of the edge

◆ CountSharedVertex()

template<class FaceType >
int vcg::face::CountSharedVertex ( FaceType *  f0,
FaceType *  f1 
)

Count the number of vertices shared between two faces.

Parameters
f0,f1the two face to be checked ;

◆ DihedralAngleRad()

template<class FaceType >
FaceType::ScalarType vcg::face::DihedralAngleRad ( FaceType &  f,
const int  i 
)
inline

Compute the signed dihedral angle between the normals of two adjacent faces.

The angle between the normal is signed according to the concavity/convexity of the dihedral angle: negative if the edge shared between the two faces is concave, positive otherwise. The surface must be oriented and faces must be oriented coherently. It simply use the projection of the opposite vertex onto the plane of the other one. It does not use stored face normals but it recomputes according the vertex ordering.

v0 ___________ vf1 |\ | | \i1 f1 | | \ | |f0 i0\ | | \ | |__________| vf0 v1

◆ EFStarFF()

template<class FaceType >
void vcg::face::EFStarFF ( FaceType *  fp,
int  ei,
std::vector< FaceType * > &  faceVec,
std::vector< int > &  indVed 
)

Compute the set of faces incident onto a given edge using FF adjacency.

Parameters
fppointer to the face whose star has to be computed
eithe index of the edge
faceVeca std::vector of Face pointer that is filled with the faces incident on that edge.
indexesa std::vector of integer of the edge position as it is seen from the faces

◆ FFAttach()

template<class FaceType >
void vcg::face::FFAttach ( FaceType &  f,
int  z1,
FaceType &  f2,
int  z2 
)

This function attach the face (via the edge z1) to another face (via the edge z2). It's possible to use it also in non-two manifold situation. The function cannot be applied if the adjacencies among faces aren't defined.

Parameters
fPointer to the face
z1Index of the edge
f2Pointer to the face
z2The edge of the face f2

◆ FFAttachManifold()

template<class FaceType >
void vcg::face::FFAttachManifold ( FaceType *  f1,
int  z1,
FaceType *  f2,
int  z2 
)

This function attach the face (via the edge z1) to another face (via the edge z2). It is not possible to use it also in non-two manifold situation. The function cannot be applied if the adjacencies among faces aren't defined.

Parameters
z1Index of the edge
f2Pointer to the face
z2The edge of the face f2

◆ FFCorrectness()

template<class FaceType >
bool vcg::face::FFCorrectness ( FaceType &  f,
const int  e 
)

This function check the FF topology correctness for an edge of a face. It's possible to use it also in non-two manifold situation. The function cannot be applied if the adjacencies among faces aren't defined.

Parameters
fthe face to be checked
eIndex of the edge to be checked

◆ FFDetach()

template<class FaceType >
void vcg::face::FFDetach ( FaceType &  f,
const int  e 
)

This function detach the face from the adjacent face via the edge e. It's possible to use it also in non-two manifold situation. The function cannot be applied if the adjacencies among faces aren't defined.

Parameters
fthe face to be detached
eIndex of the edge to be detached

◆ FFDetachManifold()

template<class FaceType >
void vcg::face::FFDetachManifold ( FaceType &  f,
const int  e 
)

This function detach the face from the adjacent face along the edge e. It's possible to use this function it ONLY in non-two manifold situation. The function cannot be applied if the adjacencies among faces aren't defined.

Parameters
fthe face to be detached
eIndex of the edge to be detached
Note
it updates border flag and faux flags (the detached edge has it border bit flagged and faux bit cleared)

◆ FFEdgeCollapse()

template<class MeshType >
void vcg::face::FFEdgeCollapse ( MeshType &  m,
typename MeshType::FaceType &  f,
const int  z 
)

a simple edge collapse using only FF adjacency

The edge z is collapsed and the vertex V(z) is collapsed onto the vertex V1(Z) vertex V(z) is deleted and vertex V1(z) survives. It assumes that the mesh is Manifold. Note that it preserves manifoldness only if FFLinkConditions are satisfied If the mesh is not manifold it will crash (there will be faces with deleted vertexes around) f12 surV ___________ |\ | | \ f1 | f01 | \ z1 | f11 | f0 z0\ | | \ | |__________| f02 delV

◆ FFLinkCondition()

template<class FaceType >
bool vcg::face::FFLinkCondition ( FaceType &  f,
const int  z 
)

Perform a simple edge collapse Basic link conditions to check if the collapse is topologically safe this version uses only FF adjacency and assume that the mesh is manifold

◆ FindSharedEdge()

template<class FaceType >
bool vcg::face::FindSharedEdge ( FaceType *  f0,
FaceType *  f1,
int &  i,
int &  j 
)

find the first shared edge between two faces.

Parameters
f0,f1the two face to be checked
i,jthe indexes of the shared edge in the two faces. Meaningful only if there is a shared edge

◆ FindSharedFaces()

template<class FaceType >
bool vcg::face::FindSharedFaces ( typename FaceType::VertexType *  v0,
typename FaceType::VertexType *  v1,
FaceType *&  f0,
FaceType *&  f1,
int &  e0,
int &  e1 
)

find the faces that shares the two vertices

Parameters
v0,v1the two vertices
f0,f1the two faces in counterclockwise order

then find the intersection

◆ FindSharedVertex()

template<class FaceType >
bool vcg::face::FindSharedVertex ( FaceType *  f0,
FaceType *  f1,
int &  i,
int &  j 
)

Find the first shared vertex between two faces.

Parameters
f0,f1the two face to be checked
i,jthe indexes of the shared vertex in the two faces. Meaningful only if there is one single shared vertex ;

◆ FlipEdge()

template<class FaceType >
void vcg::face::FlipEdge ( FaceType &  f,
const int  z 
)

Flip the z-th edge of the face f. Check for topological correctness first using CheckFlipEdge().

Parameters
fpointer to the face
zthe edge index

Note: For edge flip we intend the swap of the diagonal of the quadrilater formed by the face f and the face adjacent to the specified edge.

0__________ 2 0__________2 -> 1|\ | | /|1 | \ g | | g / | | \ | |w / | | f z\w | | / f z| | \ | | / | |__________|1 <- 1|/__________| 2 0 2 0

Note that, after an operation FlipEdge(f,z) to topologically revert it should be sufficient to do FlipEdge(f,z+1) (even if the mesh is actually different: f and g will be swapped)

◆ FlipEdgeNotManifold()

template<class FaceType >
void vcg::face::FlipEdgeNotManifold ( FaceType &  f,
const int  z 
)

Flip the z-th edge of the face f. Check for topological correctness first using CheckFlipEdge().

Parameters
fpointer to the face
zthe edge index

Note: For edge flip we intend the swap of the diagonal of the quadrilater formed by the face f and the face adjacent to the specified edge.

0__________ 2 0__________2 -> 1|\ | | /|1 | \ g | | g / | | \ | |w / | | f z\w | | / f z| | \ | | / | |__________|1 <- 1|/__________| 2 0 2 0

Note that, after an operation FlipEdge(f,z) to topologically revert it should be sufficient to do FlipEdge(f,z+1) (even if the mesh is actually different: f and g will be swapped)

◆ IsBorder()

template<class FaceType >
bool vcg::face::IsBorder ( FaceType const &  f,
const int  j 
)
inline

Return a boolean that indicate if the j-th edge of the face is a border.

Parameters
jIndex of the edge
Returns
true if j is an edge of border, false otherwise

◆ IsManifold()

template<class FaceType >
bool vcg::face::IsManifold ( FaceType const &  f,
const int  j 
)
inline

Return a boolean indicating if the face f is non manifold along edge j.

Parameters
jIndex of the edge
Returns
true if the face manifold, false otherwise

◆ ShareEdgeFF()

template<class FaceType >
bool vcg::face::ShareEdgeFF ( FaceType *  f0,
FaceType *  f1,
int *  i0 = 0,
int *  i1 = 0 
)

Check if two faces share and edge through the FF topology.

Parameters
f0,f1the two face to be checked
i0,i1the index of the shared edge;

◆ SwapEdge()

template<class FaceType >
void vcg::face::SwapEdge ( FaceType &  f,
const int  z 
)

This function change the clockwise/counterclockwise orientation of the face by swapping the indexes of two vertex of the indicated edge.

Parameters
zIndex of the edge

◆ TriSplit()

template<class FaceType >
void vcg::face::TriSplit ( FaceType *  fToSplit,
FaceType *  newf0,
FaceType *  newf1,
typename FaceType::VertexType *  newVert 
)

Given a face it splits into three face with a mid vertex No allocation is done here, a new vertex and two new faces are needed

◆ VFDetach() [1/2]

template<class FaceType >
void vcg::face::VFDetach ( FaceType &  f)

Detach the face f from the all the VF adjacency lists of its vertices. It is used by edge collapse before deleting the collapsed faces.

Parameters
fface to be detached

◆ VFDetach() [2/2]

template<class FaceType >
void vcg::face::VFDetach ( FaceType &  f,
int  z 
)

Detach the face f from the VF adjacency list of the faces incident on the z-th vertex.

Parameters
fface to be detached
zthe vertex index

◆ VFExtendedStarVF()

template<class FaceType >
void vcg::face::VFExtendedStarVF ( typename FaceType::VertexType *  vp,
const int  num_step,
std::vector< FaceType * > &  faceVec 
)

Compute the set of faces adjacent to a given vertex using VF adjacency.

The set is faces is extended of a given number of step

Parameters
vppointer to the vertex whose star has to be computed.
num_stepthe number of step to extend the star
faceVeca std::vector of Face pointer that is filled with the adjacent faces.

initialize front

then dilate front for each step

◆ VFOrderedStarFF() [1/3]

template<class FaceType >
void vcg::face::VFOrderedStarFF ( const Pos< FaceType > &  startPos,
std::vector< FaceType * > &  faceVec,
std::vector< int > &  edgeVec 
)

Compute the ordered set of faces adjacent to a given vertex using FF adjacency.

Parameters
startPosa Pos<FaceType> indicating the vertex whose star has to be computed.
faceVeca std::vector of Face pointer that is filled with the adjacent faces.
edgeVeca std::vector of indexes filled with the indexes of the corresponding edges shared between the faces.

◆ VFOrderedStarFF() [2/3]

template<class FaceType >
void vcg::face::VFOrderedStarFF ( const Pos< FaceType > &  startPos,
std::vector< Pos< FaceType > > &  posVec 
)

Compute the ordered set of faces adjacent to a given vertex using FF adjacency.

Parameters
startPosa Pos<FaceType> indicating the vertex whose star has to be computed.
posVeca std::vector of Pos filled with Pos arranged around the passed vertex.

◆ VFOrderedStarFF() [3/3]

template<class FaceType >
void vcg::face::VFOrderedStarFF ( const Pos< FaceType > &  startPos,
std::vector< Pos< FaceType > > &  posVec,
const bool  ccw 
)

Compute the ordered set of faces adjacent to a given vertex using FF adjacency.

Parameters
startPosa Pos<FaceType> indicating the vertex whose star has to be computed.
posVeca std::vector of Pos filled with Pos arranged around the passed vertex.
ccwif true returns the posVec in counterclockwise order; if false in clockwise order.

◆ VFStarVF()

template<class FaceType >
void vcg::face::VFStarVF ( typename FaceType::VertexType *  vp,
std::vector< FaceType * > &  faceVec,
std::vector< int > &  indexes 
)

Compute the set of faces adjacent to a given vertex using VF adjacency.

Parameters
vppointer to the vertex whose star has to be computed.
faceVeca std::vector of Face pointer that is filled with the adjacent faces.
indexesa std::vector of integer of the vertex as it is seen from the faces

◆ VVExtendedStarVF()

template<class FaceType >
void vcg::face::VVExtendedStarVF ( typename FaceType::VertexType *  vp,
const int  num_step,
std::vector< typename FaceType::VertexType * > &  vertVec 
)

Compute the set of vertices adjacent to a given vertex using VF adjacency.

The set is faces is extended of a given number of step

Parameters
vppointer to the vertex whose star has to be computed.
num_stepthe number of step to extend the star
vertVeca std::vector of Ve pointer that is filled with the adjacent faces.

initialize front

then dilate front for each step

◆ VVOrderedStarFF() [1/2]

template<class FaceType >
void vcg::face::VVOrderedStarFF ( const Pos< FaceType > &  startPos,
std::vector< typename FaceType::VertexType * > &  vertexVec 
)

Compute the ordered set of vertices adjacent to a given vertex using FF adjacency.

Parameters
startPosa Pos<FaceType> indicating the vertex whose star has to be computed.
vertexVeca std::vector of VertexPtr filled vertices around the given vertex.

◆ VVOrderedStarFF() [2/2]

template<class FaceType >
void vcg::face::VVOrderedStarFF ( const Pos< FaceType > &  startPos,
std::vector< typename FaceType::VertexType * > &  vertexVec,
const bool  ccw 
)

Compute the ordered set of vertices adjacent to a given vertex using FF adjacency.

Parameters
startPosa Pos<FaceType> indicating the vertex whose star has to be computed.
vertexVeca std::vector of VertexPtr filled vertices around the given vertex.
ccwif true returns the vertexVec in counterclockwise order; if false in clockwise order.

◆ VVStarVF()

template<class FaceType >
void vcg::face::VVStarVF ( typename FaceType::VertexType *  vp,
std::vector< typename FaceType::VertexType * > &  starVec 
)

Compute the set of vertices adjacent to a given vertex using VF adjacency.

Parameters
vppointer to the vertex whose star has to be computed.
starVeca std::vector of Vertex pointer that is filled with the adjacent vertices.