Calculates the center of a bounding box of multiple objects. :param objects: A list of objects
(objects: list[Shape])
| 848 | |
| 849 | @staticmethod |
| 850 | def CombinedCenterOfBoundBox(objects: list[Shape]) -> Vector: |
| 851 | """ |
| 852 | Calculates the center of a bounding box of multiple objects. |
| 853 | |
| 854 | :param objects: A list of objects |
| 855 | """ |
| 856 | total_mass = len(objects) |
| 857 | |
| 858 | weighted_centers = [] |
| 859 | for o in objects: |
| 860 | weighted_centers.append(BoundBox._fromTopoDS(o.wrapped).center) |
| 861 | |
| 862 | sum_wc = weighted_centers[0] |
| 863 | for wc in weighted_centers[1:]: |
| 864 | sum_wc = sum_wc.add(wc) |
| 865 | |
| 866 | return Vector(sum_wc.multiply(1.0 / total_mass)) |
| 867 | |
| 868 | def Closed(self) -> bool: |
| 869 | """ |