Don't include shoulders in CG calculation for applying parallel axis theorem to longitudinal inertia, as they aren't included in calculation of longitudinal inertia itself.
This commit is contained in:
parent
1f55a0b27c
commit
bcdf32ecba
@ -281,14 +281,25 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
|
||||
|
||||
/**
|
||||
* Calculate CG of the component by integrating over the length of the component.
|
||||
* The method caches the result, so subsequent calls are instant. Subclasses may
|
||||
* Return the CG and mass of the component. Subclasses may
|
||||
* override this method for simple shapes and use this method as necessary.
|
||||
*
|
||||
* @return The CG+mass of the component.
|
||||
*/
|
||||
@Override
|
||||
public Coordinate getComponentCG() {
|
||||
return getSymmetricComponentCG();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate CG of the symmetric component by integrating over the length of the component.
|
||||
* The method caches the result, so subsequent calls are instant. We need this method because subclasses
|
||||
* override getComponentCG() and include mass of shoulders
|
||||
*
|
||||
* @return The CG+mass of the component.
|
||||
*/
|
||||
|
||||
private Coordinate getSymmetricComponentCG() {
|
||||
if (cg == null)
|
||||
integrate();
|
||||
return cg;
|
||||
@ -491,7 +502,7 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
longitudinalInertia /= vol;
|
||||
|
||||
// Shift longitudinal inertia to CG
|
||||
longitudinalInertia = Math.max(longitudinalInertia - pow2(getComponentCG().x), 0);
|
||||
longitudinalInertia = longitudinalInertia - pow2(getSymmetricComponentCG().x);
|
||||
}
|
||||
|
||||
|
||||
@ -548,7 +559,7 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
rotationalInertia /= surface;
|
||||
|
||||
// Shift longitudinal inertia to CG
|
||||
longitudinalInertia = Math.max(longitudinalInertia - pow2(getComponentCG().x), 0);
|
||||
longitudinalInertia = longitudinalInertia - pow2(getSymmetricComponentCG().x);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user