Calculates the center of 'mass' of an object. :param obj: Compute the center of mass of this object
(obj: Shape)
| 829 | |
| 830 | @staticmethod |
| 831 | def centerOfMass(obj: Shape) -> Vector: |
| 832 | """ |
| 833 | Calculates the center of 'mass' of an object. |
| 834 | |
| 835 | :param obj: Compute the center of mass of this object |
| 836 | """ |
| 837 | |
| 838 | if obj.ShapeType() == "Vertex": |
| 839 | geom_point = BRep_Tool.Pnt_s(tcast(TopoDS_Vertex, downcast(obj.wrapped))) |
| 840 | return Vector(geom_point.X(), geom_point.Y(), geom_point.Z()) |
| 841 | |
| 842 | Properties = GProp_GProps() |
| 843 | calc_function = Shape._mass_calc_function(obj) |
| 844 | |
| 845 | calc_function(obj.wrapped, Properties) |
| 846 | |
| 847 | return Vector(Properties.CentreOfMass()) |
| 848 | |
| 849 | @staticmethod |
| 850 | def CombinedCenterOfBoundBox(objects: list[Shape]) -> Vector: |
no test coverage detected