Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
CFaceList Class Referenceabstract

CFaceList is the common base class for a lot of different classes (C3DFaceList, CUVWFaceList...) More...

Detailed Description

CFaceList is the common base class for a lot of different classes (C3DFaceList, CUVWFaceList...)

Every faces is an index array (of at least 3 indexes) that refers to another list (usually points or vectors). Faces are gather together in a CFaceList, which is in fact an array of array.

CFaceList offers all methods to get/set the face indexes, to modify these indexes and associates any kind of data to faces
CFaceList includes different relationship graph to find easily who is connected with who. Cf. Working with faces to get advanced details on the way using CFaceList.

Note
As CFaceList inherits from CInstanciatedObject, it can be referenced multiple time. Use CPointList::Delete instead of delete to delete the list.

#include <FaceList.h>

Inheritance diagram for CFaceList:
CInstanciatedObject C3DFaceList CNormalFaceList CUVWFaceList CVCFaceList CWeightFaceList

Public Types

enum  SetSizeMode { DEFAULT = 0 , FREE_EXTRA , GROW_MODE }
 

Public Member Functions

 CFaceList (CFaceList *srcFaces)
 
virtual CFaceCreateFace () const =0
 Get a face object the appropriate derived face type (ie it will return a C3DFace, with C3DFaceList, CNormalFace with CNormalFaceList...). Call CFaceList::ReleaseFace when you do not need it anymore.
 
void ReleaseFace (CFace *face) const
 Release a face created with CFaceList::CreateFace.
 
bool GetFace (unsigned int index, CFace &face) const
 
bool GetFace (unsigned int index, CFace &face)
 
intGetIndexes (unsigned int index, int &size) const
 
int IsFaceIndex (unsigned int faceindex, int pointindex) const
 Check if point index belong to face. Return the index position of this pointindex or POINT_NOT_BELONG_TO_FACE) const;.
 
intSetFaceSize (unsigned int index, int size, FACE_PROPERTIES invalidFlag=FACE_IS_INVALID)
 Set the number of indexes for the given face index. If size < 3, then invalidFlag flag is set, if size >= 3 the flag is removed. For channel flags, FACE_IS_UNUSED should be used to keep the same number of faces between 3d faces and channel faces, if the matching 3d face is not set to invalid on a clean operation.
 
unsigned int GetFaceFlags (unsigned int index) const
 
bool IsFaceFlagSet (unsigned int index, FACE_PROPERTIES flag) const
 
bool CheckFaceFlags (unsigned int index, unsigned int flags, bool allSetOrNoneSet) const
 
bool IsFaceOneFlagSet (unsigned int index, unsigned int flags) const
 
void SetFaceFlag (unsigned int index, FACE_PROPERTIES flag, bool set)
 
void SetFaceFlags (unsigned int index, unsigned int flags, bool set)
 
int CollectIndexes (unsigned int index, CHashTable< int > &hash, bool erase=false) const
 Add the face indexes to the hash, and return the adedd count.
 
bool CopyFace (unsigned int dstindex, unsigned int srcindex, bool inheritPropertiesOnly=false)
 Copy srcindex face to dstindex face. inheritPropertiesOnly = true means only flags and properties are copied, otherwise indexes are also copied.
 
bool CopyFace (unsigned int dstindex, unsigned int srcindex, const CFaceList &srcfacelist, bool inheritPropertiesOnly=false)
 Copy a face from another face list.
 
bool CopyFace (unsigned int dstindex, const CFace &srcface, bool inheritPropertiesOnly=false)
 
void CopyTo (int index, CSingleFace &face) const
 
void CopyFrom (int index, const CSingleFace &face)
 
virtual void Serialize (CXArchive &ar)
 
void RemoveAll ()
 
void PreAllocate (int estimatedFaceNbr, int estimatedIndexNbr, bool constructAllElementsOnce=false)
 Preallocate the data with an estimated face nbr and total indexes count for the whole face set. The method removes any existing data.
 
void SetSize (int size, SetSizeMode sizeMode, int defaultFaceSize=FACELIST_DEFAULT_INDEX_NBR)
 Resize the size of the number of face. If growOnly, memory is not reallocated if buffer's size decrease.
 
void SetSize (int size, int defaultFaceSize=FACELIST_DEFAULT_INDEX_NBR, SetSizeMode sizeMode=DEFAULT, int growFaceMode=-1)
 Resize the size of the number of face. If growOnly, memory is not reallocated if buffer's size decrease.
 
void SetSize (int size, unsigned int *initialSize, int defaultFaceSize=FACELIST_DEFAULT_INDEX_NBR, int growFaceMode=-1)
 This reset the face and initialize it again.
 
void SetSize (const CFaceList &srcfaces, int growFaceMode=-1)
 Reset face list and get faces size from srcfaces face list. No data is copied, only size are preallocated.
 
void ExpandSize (const CFaceList &srcfaces)
 Expand the face list with srcfaces sizes. No data is copied, only size are preallocated. The method grows the faces (if needed), so CFaceList::PreAllocate can be used.
 
void FreeExtra ()
 
bool RemoveDataChunk (DataChunkID id)
 Remove the data chunk specified by its id.
 
unsigned int AddDataChunk (DataChunkID id, CElementMethods *methods)
 Add a data chunk defined by an id and methods which give the way to construct / destroy the data chunk data.
 
voidGetDataChunk (DataChunkID id, unsigned int index) const
 Return the data chunk for index face. The returned data can be cast accordingly giving the data chunk id.
 
CFacePropertyDataGetMainDataChunk (unsigned int index) const
 return the main data chunk for index. The main data chunk is a chunk like another one, but with faster access. It contains the flags, and it can be cast to C3DFacePropertyData, as it also contain the material
 
void AppendDataChunks (CFaceList *srcFaces, bool copyEmpty=true)
 Copy the data chunks that exists in the provided srcFaces list. If copyEmpty = true, the data chunk are created empty. Otherwise they are copied from the source face list.
 
unsigned int GetDataChunkNbr () const
 Return the number of data chunk in the face list.
 
const CDataChunkGetDataChunks () const
 Return the class that handles the data chunks.
 
SIZET GetSizeOfData (DataChunkID id) const
 Return the data size of one element of the given data chunk.
 
int GetSize () const
 Return the number of faces of the list.
 
void SaveFacesIndex (unsigned int dataChunkID=FACE_ORIGINAL_INDEX_CHUNK)
 Save face indexes in a specific FACE_ORIGINAL_INDEX_CHUNK data chunk. Face index can be retrieve after, after a process that delete some faces or reorder them.
 
unsigned int GetOriginalIndex (unsigned int index, unsigned int dataChunkID=FACE_ORIGINAL_INDEX_CHUNK) const
 Retrieve the original index of the face.
 
bool AreFacesConnected (const CGeomInfo *info, CHashTable< int > &facesSet)
 
void GetEdgesOnBorder (CEdgeGraph &borderMap, CHashTable< int > &faces)
 
void FlipFaces (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true)
 Reverse the indexes order. For a 3D face, a side effect is the normal inversion.
 
unsigned int TagFaces (CGeomInfo *info, CFaceTagger &faceTagger, bool exploreByEdge)
 Create group of faces which points/edges are delimited by a given property.
 
bool Clean (const CGeomInfo *info)
 Clean faces with FACE_IS_INVALID status defined.
 
bool Clean (const CGeomInfo *info, bool cleanFaces, CXUIntArray *newfacesindex=NULL)
 Clean faces with FACE_IS_INVALID status defined and get an array contains the new to old index position (useful to clean external data too).
 
bool ReorderFaces (const unsigned int *neworder, unsigned int size, bool moveToDestinationIndexes)
 Reorder faces given the order specified by neworder. If moveToDestinationIndexes is true : Face[0] goes to face[neworder[0]], otherwise Face[neworder[0]] goes to face[0]. -1 in the array means no order changes.
 
bool UpdateIndex (const unsigned int *newpointindex, unsigned int bufsize, bool onlyValidFaces=true)
 
bool UpdateIndex (CXUIntArray *newpointindex, bool onlyValidFaces=true)
 Same method with a CXUIntArray class.
 
void SetSizeAndFlags (int newsize, unsigned int flags)
 Set face size and flags.
 
void SetSizeAndFlags (const CFaceList &faces, unsigned int flags)
 Set faces which size are the same than provided faces list and set flags for these faces.
 
void ExpandSizeAndFlags (const CFaceList &faces, unsigned int flags)
 Increase face size and set flags for the new faces.
 
void SetFlag (FACELIST_PROPERTIES flag, bool set)
 
bool IsFlagSet (FACELIST_PROPERTIES flag) const
 
unsigned int GetChangedStamp () const
 
bool IsTriangular (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) const
 
bool HasQuadrangle (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) const
 
bool HasNGons (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) const
 
unsigned int GetFaceCount (unsigned int edgenbr, FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) const
 
unsigned int GetIndexesCount (FACE_PROPERTIES properties=FACE_NONE, bool musthave=true) const
 
bool InheritFlags (CFaceList &srcList, FACE_PROPERTIES srcflag, FACE_PROPERTIES dstflag, bool accumulate)
 
int GetNumberOfFaces (FACE_PROPERTIES, bool set) const
 
int GetNumberOfFaces (unsigned int property, bool set) const
 
void SetFacesFlags (unsigned int first, unsigned int last, unsigned int flags, bool set)
 
void SetFacesFlags (unsigned int flags, bool set)
 
void SetFacesSize (unsigned int facesize)
 
const C3DEdgeArrayInitEdgeArray ()
 Always return an array (even if empty) containing all edge of the face list, without connection information.
 
void DeleteEdgeArray ()
 A call to DeleteEdgeArray must be balanced for each call to InitEdgeArray.
 
int InitEdgeToFaceGraph (const CGeomInfo *info)
 Init Edge graph which is a map containing each different edge and their connections. Return the number of edges of the graph. Needed for any methods that required information about connections.
 
void DeleteEdgeToFaceGraph ()
 Release the edge graph when no longer needed. Any call to InitEdgeToFaceGraph must be followed by a call to DeleteEdgeToFaceGraph.
 
const intGetFacesConnectedToEdge (const C3DEdge &, int &size)
 Get faces connected to an edge. The returned array has size indexes.
 
CEdgeGraphGetEdgeGraph (void)
 Get the CEdgeGraph.
 
void SetBorderFacesStatus (void)
 
int InitPointToFaceGraph (const CGeomInfo *info)
 
void DeletePointToFaceGraph ()
 Release the point to face graph. Any call to InitPointToFaceGraph must be followed by a call to DeletePointToFaceGraph.
 
bool HasPointToFaceGraph () const
 Return true if the point to face graph is computed.
 
const intGetFacesNeighbourg (CFaceGraphHelper &helper, int faceindex, ConnectionInfoType type, int &size)
 
int GetFacesNeighbourg (CHashTable< int > &hash, int faceindex, ConnectionInfoType type, bool clearhash)
 
const intGetFacesConnectedToPoint (int, int &size) const
 
int GetFacesConnectedToPoints (CHashTable< int > &hash, int point1, int point2, ConnectionInfoType type, bool clearhash) const
 
const intGetFacesConnectedToPoints (CFaceGraphHelper &helper, int point1, int point2, ConnectionInfoType type, int &size) const
 
int GetPointsConnectedToPoints (CHashTable< int > &hash, int point1, int point2, ConnectionInfoType type)
 
const intGetPointsConnectedToPoints (CFaceGraphHelper &helper, int point1, int point2, ConnectionInfoType type, int &size)
 
const intGetPointsConnectedToEdge (CFaceGraphHelper &helper, int point1, int point2, int &size, bool excludePt1AndPt2)
 
const intGetPointsNeighbourg (CFaceGraphHelper &helper, int pointindex, int &size, ConnectionInfoType type)
 
bool IsPointNeighbourg (CFaceGraphHelper &helper, int index, int isNeighbourgIndex)
 
bool DoesEdgeExists (const C3DEdge &edge, int face=-1) const
 
int GetFacesByOppositeEdges (CFaceGraphHelper &helper, int point1, int point2, ConnectionInfoType type, CEdgeGraph &edgeGraph)
 
bool IsIsolatedFace (int facenbr) const
 
int GraphRemoveFaceReference (CGeomInfo *info, int faceindex, bool setAlonePointsToInvalid)
 
int GraphMergePointConnectivity (int, int)
 
bool GraphDisconnectFace (int ptindex, int faceindex)
 
bool GraphConnectFace (int ptindex, int faceindex)
 
virtual unsigned int GetChecksum (unsigned int checksumFlags=CHECKSUM_FACES|CHECKSUM_FACES_EXTRA) const
 Return a value that is a simple way to check if the geometry changed between two call to the method.
 
virtual void Inherit (const CFaceList &reffaces)
 
virtual CFaceListoperator= (const CFaceList &reffaces)
 
- Public Member Functions inherited from CInstanciatedObject
virtual bool Delete ()
 
int GetRefCount () const
 
int AddRef () const
 

Member Enumeration Documentation

◆ SetSizeMode

Defines the way SetSize size down or not the index memory block

Enumerator
DEFAULT 

Memory block is shrink down if specified size is below existing size.

FREE_EXTRA 

Free any extra memory and do not allocate any extra memory
The number of face is growing, but we don't know the exact size. Preallocate is first called with an estimated #number of faces, SetSize is then called several time with and increasing number of face (GROW_MODE), and finally called a last time with the definitive number of face.

Member Function Documentation

◆ CreateFace()

virtual CFace * CFaceList::CreateFace ( ) const
pure virtual

Get a face object the appropriate derived face type (ie it will return a C3DFace, with C3DFaceList, CNormalFace with CNormalFaceList...). Call CFaceList::ReleaseFace when you do not need it anymore.

Implemented in C3DFaceList, CNormalFaceList, CUVWFaceList, CVCFaceList, and CWeightFaceList.

◆ PreAllocate()

void CFaceList::PreAllocate ( int  estimatedFaceNbr,
int  estimatedIndexNbr,
bool  constructAllElementsOnce = false 
)

Preallocate the data with an estimated face nbr and total indexes count for the whole face set. The method removes any existing data.

When filling the faces, SetSize must be called using GROW_MODE, otherwise faces array will be resized, loosing the preallocation advantages use constructAllElementsOnce carefully as it construct all elements (even if they are not used)

◆ TagFaces()

unsigned int CFaceList::TagFaces ( CGeomInfo info,
CFaceTagger faceTagger,
bool  exploreByEdge 
)

Create group of faces which points/edges are delimited by a given property.

This property is implemented by the caller through the faceTagger method.

  • exploreByEdge = true
    the faces are explored using an edge connection
  • exploreByEdge = false
    the faces are explored using a point connection.
    this is the slowest exploration mode as CFaceTagger::BelongToGroup is called for each face corner
Returns
The method returns the number of created group. Gather face together in a CFaceTagger object.

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