MCPcopy
hub / github.com/CadQuery/cadquery / findOutsideBox2D

Method findOutsideBox2D

cadquery/occ_impl/geom.py:953–980  ·  view source on GitHub ↗

Compares bounding boxes Compares bounding boxes. Returns none if neither is inside the other. Returns the outer one if either is outside the other. BoundBox.isInside works in 3d, but this is a 2d bounding box, so it doesn't work correctly plus, there was all kinds o

(bb1: "BoundBox", bb2: "BoundBox")

Source from the content-addressed store, hash-verified

951
952 @staticmethod
953 def findOutsideBox2D(bb1: "BoundBox", bb2: "BoundBox") -> Optional["BoundBox"]:
954 """Compares bounding boxes
955
956 Compares bounding boxes. Returns none if neither is inside the other.
957 Returns the outer one if either is outside the other.
958
959 BoundBox.isInside works in 3d, but this is a 2d bounding box, so it
960 doesn't work correctly plus, there was all kinds of rounding error in
961 the built-in implementation i do not understand.
962 """
963
964 if (
965 bb1.xmin < bb2.xmin
966 and bb1.xmax > bb2.xmax
967 and bb1.ymin < bb2.ymin
968 and bb1.ymax > bb2.ymax
969 ):
970 return bb1
971
972 if (
973 bb2.xmin < bb1.xmin
974 and bb2.xmax > bb1.xmax
975 and bb2.ymin < bb1.ymin
976 and bb2.ymax > bb1.ymax
977 ):
978 return bb2
979
980 return None
981
982 @classmethod
983 def _fromTopoDS(

Callers 1

testBasicBoundingBoxMethod · 0.80

Calls

no outgoing calls

Tested by 1

testBasicBoundingBoxMethod · 0.64