Esempio n. 1
0
        public void TestDcelMeshDirty()
        {
            DcelMesh mesh = new DcelMesh();

            DcelVertex v0 = new DcelVertex();
            DcelVertex v1 = new DcelVertex();
            DcelVertex v2 = new DcelVertex();

            DcelEdge e0 = new DcelEdge();
            DcelEdge e1 = new DcelEdge();
            DcelEdge e2 = new DcelEdge();

            DcelFace f = new DcelFace();

            // Link features
            v0.Edge     = e0;
            e0.Origin   = v0;
            mesh.Vertex = v0;

            Assert.AreEqual(1, mesh.Vertices.Count);
            Assert.AreEqual(1, mesh.Edges.Count);
            Assert.AreEqual(0, mesh.Faces.Count);

            // Link more
            e0.Next    = e1;
            e1.Next    = e2;
            mesh.Dirty = true;
            Assert.AreEqual(3, mesh.Edges.Count);

            e1.Origin  = v1;
            e2.Origin  = v2;
            mesh.Dirty = true;
            Assert.AreEqual(3, mesh.Vertices.Count);

            e0.Face    = f;
            f.Boundary = e1;
            mesh.Dirty = true;
            Assert.AreEqual(1, mesh.Faces.Count);
        }
Esempio n. 2
0
        public void TestDcelMeshDirty()
        {
            DcelMesh mesh = new DcelMesh();

              DcelVertex v0 = new DcelVertex();
              DcelVertex v1 = new DcelVertex();
              DcelVertex v2 = new DcelVertex();

              DcelEdge e0 = new DcelEdge();
              DcelEdge e1 = new DcelEdge();
              DcelEdge e2 = new DcelEdge();

              DcelFace f = new DcelFace();

              // Link features
              v0.Edge = e0;
              e0.Origin = v0;
              mesh.Vertex = v0;

              Assert.AreEqual(1, mesh.Vertices.Count);
              Assert.AreEqual(1, mesh.Edges.Count);
              Assert.AreEqual(0, mesh.Faces.Count);

              // Link more
              e0.Next = e1;
              e1.Next = e2;
              mesh.Dirty = true;
              Assert.AreEqual(3, mesh.Edges.Count);

              e1.Origin = v1;
              e2.Origin = v2;
              mesh.Dirty = true;
              Assert.AreEqual(3, mesh.Vertices.Count);

              e0.Face = f;
              f.Boundary = e1;
              mesh.Dirty = true;
              Assert.AreEqual(1, mesh.Faces.Count);
        }