// =======================================================================
void Bnd_OBB::Add(const gp_Pnt& theP)
{
- gp_Pnt aList[9];
- GetVertex(aList);
- aList[8] = theP;
-
- ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
+ if (IsVoid())
+ {
+ myCenter = theP.XYZ();
+ myAxes[0] = gp::DX().XYZ();
+ myAxes[1] = gp::DY().XYZ();
+ myAxes[2] = gp::DZ().XYZ();
+ myHDims[0] = 0.0;
+ myHDims[1] = 0.0;
+ myHDims[2] = 0.0;
+ myIsAABox = Standard_True;
+ }
+ else
+ {
+ gp_Pnt aList[9];
+ GetVertex(aList);
+ aList[8] = theP;
+ ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
+ }
}
// =======================================================================
// =======================================================================
void Bnd_OBB::Add(const Bnd_OBB& theOther)
{
- gp_Pnt aList[16];
- GetVertex(&aList[0]);
- theOther.GetVertex(&aList[8]);
- ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
+ if (!theOther.IsVoid())
+ {
+ if (IsVoid())
+ {
+ myCenter = theOther.myCenter;
+ myAxes[0] = theOther.myAxes[0];
+ myAxes[1] = theOther.myAxes[1];
+ myAxes[2] = theOther.myAxes[2];
+ myHDims[0] = theOther.myHDims[0];
+ myHDims[1] = theOther.myHDims[1];
+ myHDims[2] = theOther.myHDims[2];
+ myIsAABox = theOther.myIsAABox;
+ }
+ else
+ {
+ gp_Pnt aList[16];
+ GetVertex(&aList[0]);
+ theOther.GetVertex(&aList[8]);
+ ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
+ }
+ }
}
return 0;
}
+#include <BRepPrimAPI_MakeBox.hxx>
+static Standard_Integer OCC30704(Draw_Interpretor& di, Standard_Integer, const char**)
+{
+ // Make a shape somewhere far from (0, 0, 0).
+ BRepPrimAPI_MakeBox mkBox(gp_Pnt(100, 100, 100), 100, 100, 100);
+ const TopoDS_Shape& box = mkBox.Shape();
+
+ // Add a bounding box of a shape to a void bounding box.
+ Bnd_OBB aVoidBox, aBox;
+ BRepBndLib::AddOBB(box, aBox, Standard_False, Standard_False, Standard_False);
+ aVoidBox.Add(aBox);
+
+ // Print the center point of the bounding box.
+ const gp_XYZ& center = aVoidBox.Center();
+ di << center.X() << " " << center.Y() << " " << center.Z();
+ return 0;
+}
+static Standard_Integer OCC30704_1(Draw_Interpretor& di, Standard_Integer, const char**)
+{
+ // A point.
+ gp_Pnt aP(100, 200, 300);
+
+ // Add the point to a void bounding box.
+ Bnd_OBB aVoidBox;
+ aVoidBox.Add(aP);
+
+ // Print the center point of the bounding box.
+ const gp_XYZ& center = aVoidBox.Center();
+ di << center.X() << " " << center.Y() << " " << center.Z();
+ return 0;
+}
+
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
"Usage: OCC30869 wire",
__FILE__, OCC30869, group);
+ theCommands.Add("OCC30704", "OCC30704", __FILE__, OCC30704, group);
+ theCommands.Add("OCC30704_1", "OCC30704_1", __FILE__, OCC30704_1, group);
+
return;
}