private void CloneMeshWithPartition(ISpatialPartition <int> partition)
        {
            TriangleMeshShape meshShape = (TriangleMeshShape)_meshShape.Clone();

            meshShape.Partition = partition;

            TriangleMeshShape clone = meshShape.Clone() as TriangleMeshShape;

            Assert.IsNotNull(clone);
            Assert.IsNotNull(clone.Mesh);
            Assert.IsTrue(clone.Mesh is TriangleMesh);
            Assert.AreSame(_mesh, clone.Mesh);
            Assert.AreEqual(_mesh.NumberOfTriangles, clone.Mesh.NumberOfTriangles);
            for (int i = 0; i < _mesh.NumberOfTriangles; i++)
            {
                Triangle t = _mesh.GetTriangle(i);

                Triangle tCloned = clone.Mesh.GetTriangle(i);

                Assert.AreEqual(t.Vertex0, tCloned.Vertex0);
                Assert.AreEqual(t.Vertex1, tCloned.Vertex1);
                Assert.AreEqual(t.Vertex2, tCloned.Vertex2);
            }

            Assert.IsNotNull(clone.Partition);
            Assert.IsInstanceOf(partition.GetType(), clone.Partition);
            Assert.AreEqual(_mesh.NumberOfTriangles, clone.Partition.Count);
            Assert.AreNotSame(partition, clone.Partition);
        }
Beispiel #2
0
        private void CloneWithPartition(CompositeShape compositeShape, ISpatialPartition <int> partition)
        {
            compositeShape.Partition = partition;
            CompositeShape clone = compositeShape.Clone() as CompositeShape;

            Assert.IsNotNull(clone);
            Assert.AreEqual(10, clone.Children.Count);
            for (int i = 0; i < 10; i++)
            {
                Assert.IsNotNull(clone.Children[i]);
                Assert.AreNotSame(compositeShape.Children[i], clone.Children[i]);
                Assert.IsTrue(clone.Children[i] is GeometricObject);
                Assert.AreEqual(compositeShape.Children[i].Pose, clone.Children[i].Pose);
                Assert.IsNotNull(clone.Children[i].Shape);
                Assert.AreNotSame(compositeShape.Children[i].Shape, clone.Children[i].Shape);
                Assert.IsTrue(clone.Children[i].Shape is PointShape);
                Assert.AreEqual(((PointShape)compositeShape.Children[i].Shape).Position, ((PointShape)clone.Children[i].Shape).Position);
            }

            Assert.IsNotNull(clone.Partition);
            Assert.IsInstanceOf(partition.GetType(), clone.Partition);
            Assert.AreEqual(compositeShape.Children.Count, clone.Partition.Count);
            Assert.AreNotSame(partition, clone.Partition);
        }
Beispiel #3
0
        private void CloneWithPartition(CompositeShape compositeShape, ISpatialPartition<int> partition)
        {
            compositeShape.Partition = partition;
              CompositeShape clone = compositeShape.Clone() as CompositeShape;
              Assert.IsNotNull(clone);
              Assert.AreEqual(10, clone.Children.Count);
              for (int i = 0; i < 10; i++)
              {
            Assert.IsNotNull(clone.Children[i]);
            Assert.AreNotSame(compositeShape.Children[i], clone.Children[i]);
            Assert.IsTrue(clone.Children[i] is GeometricObject);
            Assert.AreEqual(compositeShape.Children[i].Pose, clone.Children[i].Pose);
            Assert.IsNotNull(clone.Children[i].Shape);
            Assert.AreNotSame(compositeShape.Children[i].Shape, clone.Children[i].Shape);
            Assert.IsTrue(clone.Children[i].Shape is PointShape);
            Assert.AreEqual(((PointShape)compositeShape.Children[i].Shape).Position, ((PointShape)clone.Children[i].Shape).Position);
              }

              Assert.IsNotNull(clone.Partition);
              Assert.IsInstanceOf(partition.GetType(), clone.Partition);
              Assert.AreEqual(compositeShape.Children.Count, clone.Partition.Count);
              Assert.AreNotSame(partition, clone.Partition);
        }
Beispiel #4
0
        private void CloneMeshWithPartition(ISpatialPartition<int> partition)
        {
            TriangleMeshShape meshShape = (TriangleMeshShape)_meshShape.Clone();
              meshShape.Partition = partition;

              TriangleMeshShape clone = meshShape.Clone() as TriangleMeshShape;
              Assert.IsNotNull(clone);
              Assert.IsNotNull(clone.Mesh);
              Assert.IsTrue(clone.Mesh is TriangleMesh);
              Assert.AreSame(_mesh, clone.Mesh);
              Assert.AreEqual(_mesh.NumberOfTriangles, clone.Mesh.NumberOfTriangles);
              for (int i = 0; i < _mesh.NumberOfTriangles; i++)
              {
            Triangle t = _mesh.GetTriangle(i);

            Triangle tCloned = clone.Mesh.GetTriangle(i);

            Assert.AreEqual(t.Vertex0, tCloned.Vertex0);
            Assert.AreEqual(t.Vertex1, tCloned.Vertex1);
            Assert.AreEqual(t.Vertex2, tCloned.Vertex2);
              }

              Assert.IsNotNull(clone.Partition);
              Assert.IsInstanceOf(partition.GetType(), clone.Partition);
              Assert.AreEqual(_mesh.NumberOfTriangles, clone.Partition.Count);
              Assert.AreNotSame(partition, clone.Partition);
        }