Moment of inertia and length calculation