Esempio n. 1
0
    public void Rectangle()
    {
        Vertice v0 = new Vertice(new Vector3(0, 0, 0));
        Vertice v1 = new Vertice(new Vector3(0, 20, 0));
        Vertice v2 = new Vertice(new Vector3(20, 20, 0));
        Vertice v3 = new Vertice(new Vector3(20, 0, 0));
        Vertice v4 = new Vertice(new Vector3(0, 0, 20));
        Vertice v5 = new Vertice(new Vector3(0, 20, 20));
        Vertice v6 = new Vertice(new Vector3(20, 20, 20));
        Vertice v7 = new Vertice(new Vector3(20, 0, 20));


        v0.AddNeighbours(new List <Vertice>()
        {
            v1, v3, v4, v7, v5
        });
        v1.AddNeighbours(new List <Vertice>()
        {
            v0, v3, v2, v5
        });
        v2.AddNeighbours(new List <Vertice>()
        {
            v1, v3, v6, v7, v5
        });
        v3.AddNeighbours(new List <Vertice>()
        {
            v0, v1, v2, v7
        });

        v4.AddNeighbours(new List <Vertice>()
        {
            v0, v7, v5
        });
        v5.AddNeighbours(new List <Vertice>()
        {
            v0, v1, v2, v4, v7, v6
        });
        v6.AddNeighbours(new List <Vertice>()
        {
            v5, v7, v3
        });
        v7.AddNeighbours(new List <Vertice>()
        {
            v0, v4, v3, v2, v5, v6
        });

        verticesGlobal = new List <Vertice>()
        {
            v0, v1, v2, v3, v4, v5, v6, v7
        };

        Triangle t0 = new Triangle(new List <Vertice>()
        {
            v0, v1, v2
        });
        Triangle t1 = new Triangle(new List <Vertice>()
        {
            v0, v2, v3
        });
        Triangle t2 = new Triangle(new List <Vertice>()
        {
            v0, v1, v5
        });
        Triangle t3 = new Triangle(new List <Vertice>()
        {
            v0, v4, v5
        });

        Triangle t4 = new Triangle(new List <Vertice>()
        {
            v0, v4, v7
        });
        Triangle t5 = new Triangle(new List <Vertice>()
        {
            v0, v3, v7
        });

        Triangle t6 = new Triangle(new List <Vertice>()
        {
            v2, v5, v6
        });
        Triangle t7 = new Triangle(new List <Vertice>()
        {
            v2, v5, v1
        });

        Triangle t8 = new Triangle(new List <Vertice>()
        {
            v2, v7, v6
        });
        Triangle t9 = new Triangle(new List <Vertice>()
        {
            v2, v7, v3
        });

        Triangle t10 = new Triangle(new List <Vertice>()
        {
            v6, v4, v5
        });
        Triangle t11 = new Triangle(new List <Vertice>()
        {
            v6, v4, v7
        });

        /*t0.AddNeighbours(new List<Triangle>() { t1, t2, t3 });
         * t1.AddNeighbours(new List<Triangle>() { t0, t2, t3 });
         * t2.AddNeighbours(new List<Triangle>() { t0, t1, t3 });
         * t3.AddNeighbours(new List<Triangle>() { t0, t1, t2 });
         */
        t0.Center  = TriCenter(t0);
        t1.Center  = TriCenter(t1);
        t2.Center  = TriCenter(t2);
        t3.Center  = TriCenter(t3);
        t4.Center  = TriCenter(t4);
        t5.Center  = TriCenter(t5);
        t6.Center  = TriCenter(t6);
        t7.Center  = TriCenter(t7);
        t8.Center  = TriCenter(t8);
        t9.Center  = TriCenter(t9);
        t10.Center = TriCenter(t10);
        t11.Center = TriCenter(t11);


        centers.Add(t0.Center);
        centers.Add(t1.Center);
        centers.Add(t2.Center);
        centers.Add(t3.Center);
        centers.Add(t4.Center);
        centers.Add(t5.Center);
        centers.Add(t6.Center);
        centers.Add(t7.Center);
        centers.Add(t8.Center);
        centers.Add(t9.Center);
        centers.Add(t10.Center);
        centers.Add(t11.Center);

        tri.Add(t0);
        tri.Add(t1);
        tri.Add(t2);
        tri.Add(t3);
        tri.Add(t4);
        tri.Add(t5);
        tri.Add(t6);
        tri.Add(t7);
        tri.Add(t8);
        tri.Add(t9);
        tri.Add(t10);
        tri.Add(t11);
    }
Esempio n. 2
0
    public void Triangle()
    {
        Vertice v0 = new Vertice(new Vector3(0, 0, 0));
        Vertice v1 = new Vertice(new Vector3(64, 0, 0));
        Vertice v2 = new Vertice(new Vector3(32f, 0, 48f));
        Vertice v3 = new Vertice(new Vector3(32f, 48f, 24f));

        v0.AddNeighbours(new List <Vertice>()
        {
            v1, v2, v3
        });
        v1.AddNeighbours(new List <Vertice>()
        {
            v0, v2, v3
        });
        v2.AddNeighbours(new List <Vertice>()
        {
            v0, v1, v3
        });
        v3.AddNeighbours(new List <Vertice>()
        {
            v0, v1, v2
        });

        verticesGlobal = new List <Vertice>()
        {
            v0, v1, v2, v3
        };

        Triangle t0 = new Triangle(new List <Vertice>()
        {
            v0, v1, v2
        });
        Triangle t1 = new Triangle(new List <Vertice>()
        {
            v0, v1, v3
        });
        Triangle t2 = new Triangle(new List <Vertice>()
        {
            v1, v2, v3
        });
        Triangle t3 = new Triangle(new List <Vertice>()
        {
            v0, v2, v3
        });

        t0.AddNeighbours(new List <Triangle>()
        {
            t1, t2, t3
        });
        t1.AddNeighbours(new List <Triangle>()
        {
            t0, t2, t3
        });
        t2.AddNeighbours(new List <Triangle>()
        {
            t0, t1, t3
        });
        t3.AddNeighbours(new List <Triangle>()
        {
            t0, t1, t2
        });

        t0.Center = TriCenter(t0);
        t1.Center = TriCenter(t1);
        t2.Center = TriCenter(t2);
        t3.Center = TriCenter(t3);

        centers.Add(t0.Center);
        centers.Add(t1.Center);
        centers.Add(t2.Center);
        centers.Add(t3.Center);

        tri.Add(t0);
        tri.Add(t1);
        tri.Add(t2);
        tri.Add(t3);
    }