Skip to content

Julia package for calculating inertia parameters for simple shapes and for more complex objects made out of multiple simple shapes

License

Notifications You must be signed in to change notification settings

TomRottier/Inertia.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inertia.jl

Julia package for calculating inertia of geometric solids.

Installation

  pkg> add Inertia

Usage

using Inertia

Example

# create two solids
l = 1.0
w = 2.0
h = 3.0
m = 0.1
cuboid1 = Cuboid(l,w,h,m) # length, width, height, mass
cuboid2 = Cuboid(l,w,h,m)

# centre of mass of each solid
r1 = [-l/2, 0, 0]
r2 = [ l/2, 0, 0]

# rotation of each solid
R = [1 0 0; 0 0 -1; 0 1 0] # each rotated by 90 degrees about x axis

# group into vectors
solids = [cuboid1, cuboid2]
Rs = fill(R, 2)
rs = [r1, r2]

# centre of mass of whole system
com = centre_of_mass(solids, rs)

# combined inertia about combined centre of mass
moi = calculate_inertia(solids, Rs, rs, com)

# check combined inertia is equal to that of cuboid with double the length, double the mass and rotated by 90 degrees about x axis
moi == Cuboid(2l, h, w, 2m).moi

About

Julia package for calculating inertia parameters for simple shapes and for more complex objects made out of multiple simple shapes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages