]> OCCT Git - occt.git/commitdiff
Visualization - AIS_Shape bounding box re-computation is not working properly #422
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sun, 9 Mar 2025 00:07:17 +0000 (00:07 +0000)
committerdpasukhi <dpasukhi@opencascade.com>
Mon, 19 May 2025 21:18:10 +0000 (22:18 +0100)
Fixed issue with bounding box cleaning algorithm that was causing the bounding box to be only increased.
Now the bounding box is increased and decreased to fit the shape.

src/AIS/AIS_Shape.cxx
tests/v3d/bugs/bug_gh421 [new file with mode: 0644]

index c734d11a63bf2b624e60846202be0c4fb719b36d..065e01be9c2912bc7f0d70b149bc326f954ea29b 100644 (file)
@@ -735,6 +735,8 @@ const Bnd_Box& AIS_Shape::BoundingBox()
 
   if (myCompBB)
   {
+    // Clear the bounding box to re-compute it.
+    myBB.SetVoid();
     BRepBndLib::Add(myshape, myBB, false);
     myCompBB = Standard_False;
   }
diff --git a/tests/v3d/bugs/bug_gh421 b/tests/v3d/bugs/bug_gh421
new file mode 100644 (file)
index 0000000..183eecb
--- /dev/null
@@ -0,0 +1,20 @@
+puts "============"
+puts "Visualization - Bounding box is not decreasing for mode 2 #421"
+puts "============"
+puts ""
+
+pload MODELING VISUALIZATION
+vclear
+
+box b 100 200 300
+vinit View1
+vdisplay b -dispMode 2
+# OK
+box b 10 200 300
+vdisplay b -dispMode 2
+
+vfit
+
+checkcolor 243 2 0 0 0
+
+vdump $::imagedir/${::casename}.png