1
0
mirror of https://gitlab.com/MisterBiggs/stl-process.git synced 2025-08-05 13:01:23 +00:00

Solid body dims

This commit is contained in:
2022-04-15 02:54:29 +00:00
parent 33ad462021
commit dd417fec64
3 changed files with 33 additions and 25 deletions

View File

@@ -53,14 +53,15 @@ end
models = Dict(
# Inertia math: https://en.wikipedia.org/wiki/List_of_moments_of_inertia#List_of_3D_inertia_tensors
# Properties(volume, center_of_gravity, inertia, surface_area, characteristic_length)
"cube.stl" => Properties(2.0^3, center, I_mat .* 2^2 / 6, 6 * 2^2, 2), # l = 2
"sphere.stl" => Properties(4 / 3 * pi, center, I_mat .* 2 / 5, 4π, 2), # r = 1
"cube.stl" => Properties(2.0^3, center, I_mat .* 2^2 / 6, 6 * 2^2, 2, [2, 2, 2]), # l = 2
"sphere.stl" => Properties(4 / 3 * pi, center, I_mat .* 2 / 5, 4π, 2, [2, 2, 2]), # r = 1
"2_4_8_cuboid.stl" => Properties(
2 * 4 * 8,
center,
diagm([2^2 + 4^2, 8^2 + 2^2, 8^2 + 4^2]) ./ 12,
2(2 * 4 + 2 * 8 + 4 * 8),
(2 + 4 + 8) / 3,
[2, 4, 8],
), # h, d, w = 2, 4, 8
# "slender_y.stl" => Properties(
# 10 * π * 0.1^2,
@@ -89,6 +90,7 @@ end
@test eigvals(props.inertia) eigvals(control.inertia) atol = 0.1
@test props.surface_area control.surface_area atol = 0.5
@test props.characteristic_length control.characteristic_length atol = 0.5
@test props.sb_values control.sb_values atol = 0.01
end
@testset "Compare volumes with scaling for $model" begin
for scale in 1:4