1
0
mirror of https://gitlab.com/MisterBiggs/stl-process.git synced 2025-08-03 20:11:31 +00:00

added scaling tests

This commit is contained in:
2022-03-30 21:33:49 -07:00
parent d137eb4050
commit 04e7fef7ad

View File

@@ -17,16 +17,24 @@ using LinearAlgebra
cube_path = raw"test_assets\cubeblender.stl"
stl = load(cube_path)
@testset "get_mass_properties" begin
@testset "get_mass_properties function" begin
props = get_mass_properties(stl)
@test props.volume == 8.0
@test all(props.center_of_gravity .== 0.0)
@test all(eigvals(props.inertia) .≈ (5.0 + 1 / 3))
@testset "get_volume" begin
@testset "get_volume function" begin
@test get_volume(stl; scale=1) props.volume rtol = 0.01
@test get_volume(stl; scale=4) (4 * 2)^3 rtol = 0.01
end
end
@testset "Compare volumes with scaling" begin
for scale in 1:5
props = get_mass_properties(stl; scale=scale)
volume = get_volume(stl; scale=scale)
@test props.volume volume rtol = 0.01
end
end
end