def bndBox_is_interfered(shp1, shp2): brepbnd = brepbndlib() bndBox1 = Bnd_Box() bndBox2 = Bnd_Box() brepbnd.Add(shp1, bndBox1) brepbnd.Add(shp2, bndBox2) return not (bndBox1.IsOut(bndBox2))
def point_in_boundingbox(solid, pnt, tolerance=1e-5): """returns True if *pnt* lies in *boundingbox*, False if not this is a much speedier test than checking the TopoDS_Solid Args: solid TopoDS_Solid pnt: gp_Pnt Returns: bool """ bbox = Bnd_Box() bbox.SetGap(tolerance) brepbndlib_Add(solid, bbox) return not bbox.IsOut(pnt)
def test_bndBox(): # simple interference check through bounding box shp = read_step_file("/home/lenty/exchange/tempData/models/lf064-01.stp") brepbnd = brepbndlib() bndBox = Bnd_Box() # display = Display(shp, run_display=True) brepbnd.Add(shp, bndBox) p1 = gp_Pnt(55, 30, 7) print(bndBox.IsOut(p1)) b3f = Bnd_B3f() p2 = gp_Pnt(0, 0, 0) b3f.Add(p2) print(b3f.IsOut(gp_XYZ(0, 0, 1))) ipdb.set_trace() print(b3f.IsOut(gp_Pnt(0, 0, 1)))