create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / util / Inertia.java
1 package net.sf.openrocket.util;
2
3 import static net.sf.openrocket.util.MathUtil.pow2;
4 public final class Inertia {
5
6         private Inertia() {
7         }
8         
9         
10         /**
11          * Return the rotational unit moment of inertia of a solid cylinder.
12          * 
13          * @param radius        the radius of the cylinder.
14          */
15         public static double filledCylinderRotational(double radius) {
16                 return pow2(radius) / 2;
17         }
18         
19         /**
20          * Return the longitudinal unit moment of inertia of a solid cylinder,
21          * relative to the midpoint lengthwise.
22          * 
23          * @param radius        the radius of the cylinder.
24          * @param length        the total length of the cylinder (reference at midpoint)
25          */
26         public static double filledCylinderLongitudinal(double radius, double length) {
27                 return (3*pow2(radius) + pow2(length))/12;
28         }
29         
30         
31         /**
32          * Return the unit moment of inertia that is shifted from the CG of an object
33          * by a specified distance.  The rotation axis are parallel.
34          * 
35          * @param cgInertia             the unit moment of inertia through the CG of the object
36          * @param distance              the distance to shift the rotation axis
37          */
38         public static double shift(double cgInertia, double distance) {
39                 return cgInertia + pow2(distance);
40         }
41         
42 }