MCPcopy Create free account
hub / github.com/DLR-RM/BlenderProc / bb_ratio

Method bb_ratio

blenderproc/python/object/ObjectReplacer.py:89–99  ·  view source on GitHub ↗

Rough estimation of the ratios between two bounding boxes sides, not axis aligned :param bb1: bounding box 1. Type: float multi-dimensional array of 8 * 3. :param bb2: bounding box 2. Type: float multi-dimensional array of 8 * 3. :return: the ratio between each side of the

(bb1: np.ndarray, bb2: np.ndarray)

Source from the content-addressed store, hash-verified

87
88 @staticmethod
89 def bb_ratio(bb1: np.ndarray, bb2: np.ndarray) -> list:
90 """ Rough estimation of the ratios between two bounding boxes sides, not axis aligned
91
92 :param bb1: bounding box 1. Type: float multi-dimensional array of 8 * 3.
93 :param bb2: bounding box 2. Type: float multi-dimensional array of 8 * 3.
94 :return: the ratio between each side of the bounding box. Type: a list of floats.
95 """
96 ratio_a = (bb1[0, 0] - bb1[4, 0]) / (bb2[0, 0] - bb2[4, 0])
97 ratio_b = (bb1[0, 1] - bb1[3, 1]) / (bb2[0, 1] - bb2[3, 1])
98 ratio_c = (bb1[0, 2] - bb1[1, 2]) / (bb2[0, 2] - bb2[1, 2])
99 return [ratio_a, ratio_b, ratio_c]
100
101 @staticmethod
102 def replace(obj_to_remove: MeshObject, obj_to_add: MeshObject,

Callers 1

replaceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected