Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
C3DFaceList Class Reference

C3DFaceList class which implement a list of C3DFace. Each face contains indexes to 3D points stored in C3DPointList class. Look at CFaceList base class to get more information. More...

Detailed Description

C3DFaceList class which implement a list of C3DFace. Each face contains indexes to 3D points stored in C3DPointList class. Look at CFaceList base class to get more information.

#include <3DFaceList.h>

Inheritance diagram for C3DFaceList:
CFaceList CInstanciatedObject

Public Member Functions

 C3DFaceList (C3DFaceList *srcFaces=NULL)
 Create a new face list. When srcFaces is provided, the data structure (datachunks) is inherited but the face list is created empty.
 
virtual ~C3DFaceList ()
 Use CFace::Delete should be used because there can be several references to the face list. This does not occurs if C3DFaceList is created on the stack.
 
virtual CFaceCreateFace () const
 <
 
virtual bool UpdateList ()
 
virtual void RemoveAll ()
 
C3DFaceListoperator= (const C3DFaceList &reffaces)
 
virtual CFaceListoperator= (const CFaceList &reffaces)
 
Face information

Various information about the face

bool GetBoundingBox (const CGeomInfo *info, C3DPoint &min, C3DPoint &max, unsigned int faceFlags=FACE_NONE, bool set=true, C4x4Matrix *matrix=NULL)
 points are transformed by matrix if any provided
 
bool GetBoundingBox (const CGeomInfo *info, C3DBBox &bbox, unsigned int faceFlags=FACE_NONE, bool set=true, C4x4Matrix *matrix=NULL)
 points are transformed by matrix if any provided
 
bool UnifyNormals (CGeomInfo *info, CBitArray &flippedFaces)
 
double GetDistanceToFace (CGeomInfo *info, unsigned int index, const C3DPoint &pt)
 Get the distance from face index to the given pt. Calculate the projection on the face or on the closest edge. The face can be both triangular or quadrangular.
 
double GetDistanceToFacePlane (CGeomInfo *info, unsigned int index, const C3DPoint &pt, bool absoluteValue=true)
 Get the distance from face index to the face plane. The face can be N-Gon but in this case, we check before that this NGon is planar, which can be slow.
 
Operations on face

Modify the faces

int MergeCoplanarFaces (const CGeomInfo *info, double radianMaxAngle)
 
int Triangulate (CGeomInfo *, unsigned int uvwChannel=ALL_CHANNELS_TYPE, FACE_PROPERTIES properties=FACE_NONE, bool musthave=true)
 
Retrieve quickly a face

Create a C3DFaceGridMap which is a way to quickly find a face

unsigned int GetFaceGridMapFlags () const
 Return an already computed face grid or null.
 
C3DFaceGridMapGetFaceGridMap (bool addReferenceCount=true)
 Return an already computed map that contains each faces sampled in an integer grid. Pending DeleteFaceGridMap must be called, unless addReferenceCount = false.
 
C3DFaceGridMapGetFaceGridMap (CGeomInfo *info, unsigned int faceGridFlags=FACEGRID_NONE)
 Return or (re-)compute a map that contains each faces sampled in an integer grid, with the given flags. The face list must be triangular, otherwise, returns NULL. Pending DeleteFaceGridMap must be called.
 
unsigned int GetClosestFace (CGeomInfo *info, C3DFaceGridMap *faceGridMap, const C3DPointD &pt, double &distance, double maxdistance=HUGE_VAL)
 Return the closest face index to the point pt. If a face is found distance contains the distance of pt to the face. Otherwise distance = HUGE_VALUE and index INVALID_FACE_INDEX is returned. maxDistance can be used to define a max distance and limite the search, increasing speed.
 
unsigned int GetRayCastFace (CGeomInfo *info, C3DFaceGridMap *faceGridMap, const C3DPointD &eye, const C3DVectorD &dir, C3DPointD &hitPoint, unsigned int rayCastFlags=RAYCAST_DEFAULT, bool *oppositeDir=NULL)
 Return the ray cast face index to the point pt, or INVALID_FACE_INDEX if none.
 
void DeleteFaceGridMap ()
 
Sort faces
intSort (unsigned int sortmode, unsigned int &arraySize, bool &orderChanged)
 sortmode contains FACE_SORT_MODE flags. arraySize is the size of the returned index array. orderChanged is false if the faces are already sorted (index of the array match index of the faces). orderChanged means nothing if SORT_FRONT_AND_BACK_MATERIAL is set. The method returns a sorted by material array (this does not change the face order itself). arraySize contains the size of the returned array. It is equal to GetSize() or 2*GetSize() depending on the sort mode
 
bool Sort (const CGeomInfo *info, unsigned int mode)
 Sort the face by changing their order; depenging on the front or back face material (SORT_FRONT_AND_BACK_MATERIAL cannot be used)
 
Get or modify material used by faces
bool ReplaceMaterial (MaterialID matid, MaterialID newmatid)
 Replace face matid by newmatid and update the material hash map if possible.
 
unsigned int GetMaterialsHashMap (const CGeomInfo *info, CMaterialHashMap &hashMaterialMap, bool includeBackFace=true, bool reset=true)
 Get (MaterialID, facecount) hash. If includeBackFace, the back face material are added to the hash. Return the number of material.
 
const CFBMaterialHashMapGetFBMaterialsHashMap (const CGeomInfo *info)
 Return a ((front MaterialID, back MaterialID), facecount) material id hash.
 
void DeleteFBMaterialsHashMap ()
 Free the hash material when no longer needed.
 
bool HasDifferentFrontAndBackUVChannel (const CGeomInfo *info, MapType type) const
 Return true if the object has different front and back UV channels (looking materials front & back UV). The method return false, if back UV is undefined or if front and back channel are the same. A CGeomInfo with object and scene is needed.
 
bool HasBackFaceMaterials () const
 
bool RemoveBackFaceMaterials ()
 Return true if object had back face materials.
 
void SetBackFaceMaterial (unsigned int index, MaterialID id)
 
void SetFaceMaterial (unsigned int index, MaterialID id)
 
MaterialID GetFaceMaterial (unsigned int index) const
 
MaterialID GetBackFaceMaterial (unsigned int index, bool getFrontIfNeeded=false) const
 getFrontIfNeeded = false return possibly MATERIAL_UNDEFINED. If getFrontIfNeeded = true, then this value is overriden by front face material
 
FBMaterialID GetFBFaceMaterial (unsigned int index, bool getFrontIfNeeded=false) const
 getFrontIfNeeded = false return possibly MATERIAL_UNDEFINED. If getFrontIfNeeded = true, then this value is overriden by front face material
 
bool CompareBackAndFrontMaterials (bool deleteBackIfSame, bool checkFrontBackMaterialChannel=false, CGeomInfo *info=NULL)
 return true if back & front materials are the sames, or if no back materials. deleteBackIfSame = true will delete the extra back face information. checkFrontBackMaterialChannel = true the delete occurs only if channelID is the same for front and back channelID (we might have the same material applied to both side of a face, with different channels) or if 2 differents channels are exactly the same
 
- Public Member Functions inherited from CFaceList
 CFaceList (CFaceList *srcFaces)
 
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)
 
- Public Member Functions inherited from CInstanciatedObject
virtual bool Delete ()
 
int GetRefCount () const
 
int AddRef () const
 

Static Public Member Functions

static C3DFaceListCreate (C3DFaceList *srcFaces=NULL)
 Allocates and creates an empty set of 3d faces. Use C3DFaceList::Delete to delete it.
 

Additional Inherited Members

- Public Types inherited from CFaceList
enum  SetSizeMode { DEFAULT = 0 , FREE_EXTRA , GROW_MODE }
 

Member Function Documentation

◆ CreateFace()

virtual CFace * C3DFaceList::CreateFace ( ) const
inlinevirtual

<

use ReleaseFace(CFace *) to delete created face

Implements CFaceList.

◆ operator=()

virtual CFaceList & C3DFaceList::operator= ( const CFaceList reffaces)
virtual

Reimplemented from CFaceList.

◆ UpdateList()

virtual bool C3DFaceList::UpdateList ( )
virtual

Reimplemented from CFaceList.


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