Update geometry check for new next/prev comp behavior

This commit is contained in:
SiboVG 2023-02-22 00:56:06 +01:00
parent 074fee3663
commit 5be3e381e7
2 changed files with 17 additions and 4 deletions

View File

@ -380,6 +380,20 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
}
}
} else {
/*
It could be that the component is a child of a PodSet or ParallelStage, and it is flush with
the previous component. In this case, the component is overlapping.
*/
RocketComponent prevCompParent = prevComp.getParent();
RocketComponent compParent = comp.getParent();
int prevCompPos = prevCompParent.getChildPosition(prevComp);
RocketComponent nextComp = prevCompPos + 1 >= prevCompParent.getChildCount() ?
null : prevCompParent.getChild(prevCompPos + 1);
if ((compParent instanceof PodSet || compParent instanceof ParallelStage) &&
MathUtil.equals(symXfore, prevXaft) && (compParent.getParent() == nextComp)) {
warnings.add(Warning.PODSET_OVERLAP, comp.getParent().toString());
}
}
}
prevComp = sym;

View File

@ -482,20 +482,19 @@ public class BarrowmanCalculatorTest {
// move the pod back.
pod.setAxialOffset(pod.getAxialOffset() + 0.1);
testCP = testCalc.getCP(testConfig, testConditions, warnings).x;
assertFalse("should be warning from gap in airframe", warnings.isEmpty());
assertEquals("should be warning from gap in airframe", 1, warnings.size());
// move the pod forward.
warnings.clear();
pod.setAxialOffset(pod.getAxialOffset() - 0.3);
testCP = testCalc.getCP(testConfig, testConditions, warnings).x;
assertFalse("should be warning from airframe overlap", warnings.isEmpty());
assertEquals("should be warning from airframe overlap", 1, warnings.size());
// move the pod back.
warnings.clear();
pod.setAxialOffset(pod.getAxialOffset() + 0.1);
TestRockets.dumpRocket(testRocket, "/Users/SiboVanGool/Downloads/sfs/test.ork");
testCP = testCalc.getCP(testConfig, testConditions, warnings).x;
assertFalse("should be warning from airframe overlap", warnings.isEmpty());
assertEquals("should be warning from podset airframe overlap", 1, warnings.size());
}
}