Beispiel #1
0
        public void TestInvalidSquareRayed3()
        {
            var mesh = new RayFactory(2).CreateMesh() as RayMesh;
            var ptLL = mesh.AddVertex(0, 0);
            var ptLR = mesh.AddVertex(1, 0);
            var ptUL = mesh.AddVertex(0, 1);
            var ptUR = mesh.AddVertex(1, 1);

            mesh.AddFace(ptLL, ptLR, ptUR, ptUL);
            // Adding one ray is invalid
            var ptllRayed = mesh.AddRayedVertex(-1, -1);
            var ptlrRayed = mesh.AddRayedVertex(1, -1);

            mesh.AddFace(ptLR, ptLL, ptllRayed, ptlrRayed);

            var failed = false;

            try
            {
                // One face with two rays doesn't complete the boundary
                mesh.FinalizeMesh();
            }
            catch (Exception)
            {
                failed = true;
            }
            Assert.IsTrue(failed);
        }
Beispiel #2
0
        public void TestValidSquareRayed()
        {
            var mesh = new RayFactory(2).CreateMesh() as RayMesh;
            var ptLL = mesh.AddVertex(0, 0);
            var ptLR = mesh.AddVertex(1, 0);
            var ptUL = mesh.AddVertex(0, 1);
            var ptUR = mesh.AddVertex(1, 1);

            mesh.AddFace(ptLL, ptLR, ptUR, ptUL);
            var ptllRayed = mesh.AddRayedVertex(-1, -1);
            var ptlrRayed = mesh.AddRayedVertex(1, -1);
            var pturRayed = mesh.AddRayedVertex(1, 1);
            var ptulRayed = mesh.AddRayedVertex(-1, 1);

            mesh.AddFace(ptLR, ptLL, ptllRayed, ptlrRayed);
            mesh.AddFace(ptUR, ptLR, ptlrRayed, pturRayed);
            mesh.AddFace(ptUL, ptUR, pturRayed, ptulRayed);
            mesh.AddFace(ptLL, ptUL, ptulRayed, ptllRayed);

            var failed = false;

            try
            {
                mesh.FinalizeMesh();
            }
            catch (Exception)
            {
                failed = true;
            }
            Assert.IsFalse(failed);
        }
Beispiel #3
0
        public void TestInvalidSquareRayed1()
        {
            var mesh = new RayFactory(2).CreateMesh() as RayMesh;

            // ReSharper disable InconsistentNaming
            var ptLL = mesh.AddVertex(0, 0);
            var ptLR = mesh.AddVertex(1, 0);
            var ptUL = mesh.AddVertex(0, 1);
            var ptUR = mesh.AddVertex(1, 1);

            // ReSharper restore InconsistentNaming
            mesh.AddFace(ptLL, ptLR, ptUR, ptUL);

            var failed = false;

            try
            {
                // No valid boundary
                mesh.FinalizeMesh();
            }
            catch (Exception)
            {
                failed = true;
            }
            Assert.IsTrue(failed);
        }