OCC boundding box 以及 distance

bounding box 方式检测

#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>

TopoDS_Shape shape1, shape2; // Assume these shapes are already defined
Bnd_Box boundingBox1, boundingBox2;

BRepBndLib::Add(shape1, boundingBox1);
BRepBndLib::Add(shape2, boundingBox2);

bool isInterfering = !boundingBox1.IsOut(boundingBox2);

distance 方式检测

#include <BRepExtrema_DistShapeShape.hxx>

BRepExtrema_DistShapeShape distShapeShape(shape1, shape2);
Standard_Real minDistance = distShapeShape.Value();
bool isInterfering = (minDistance <= Precision::Confusion());
  • BRepExtrema_DistShapeShapebounding box 方式费时;
  • 如果bouding box方式检测出来出现干涉(interference, overlap),则可以使用distance检测方式确认;



    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • 在Ubuntu上部署OpenMAIC
  • AI工具大全
  • Fast DDS入门(On-Going)
  • NVIDIA GPU 架构:SP、SM 与 LSU 工作原理详解
  • al-folio 模板定制修改总结