From ab61562590d0ed047931ad3ada10d896e817884c Mon Sep 17 00:00:00 2001 From: TomRottier <39778698+TomRottier@users.noreply.github.com> Date: Sat, 29 Oct 2022 17:51:01 +0100 Subject: [PATCH] Create README.md --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d490634 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# Inertia.jl +Julia package for calculating inertia parameters geometric solids. + +## Installation +```julia + pkg> add Inertia +``` + +## Usage +```julia +using Inertia +``` + +### Example +```julia + +# 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 + +```