public void ReadWriteTriangulationOfNonPlanarSolidTest()
 {
     using (var m = XbimModel.CreateTemporaryModel())
     {
         using (var txn = m.BeginTransaction())
         {
             var        profile = IfcModelBuilder.MakeCircleHollowProfileDef(m, 20, 1);
             var        extrude = IfcModelBuilder.MakeExtrudedAreaSolid(m, profile, 40);
             var        solid   = XbimGeometryCreator.CreateSolid(extrude);
             TextWriter tw      = new StringWriter();
             XbimGeometryCreator.WriteTriangulation(tw, solid, m.ModelFactors.Precision, m.ModelFactors.DeflectionTolerance, 0.5);
             TextReader          tr   = new StringReader(tw.ToString());
             IXbimGeometryObject geom = XbimGeometryCreator.ReadTriangulation(tr);
             var triangulatedSold     = geom as IXbimSolid;
             Assert.IsNotNull(triangulatedSold, "Invalid solid returned");
             Assert.IsTrue(Math.Abs(solid.Volume - triangulatedSold.Volume) < 5, "Volume differs too much");
         }
     }
 }
 public void ConvertXbimSolidFromXbimFacetedSolidCurvedTest()
 {
     using (var m = XbimModel.CreateTemporaryModel())
     {
         using (var txn = m.BeginTransaction())
         {
             var profile = IfcModelBuilder.MakeCircleHollowProfileDef(m, 20, 2);
             var extrude = IfcModelBuilder.MakeExtrudedAreaSolid(m, profile, 40);
             var solid   = XbimGeometryCreator.CreateSolid(extrude);
             var faceted = XbimGeometryCreator.CreateFacetedSolid(solid, m.ModelFactors.Precision,
                                                                  m.ModelFactors.DeflectionTolerance * 10, 1);
             var solid2 = XbimGeometryCreator.CreateSolid(faceted);
             Assert.IsTrue(solid2.Shells.Count == faceted.Shells.Count, "Shell count differs");
             Assert.IsTrue(solid2.Faces.Count == faceted.Faces.Count, "Face count differs");
             Assert.IsTrue(solid2.Edges.Count == faceted.Edges.Count, "Edge count differs");
             Assert.IsTrue(solid2.Vertices.Count == faceted.Vertices.Count, "Vertex count differs");
             Assert.IsTrue(Math.Abs(faceted.Volume - solid2.Volume) < 0.001, "Volume differs");
             Assert.IsTrue(Math.Abs(solid.Volume - solid2.Volume) < 30, "Volume differs");
         }
     }
 }