]> OCCT Git - occt-copy.git/commitdiff
Workaround for clipping problem with 10K lines array. CR0-ipdmproto2
authorsan <san@opencascade.com>
Mon, 29 Dec 2014 13:29:33 +0000 (16:29 +0300)
committersan <san@opencascade.com>
Mon, 29 Dec 2014 13:29:33 +0000 (16:29 +0300)
src/Graphic3d/Graphic3d_Structure.cxx

index 83de47223f600d04972e6e7033f45d9eaef5cff3..fa110d2fb4c283855430e9e106febdf02731db53 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <Aspect_PolygonOffsetMode.hxx>
 
+#include <Precision.hxx>
+
 #include <stdio.h>
 
 //=============================================================================
@@ -122,6 +124,25 @@ void Graphic3d_Structure::CalculateBoundBox()
 {
   Graphic3d_BndBox4d aBox;
   addTransformed (aBox, Standard_True);
+
+  // Workaround for zero size components, to avoid clipping issues
+  Graphic3d_BndBox4d::BVH_VecNt aSizeVec = aBox.Size();
+  if (aSizeVec.x() < Precision::Confusion())
+  {
+    aBox.CornerMin().x() -= Precision::Confusion();
+    aBox.CornerMax().x() += Precision::Confusion();
+  }
+  if (aSizeVec.y() < Precision::Confusion())
+  {
+    aBox.CornerMin().y() -= Precision::Confusion();
+    aBox.CornerMax().y() += Precision::Confusion();
+  }
+  if (aSizeVec.z() < Precision::Confusion())
+  {
+    aBox.CornerMin().z() -= Precision::Confusion();
+    aBox.CornerMax().z() += Precision::Confusion();
+  }
+
   if (aBox.IsValid() && myCStructure->TransformPersistence.Flag == 0)
   {
     Graphic3d_Vec4 aMinPt (RealToShortReal (aBox.CornerMin().x()),