示例#1
0
    /// In the construction of the data structure we generate the initial square
    /// centered in 0,0,0 and with side 2.
    /// The structures that hold the data are created and filled
    public DataStructure()
    {
        step        = 0;
        unfoldCount = 0;

        faceTree = new FaceTree();
        edgeBTL  = new EdgeBinaryTreeList();
        vertexLL = new VertexLinkedList();

        Vertex v1 = new Vertex(new Vector3(-1, 1, 0), step);
        Vertex v2 = new Vertex(new Vector3(1, 1, 0), step);
        Vertex v3 = new Vertex(new Vector3(1, -1, 0), step);
        Vertex v4 = new Vertex(new Vector3(-1, -1, 0), step);

        Edge e1 = new Edge(v1, v2, step);
        Edge e2 = new Edge(v2, v3, step);
        Edge e3 = new Edge(v3, v4, step);
        Edge e4 = new Edge(v4, v1, step);

        v1.addEdge(e1);
        v1.addEdge(e4);

        v2.addEdge(e1);
        v2.addEdge(e2);

        v3.addEdge(e2);
        v3.addEdge(e3);

        v4.addEdge(e3);
        v4.addEdge(e4);

        List <Vertex> vList = new List <Vertex>();

        vList.Add(v1);
        vList.Add(v2);
        vList.Add(v3);
        vList.Add(v4);

        List <Edge> eList = new List <Edge>();

        eList.Add(e1);
        eList.Add(e2);
        eList.Add(e3);
        eList.Add(e4);

        Face f = new Face(vList, step);

        vertexLL.addVertex(v1);
        vertexLL.addVertex(v2);
        vertexLL.addVertex(v3);
        vertexLL.addVertex(v4);

        edgeBTL.addEdge(e1);
        edgeBTL.addEdge(e2);
        edgeBTL.addEdge(e3);
        edgeBTL.addEdge(e4);

        faceTree.setRoot(f);
    }
示例#2
0
    // In the construction of the data structure we generate the initial square centered in 0,0,0 and with side 2. The structures that hold the data are created and filled
    public DataStructure(Vector3 v)
    {
        camToModel  = v;
        step        = 0;
        unfoldCount = 0;

        faceTree = new FaceTree();
        edgeBTL  = new EdgeBinaryTreeList();
        vertexLL = new VertexLinkedList();

        Vertex v1 = new Vertex(new Vector3(-1, 1, 0), step, 0);
        Vertex v2 = new Vertex(new Vector3(1, 1, 0), step, 1);
        Vertex v3 = new Vertex(new Vector3(1, -1, 0), step, 2);
        Vertex v4 = new Vertex(new Vector3(-1, -1, 0), step, 3);

        VertexNode vn1 = new VertexNode(v1);
        VertexNode vn2 = new VertexNode(v2);
        VertexNode vn3 = new VertexNode(v3);
        VertexNode vn4 = new VertexNode(v4);

        Edge e1 = new Edge(vn1, vn2, step, 0);
        Edge e2 = new Edge(vn2, vn3, step, 1);
        Edge e3 = new Edge(vn3, vn4, step, 2);
        Edge e4 = new Edge(vn4, vn1, step, 3);


        vn1.addEdge(e1);
        vn1.addEdge(e4);

        vn2.addEdge(e1);
        vn2.addEdge(e2);

        vn3.addEdge(e2);
        vn3.addEdge(e3);

        vn4.addEdge(e3);
        vn4.addEdge(e4);

        List <VertexNode> vList = new List <VertexNode>();

        vList.Add(vn1);
        vList.Add(vn2);
        vList.Add(vn3);
        vList.Add(vn4);

        List <Edge> eList = new List <Edge>();

        eList.Add(e1);
        eList.Add(e2);
        eList.Add(e3);
        eList.Add(e4);

        Face f = new Face(vList, step, 0);

        for (int i = 0; i < 4; i++)
        {
            eList[i].faces.Add(f);
        }

        vertexLL.addVertex(vn1);
        vertexLL.addVertex(vn2);
        vertexLL.addVertex(vn3);
        vertexLL.addVertex(vn4);

        edgeBTL.addEdge(e1);
        edgeBTL.addEdge(e2);
        edgeBTL.addEdge(e3);
        edgeBTL.addEdge(e4);
        edgeBTL.count = 4;

        faceTree.setRoot(f);
        faceTree.count = 1;
    }