From fbe1a0f4e706ac07c5515f3273d5ccf445f2858f Mon Sep 17 00:00:00 2001 From: san Date: Mon, 29 Dec 2014 16:29:33 +0300 Subject: [PATCH] Workaround for clipping problem with 10K lines array. --- src/Graphic3d/Graphic3d_Structure.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index 83de47223f..fa110d2fb4 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -28,6 +28,8 @@ #include +#include + #include //============================================================================= @@ -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()), -- 2.39.5