Fix CMy & CMz of rail button and launch lug
This commit is contained in:
parent
7ff01c3b4f
commit
dceed80dff
@ -228,9 +228,12 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Coordinate getComponentCG() {
|
public Coordinate getComponentCG() {
|
||||||
|
final double parentRadius = parent instanceof SymmetricComponent ?
|
||||||
|
((SymmetricComponent) parent).getRadius(getAxialOffset()) : 0;
|
||||||
|
|
||||||
final double CMx = length / 2 + (instanceSeparation * (instanceCount-1)) / 2;
|
final double CMx = length / 2 + (instanceSeparation * (instanceCount-1)) / 2;
|
||||||
final double CMy = Math.cos(this.angleOffsetRad)*getOuterRadius();
|
final double CMy = Math.cos(this.angleOffsetRad) * (parentRadius + getOuterRadius());
|
||||||
final double CMz = Math.sin(this.angleOffsetRad)*getOuterRadius();
|
final double CMz = Math.sin(this.angleOffsetRad) * (parentRadius + getOuterRadius());
|
||||||
return new Coordinate(CMx, CMy, CMz, getComponentMass());
|
return new Coordinate(CMx, CMy, CMz, getComponentMass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,14 +381,16 @@ public class RailButton extends ExternalComponent implements AnglePositionable,
|
|||||||
final double flangeCM = this.totalHeight_m - getFlangeHeight()/2;
|
final double flangeCM = this.totalHeight_m - getFlangeHeight()/2;
|
||||||
final double screwCM = this.totalHeight_m + 4 * this.screwHeight_m / (3 * Math.PI);
|
final double screwCM = this.totalHeight_m + 4 * this.screwHeight_m / (3 * Math.PI);
|
||||||
final double heightCM = (massBase*baseCM + massInner*innerCM + massFlange*flangeCM + massScrew*screwCM)/totalMass;
|
final double heightCM = (massBase*baseCM + massInner*innerCM + massFlange*flangeCM + massScrew*screwCM)/totalMass;
|
||||||
|
final double parentRadius = parent instanceof SymmetricComponent ?
|
||||||
|
((SymmetricComponent) parent).getRadius(getAxialOffset()) : 0;
|
||||||
|
|
||||||
if (heightCM > this.totalHeight_m + this.screwHeight_m) {
|
if (heightCM > this.totalHeight_m + this.screwHeight_m) {
|
||||||
throw new BugException(" bug found while computing the CG of a RailButton: "+this.getName()+"\n height of CG: "+heightCM);
|
throw new BugException(" bug found while computing the CG of a RailButton: "+this.getName()+"\n height of CG: "+heightCM);
|
||||||
}
|
}
|
||||||
|
|
||||||
final double CMx = (instanceSeparation * (instanceCount-1)) / 2;
|
final double CMx = (instanceSeparation * (instanceCount-1)) / 2;
|
||||||
final double CMy = Math.cos(this.angleOffsetRad)*heightCM;
|
final double CMy = Math.cos(this.angleOffsetRad) * (parentRadius + heightCM);
|
||||||
final double CMz = Math.sin(this.angleOffsetRad)*heightCM;
|
final double CMz = Math.sin(this.angleOffsetRad) * (parentRadius + heightCM);
|
||||||
|
|
||||||
return new Coordinate( CMx, CMy, CMz, getComponentMass());
|
return new Coordinate( CMx, CMy, CMz, getComponentMass());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user