Skip to content

Commit 0959e9d

Browse files
committed
cleanup
1 parent e974227 commit 0959e9d

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

scripts/calculate_rotational_inertia.jl

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,5 @@
11
using KiteUtils
22

3-
function calculate_rotational_inertia(X::Vector, Y::Vector, Z::Vector, M::Vector, around_center_of_mass::Bool=true,
4-
rotation_point::Vector=[0, 0, 0])
5-
@assert size(X) == size(Y) == size(Z) == size(M)
6-
7-
if around_center_of_mass
8-
# First loop to determine the center of mass
9-
x_com = y_com = z_com = m_total = 0.0
10-
for (x, y, z, m) in zip(X, Y, Z, M)
11-
x_com += x * m
12-
y_com += y * m
13-
z_com += z * m
14-
m_total += m
15-
end
16-
17-
x_com = x_com / m_total
18-
y_com = y_com / m_total
19-
z_com = z_com / m_total
20-
else
21-
x_com = rotation_point[begin]
22-
y_com = rotation_point[begin+1]
23-
z_com = rotation_point[begin+2]
24-
end
25-
26-
Ixx = Ixy = Ixz = Iyy = Iyz = Izz = 0
27-
28-
# Second loop using the distance between the point and the center of mass
29-
for (x, y, z, m) in zip(X .- x_com, Y .- y_com, Z .- z_com, M)
30-
Ixx += m * (y^2 + z^2)
31-
Iyy += m * (x^2 + z^2)
32-
Izz += m * (x^2 + y^2)
33-
34-
Ixy += m * x * y
35-
Ixz += m * x * z
36-
Iyz += m * y * z
37-
end
38-
39-
Ixx, Ixy, Ixz, Iyy, Iyz, Izz
40-
end
41-
42-
433
function calculate_inertia_for_setting(settings_file::String, include_kcu::Bool=true, around_kcu::Bool=false)
444
set_data_path("data")
455
set = deepcopy(load_settings(settings_file))

0 commit comments

Comments
 (0)