How to make Vertex Table, Edge Table and Surface Table to store geometric information of an object??

Listing the geometric data in three tables provides a convenient reference to the individual components of each object. Also, the object can be displayed efficiently be using data from the edge table to draw the component lines. Here I discuss about how to create those tables with the help of C++ code.
Vertex table consists of the array of vertices with the coordinate value of each vertex. In C++, a vertex table can be created by creating a class that has . For example

class vertex
{
    private:
    Point3D *points;
    public:
    vertex()
    {
        points = new Point3D();
    }
};

 

Edge table consists of pointers back into vertex to identify the edges for each polygon.  For example,

class edge
{
    public:
    vertex *ver1;
    vertex *ver2;
    bool done; //1 if edge not to be  drawn: 
    //0 if edge to be drawn, avoids multiple drawing of the edges
    edge *adjsur; //pointer to adjacent surface's edge 
    edge()
    {
        ver1 = new vertex();
        ver2 = new vertex();
        done = false;
    }
};
Surface table consists of pointers of edges associated with the surface. Similarly it consists of Coefficients of Plane equations A, B, C, D and color intensity value of each surface. Surface table has great importance in Surface Rendering and Visible surface detection. The surface table can be created in C++ as
class surface
    {
        public:
        edge *edges;
        float A, B, C, D;
        int icolor;
        surface()
        {
            edges = new edge();
            A = 0.0f;
            B = 0.0f;
            C = 0.0f;
            D = 0.0f;
            icolor = 0;
        }
    }

Rules for creating Geometric table:  

1.  Every vertex is listed as an end point for at least two edges.
2.  Every edge is part of at least one polygon
3.  Each polygon has at least one shared edge.
4.  Every surface is close.

SHARE How to make Vertex Table, Edge Table and Surface Table to store geometric information of an object??

You may also like...

Leave a Reply

Your email address will not be published.

Share