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

Method matrixOfInertia

cadquery/occ_impl/shapes.py:738–752  ·  view source on GitHub ↗

Calculates the matrix of inertia of an object. Since the part's density is unknown, this result is inertia/density with units of [1/length]. :param obj: Compute the matrix of inertia of this object

(obj: Shape)

Source from the content-addressed store, hash-verified

736
737 @staticmethod
738 def matrixOfInertia(obj: Shape) -> list[list[float]]:
739 """
740 Calculates the matrix of inertia of an object.
741 Since the part's density is unknown, this result is inertia/density with units of [1/length].
742 :param obj: Compute the matrix of inertia of this object
743 """
744 Properties = GProp_GProps()
745 calc_function = shape_properties_LUT[shapetype(obj.wrapped)]
746
747 if calc_function:
748 calc_function(obj.wrapped, Properties)
749 moi = Properties.MatrixOfInertia()
750 return [[moi.Value(i, j) for j in range(1, 4)] for i in range(1, 4)]
751
752 raise NotImplementedError
753
754 def Center(self) -> Vector:
755 """

Calls 1

shapetypeFunction · 0.85

Tested by 2

testMatrixOfInertiaMethod · 0.64