Skip to content

Commit 3632076

Browse files
committed
little improvements in massPropertiesComputation.jl
1 parent ad415d2 commit 3632076

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Composition/massPropertiesComputation.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,28 @@ function addOrSubtractMassPropertiesOfChildToRoot!(obj_root::Object3D{F}, obj_ch
8787
I_root = obj_root.I_CM
8888

8989
# transform childs center of mass to parents coordinate system
90-
rCM_child_new = r_child + R_child' * rCM_child
90+
rCM_child_new::SVector{3,F} = r_child + R_child' * rCM_child
9191

9292
# I_child_steiner: I_child needs to be transformed to parents coordinate system
9393
# I_root_steiner: I_root needs to be transformed to parents coordinate system
9494
# (no need of rotation matrices)
95-
I_child_steiner = Modia3D.NullRotation(F) * I_child * Modia3D.NullRotation(F)' +
95+
I_child_steiner::SMatrix{3,3,F,9} = Modia3D.NullRotation(F) * I_child * Modia3D.NullRotation(F)' +
9696
m_child * Modia3D.skew(rCM_child_new)' * Modia3D.skew(rCM_child_new)
97-
I_root_steiner = I_root +
97+
I_root_steiner::SMatrix{3,3,F,9} = I_root +
9898
m_root * Modia3D.skew(rCM_root)' * Modia3D.skew(rCM_root)
9999

100100
if add
101101
# ----------- adding mass properties (parent + child) ----------------------
102102
# common mass (parent + child)
103-
m = m_root + m_child
103+
m = F(m_root + m_child)
104104

105105
# common center of mass (parent + child)
106106
@assert(m > 0.0)
107-
rCM = (m_root * rCM_root + m_child * rCM_child_new)/m
107+
rCM::SVector{3,F} = (m_root * rCM_root + m_child * rCM_child_new)/m
108108

109109
# I: substract new common mass multiplied with skew matrices of
110110
# center of mass from the sum of I_root_steiner and I_child_steiner
111-
I = I_root_steiner + I_child_steiner - m * Modia3D.skew(rCM)' * Modia3D.skew(rCM)
111+
I::SMatrix{3,3,F,9} = I_root_steiner + I_child_steiner - m * Modia3D.skew(rCM)' * Modia3D.skew(rCM)
112112

113113
# Assign to obj_root
114114
obj_root.m = m

0 commit comments

Comments
 (0)