Implementing
Subdivision Surface Theory
Listing
1. The Data Used to Represent the Control Net.
class ButterflySurface
{
public:
    ...
protected:
    ...
    //
Information about the vertices
    int numVerts;
    int vertCapacity;
    float* verts;
    float* vertNorms;
    VertexEdges* vertEdges;
    float* texCoords;
    float* colors;
    //
Information about the faces;
    // all faces are triangles.
    int numFaces;
    int faceCapacity;
    int* faces;
    int* faceEdges;
    //
Connectivity information,
    // needed for tessellating.
    int numEdges;
    int edgeCapacity;
    ButterflyEdge* edges;
};
// Classes used in
control net storage.
class VertexEdges
{
public:
    VertexEdges();
    VertexEdges(const VertexEdges& source);
    VertexEdges& operator=(const VertexEdges&
source);
    int numEdges;
    int edges[MAX_VERTEX_VALENCE];
};
class ButterflyEdge
{
public:
    bool operator==(const ButterflyEdge& cmp) const;
    bool operator<(const ButterflyEdge& cmp)
const;
    int v[2];
};
________________________________________________________
Back
to Article