Minor fixes to RASAero importing

This commit is contained in:
SiboVG 2023-02-12 17:33:44 +00:00
parent 79090ee009
commit c831ee8ed4
2 changed files with 10 additions and 6 deletions

View File

@ -193,8 +193,8 @@ public class RASAeroCommonConstants {
} else if (CROSS_SECTION_SUBSONIC_NACA.equals(crossSection)) { } else if (CROSS_SECTION_SUBSONIC_NACA.equals(crossSection)) {
return FinSet.CrossSection.AIRFOIL; return FinSet.CrossSection.AIRFOIL;
} else { } else {
warnings.add("Unknown fin cross section: " + crossSection + ", defaulting to square."); warnings.add("Unknown fin cross section: " + crossSection + ", defaulting to Airfoil.");
return FinSet.CrossSection.SQUARE; return FinSet.CrossSection.AIRFOIL;
} }
} }
@ -218,7 +218,7 @@ public class RASAeroCommonConstants {
} else if (FINISH_CAST_IRON.equals(surfaceFinish)) { } else if (FINISH_CAST_IRON.equals(surfaceFinish)) {
return ExternalComponent.Finish.ROUGHUNFINISHED; return ExternalComponent.Finish.ROUGHUNFINISHED;
} else { } else {
warnings.add("Unknown surface finish: " + surfaceFinish + ", defaulting to regular paint."); warnings.add("Unknown surface finish: " + surfaceFinish + ", defaulting to Regular Paint.");
return ExternalComponent.Finish.NORMAL; return ExternalComponent.Finish.NORMAL;
} }
} }

View File

@ -37,12 +37,16 @@ public abstract class RailGuideHandler {
buttonFore.setAxialOffset(0.0254); // 1 inch separation buttonFore.setAxialOffset(0.0254); // 1 inch separation
buttonAft.setAxialOffset(-0.0254 + buttonAft.getOuterDiameter()/2); // 1 inch separation buttonAft.setAxialOffset(-0.0254 + buttonAft.getOuterDiameter()/2); // 1 inch separation
// Calculate the angle offset of the launch lugs // Calculate the angle offset of the rail guides
// Don't ask me how I got this formula... I don't know what the hell RASAero is doing here. // Don't ask me how I got this formula... I don't know what the hell RASAero is doing here.
// Just experimentally measured the right offsets, it seems to work okay. // Just experimentally measured the right offsets, it seems to work okay.
double r = diameter / 2; double H = buttonFore.getTotalHeight();
double D = buttonFore.getOuterDiameter();
double R = parent.getOuterRadius(); double R = parent.getOuterRadius();
double rot = -Math.acos((0.6616*R - r) / (R+r)); double rot = -Math.acos((D - 1.3232*R)/(D - 2*H - 2*R)); // This is not an exact solution for all cases, but it is for the most common case
if (Double.isNaN(rot)) { // Just to be safe :)
rot = 0;
}
buttonFore.setAngleOffset(rot); buttonFore.setAngleOffset(rot);
buttonAft.setAngleOffset(rot); buttonAft.setAngleOffset(rot);