Beispiel #1
0
        public void EnumerateEdges()
        {
            var mesh   = CreateTestMesh.CreateCross();
            var vertex = mesh.Vertices[4];
            var edges  = new List <HBEdge>();

            foreach (var edge in vertex.EnumerateEdges(true))
            {
                edges.Add(edge);
            }

            Assert.AreEqual(4, edges.Count);
            Assert.AreEqual(mesh.Edges[0], edges[0]);
            Assert.AreEqual(mesh.Edges[6], edges[1]);
            Assert.AreEqual(mesh.Edges[4], edges[2]);
            Assert.AreEqual(mesh.Edges[2], edges[3]);

            mesh   = CreateTestMesh.CreateCross();
            vertex = mesh.Vertices[4];
            edges  = new List <HBEdge>();

            foreach (var edge in vertex.EnumerateEdges(false))
            {
                edges.Add(edge);
            }

            Assert.AreEqual(4, edges.Count);
            Assert.AreEqual(mesh.Edges[0], edges[0]);
            Assert.AreEqual(mesh.Edges[2], edges[1]);
            Assert.AreEqual(mesh.Edges[4], edges[2]);
            Assert.AreEqual(mesh.Edges[6], edges[3]);
        }
Beispiel #2
0
        public void EdgeCount()
        {
            var mesh   = CreateTestMesh.CreateCross();
            var vertex = mesh.Vertices[4];

            Assert.AreEqual(4, vertex.EdgeCount);
        }
Beispiel #3
0
        public void EnumerateVertices()
        {
            var mesh     = CreateTestMesh.CreateTriangle();
            var edge     = mesh.Edges[0];
            var vertices = new List <HBVertex>();

            foreach (var vertex in edge.EnumerateVertices(true))
            {
                vertices.Add(vertex);
            }

            Assert.AreEqual(3, vertices.Count);
            Assert.AreEqual(mesh.Vertices[0], vertices[0]);
            Assert.AreEqual(mesh.Vertices[1], vertices[1]);
            Assert.AreEqual(mesh.Vertices[2], vertices[2]);

            mesh     = CreateTestMesh.CreateTriangle();
            edge     = mesh.Edges[0];
            vertices = new List <HBVertex>();

            foreach (var vertex in edge.EnumerateVertices(false))
            {
                vertices.Add(vertex);
            }

            Assert.AreEqual(3, vertices.Count);
            Assert.AreEqual(mesh.Vertices[0], vertices[0]);
            Assert.AreEqual(mesh.Vertices[2], vertices[1]);
            Assert.AreEqual(mesh.Vertices[1], vertices[2]);
        }
Beispiel #4
0
        public void EnumerateEdges()
        {
            var mesh = CreateTestMesh.CreateTriangle();
            var edge = mesh.Edges[0];

            var edges = new List <HBEdge>();

            foreach (var e in edge.EnumerateEdges(true))
            {
                edges.Add(e);
            }

            Assert.AreEqual(3, edges.Count);
            Assert.AreEqual(mesh.Edges[0], edges[0]);
            Assert.AreEqual(mesh.Edges[1], edges[1]);
            Assert.AreEqual(mesh.Edges[2], edges[2]);

            mesh  = CreateTestMesh.CreateTriangle();
            edge  = mesh.Edges[0];
            edges = new List <HBEdge>();

            foreach (var e in edge.EnumerateEdges(false))
            {
                edges.Add(e);
            }

            Assert.AreEqual(3, edges.Count);
            Assert.AreEqual(mesh.Edges[0], edges[0]);
            Assert.AreEqual(mesh.Edges[2], edges[1]);
            Assert.AreEqual(mesh.Edges[1], edges[2]);
        }
Beispiel #5
0
        public void RemoveFaces()
        {
            var mesh = CreateTestMesh.CreateSquareWithCenter();

            mesh.RemoveFaces();

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

            foreach (var edge in mesh.Edges)
            {
                Assert.IsNull(edge.Face);
            }
        }
Beispiel #6
0
        public void RemoveFace()
        {
            var mesh = CreateTestMesh.CreateSquareWithCenter();

            var face = mesh.Faces[0];

            mesh.RemoveFace(face);

            Assert.IsFalse(mesh.Faces.Contains(face));
            Assert.AreEqual(3, mesh.Faces.Count);

            foreach (var edge in mesh.Edges)
            {
                Assert.AreNotEqual(edge.Face, face);
            }
        }