Exemple #1
0
 private void FindNeighbouringTriangles()
 {
     for (int i = 0; i < triangles.Count - 1; i++)
     {
         Triangle t1 = triangles[i];
         for (int j = i + 1; j < triangles.Count; j++)
         {
             Triangle t2 = triangles[j];
             if (t1.SharedIndices(t2).Count == 2)
             {
                 Triangle.AddNeighbours(t1, t2);
             }
         }
     }
 }
Exemple #2
0
    public void SetUp()
    {
        t1 = new Triangle(1, 2, 3);
        t2 = new Triangle(2, 4, 3);

        n1 = new Triangle(5, 2, 1);
        n2 = new Triangle(1, 3, 6);
        n3 = new Triangle(2, 7, 4);
        n4 = new Triangle(3, 4, 8);

        Triangle.AddNeighbours(t1, t2);
        Triangle.AddNeighbours(t1, n1);
        Triangle.AddNeighbours(t1, n2);
        Triangle.AddNeighbours(t2, n3);
        Triangle.AddNeighbours(t2, n4);
    }
Exemple #3
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);
    }