def shift_com_inertia_3x3(mass, com, inertia_com, ref_point=mathutils.Vector((0.0, ) * 3)): """Shifts the center This code was adapted from an implementation generously provided by Bertold Bongardt. shift inertia matrix, steiner theorem / parallel axis theorem, private method - without changing the orientation - see SCISIC B.12 or featherstone 2.63, but not Selig (sign swap, not COG) c = COG - O I_O = I_COG + m · c× (c× )T changed the formula to (Wikipedia): \mathbf{J} = \mathbf{I} + m \left[\left(\mathbf{R} \cdot \mathbf{R}\right) \mathbf{E}_{3} - \mathbf{R} \otimes \mathbf{R} \right], This was necessary as previous calculations founded on math libraries of cad2sim. """ c = com - ref_point # difference vector c_outer = gUtils.outerProduct(c, c) inertia_ref = inertia_com + mass * ( c.dot(c) * mathutils.Matrix.Identity(3) - c_outer) return inertia_ref
def shift_cog_inertia_3x3(mass, cog, inertia_cog, ref_point=mathutils.Vector((0.0, ) * 3)): """ shift inertia matrix, steiner theorem / parallel axis theorem, private method - without changing the orientation - see SCISIC B.12 or featherstone 2.63, but not Selig (sign swap, not COG) c = COG - O I_O = I_COG + m · c× (c× )T changed the formula to (Wikipedia): \mathbf{J} = \mathbf{I} + m \left[\left(\mathbf{R} \cdot \mathbf{R}\right) \mathbf{E}_{3} - \mathbf{R} \otimes \mathbf{R} \right], This was necessary as previous calculations founded on math libraries of cad2sim. """ # diff_vec c = cog - ref_point c_outer = generalUtils.outerProduct(c, c) inertia_ref = inertia_cog + mass * ( c.dot(c) * mathutils.Matrix.Identity(3) - c_outer) return inertia_ref
def shift_cog_inertia_3x3(mass, cog, inertia_cog, ref_point=mathutils.Vector((0.0,)*3)): """ shift inertia matrix, steiner theorem / parallel axis theorem, private method - without changing the orientation - see SCISIC B.12 or featherstone 2.63, but not Selig (sign swap, not COG) c = COG - O I_O = I_COG + m · c× (c× )T changed the formula to (Wikipedia): \mathbf{J} = \mathbf{I} + m \left[\left(\mathbf{R} \cdot \mathbf{R}\right) \mathbf{E}_{3} - \mathbf{R} \otimes \mathbf{R} \right], This was necessary as previous calculations founded on math libraries of cad2sim. """ # diff_vec c = cog - ref_point c_outer = generalUtils.outerProduct(c, c) inertia_ref = inertia_cog + mass * (c.dot(c) * mathutils.Matrix.Identity(3) - c_outer) return inertia_ref
def shift_com_inertia_3x3(mass, com, inertia_com, ref_point=mathutils.Vector((0.0,) * 3)): """Shifts the center of mass of a 3x3 inertia. This code was adapted from an implementation generously provided by Bertold Bongardt. TODO cleanup docstring shift inertia matrix, steiner theorem / parallel axis theorem, private method - without changing the orientation - see SCISIC B.12 or featherstone 2.63, but not Selig (sign swap, not COG) | c = COG - O | I_O = I_COG + m · c× (c× )T | | changed the formula to (Wikipedia): | \\mathbf{J} = \\mathbf{I} + m \\left[\\left(\\mathbf{R} \\cdot \\mathbf{R}\\right) | \\mathbf{E}_{3} - \\mathbf{R} \\otimes \\mathbf{R} \\right], This was necessary as previous calculations founded on math libraries of cad2sim. Args: mass: com: inertia_com: ref_point: (Default value = mathutils.Vector((0.0) ) * 3): Returns: """ c = com - ref_point # difference vector c_outer = gUtils.outerProduct(c, c) inertia_ref = inertia_com + mass * (c.dot(c) * mathutils.Matrix.Identity(3) - c_outer) return inertia_ref