![]() |
Polygon Crucher SDK - Documentation
Documentation
|
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 is the common base class for a lot of different classes (C3DFaceList, CUVWFaceList...)
In the SDK, faces are stored in a single memory block in a compact way. The advantage is the simplicity, but we need to be careful about how we create or modify faces to maintain good performance and avoid time-consuming memory allocations.
You can associates your own data type to faces using CFaceList::AddDataChunk / CFaceList::GetDataChunk.
Data chunks are somewhat similar to CChannel except that chunks are really tied to the face, which can be easier to make data follow during face operations.
We can do the same using a C3DFace.
We usually have an idea on the faces size, when creating them.
This is important to properly initialized the faces list with the appropriate sizes to avoid memory reallocation.
In this sample we have 50 triangles and 50 quads. We initialize 100 faces with quads, so allocation will also be ok for triangles.
When importing the faces from an external files, we usually can collect each face size and allocates accordingly. Here we allocates 4 faces with different sizes.
Sometime not all imported faces are valid. In this sample, we imagine some inputData with quadrangular faces, but only some are valids.
We can also use CFaceList::Preallocate when the really don't know what are the input face, because the process to get info on them is is time-consuming. In this case we can use CFaceList::Preallocate prepares memory only. And we can fill it, face by face, getting each final face information one by one.