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

tests and stuff

This commit is contained in:
2022-03-29 00:09:41 -07:00
parent edcb2ef46f
commit 95889a52ce
7 changed files with 288 additions and 41 deletions

View File

@@ -3,10 +3,18 @@ module stlProcess
using MeshIO
using FileIO
using LinearAlgebra
struct Properties
volume::Float64
center_of_gravity::Vector{Float64}
inertia::Matrix{Float64}
stl = load(raw"C:\Users\albig\Downloads\cubeblender.stl")
# stl = load(raw"C:\Coding\stl_read\3DBenchy.stl")
function Properties(volume, center_of_gravity, inertia)
@assert size(center_of_gravity) == (3,)
@assert size(inertia) == (3, 3)
return new(volume, center_of_gravity, inertia)
end
end
function get_mass_properties(triangles)
"""
@@ -65,15 +73,9 @@ function get_mass_properties(triangles)
inertia[2, 3] = inertia[3, 2] = -(intg[9] - volume .* center_of_gravity[2] .* center_of_gravity[3])
inertia[1, 3] = inertia[3, 1] = -(intg[10] - volume .* center_of_gravity[3] .* center_of_gravity[1])
return volume, center_of_gravity, inertia
return Properties(volume, center_of_gravity, inertia)
end
v, cog, inertia = get_mass_properties(stl)
v
cog
inertia
eigen(inertia)
export get_mass_properties
end # module