0033009: Foundation Classes - Bnd_OBB::ReBuild() expects point array starting from 0
authorakondrat <akondrat@opencascade.com>
Fri, 10 Jun 2022 11:33:15 +0000 (14:33 +0300)
committerafokin <afokin@opencascade.com>
Tue, 14 Jun 2022 18:50:31 +0000 (21:50 +0300)
Add test. Update OBBTool constructor for any bounds of array of points.

src/Bnd/Bnd_OBB.cxx
src/QABugs/QABugs_20.cxx
tests/bugs/moddata_3/bug33009 [new file with mode: 0644]

index e723464cb94f2497ae367a8583aa514e3d551aa1..637edf26a0749bbfd255bcb16a78eb7de6c61254 100644 (file)
@@ -419,7 +419,7 @@ OBBTool::
     myPointBoxSet->SetSize(myPntsList.Length());
 
     // Add the points into Set
-    for (Standard_Integer iP = 0; iP < theL.Length(); ++iP)
+    for (Standard_Integer iP = theL.Lower(); iP <= theL.Upper(); ++iP)
     {
       const gp_Pnt& aP = theL (iP);
       Standard_Real aTol = theLT ? theLT->Value(iP) : Precision::Confusion();
index 59b2ab1db4c25281dcaf61ad7f8ea2b9641f8cb4..c16b32d3e35e5b95b64436b32f384cdcbd716acd 100644 (file)
@@ -4257,6 +4257,23 @@ static Standard_Integer OCC32744(Draw_Interpretor& theDi, Standard_Integer theNb
   return 0;
 }
 
+static Standard_Integer OCC33009(Draw_Interpretor&, Standard_Integer, const char**)
+{
+  Bnd_OBB aBndBox;
+
+  TColgp_Array1OfPnt aPoints(1, 5);
+
+  aPoints.ChangeValue(1) = gp_Pnt(1, 2, 3);
+  aPoints.ChangeValue(2) = gp_Pnt(3, 2, 1);
+  aPoints.ChangeValue(3) = gp_Pnt(2, 3, 1);
+  aPoints.ChangeValue(4) = gp_Pnt(1, 3, 2);
+  aPoints.ChangeValue(5) = gp_Pnt(2, 1, 3);
+
+  aBndBox.ReBuild(aPoints, (const TColStd_Array1OfReal*)0, true);
+
+  return 0;
+}
+
 //=======================================================================
 //function : QACheckBends
 //purpose :
@@ -4427,6 +4444,10 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
                   __FILE__,
                   OCC32744, group);
 
+  theCommands.Add("OCC33009", 
+                 "Tests the case when", 
+                 __FILE__, OCC33009, group);
+
   theCommands.Add("QACheckBends",
     "QACheckBends curve [CosMaxAngle [theNbPoints]]",
     __FILE__,
diff --git a/tests/bugs/moddata_3/bug33009 b/tests/bugs/moddata_3/bug33009
new file mode 100644 (file)
index 0000000..9b0c272
--- /dev/null
@@ -0,0 +1,7 @@
+puts "============================================================================================="
+puts "0033009: Foundation Classes - Bnd_OBB::ReBuild() expects point array starting from 0"
+puts "============================================================================================="
+puts ""
+
+pload QAcommands
+OCC33009