Пример #1
0
 public void ScaleAndCopyTest()
 {
     //this test checks that a object is correctly copied and moved
     //create a box
     using (
         var m = IfcStore.Create(new XbimEditorCredentials(), IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel)
         )
     {
         using (var txn = m.BeginTransaction())
         {
             var block     = IfcModelBuilder.MakeBlock(m, 10, 10, 10);
             var solid     = _geomEngine.CreateSolid(block);
             var transform = IfcModelBuilder.MakeCartesianTransformationOperator3D(m);
             transform.Scale = 2;
             var solidA = _geomEngine.Transformed(solid, transform);
             var bb     = solid.BoundingBox;
             var bbA    = solidA.BoundingBox;
             Assert.IsTrue(Math.Abs(bb.Volume - 1000) < 1e-9, "Bounding box volume is incorrect in original shape");
             Assert.IsTrue(Math.Abs(bbA.Volume - 8000) < 1e-9, "Bounding box volume is incorrect in scaled shape");
             var transformNonUniform = IfcModelBuilder.MakeCartesianTransformationOperator3DnonUniform(m);
             transformNonUniform.Scale3 = 100;
             var solidB = _geomEngine.Transformed(solid, transformNonUniform);
             Assert.IsTrue(Math.Abs(solidB.BoundingBox.Volume - 100000) < 1e-9, "Bounding box volume is incorrect in non uniform scaled shape");
             Assert.IsTrue(Math.Abs(bb.Volume - 1000) < 1e-9, "Bounding box volume of original shape as been changed");
         }
     }
 }