In FinSetCalc.calculateFinGeometry(), make sure x coordinates of interections
between lines defining fins and strips being used to estimate geometry aren't beyond bounds of fin.
This commit is contained in:
parent
08f49d6a04
commit
99bdf71ba8
@ -293,8 +293,15 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
|
|
||||||
for (int i = i1; i <= i2; i++) {
|
for (int i = i1; i <= i2; i++) {
|
||||||
// Intersection point (x,y)
|
// Intersection point (x,y)
|
||||||
|
// Note that y can be outside the bounds of the line
|
||||||
|
// defined by (x1, y1) (x2 y2) so x can similarly be outside
|
||||||
|
// the bounds. If the line is nearly horizontal, it can be
|
||||||
|
// 'way outside. We want to get the whole "strip", so we
|
||||||
|
// don't clamp y; however, we do clamp x to avoid numerical
|
||||||
|
// instabilities
|
||||||
double y = i * span / (DIVISIONS - 1);
|
double y = i * span / (DIVISIONS - 1);
|
||||||
double x = (y - y2) / (y1 - y2) * x1 + (y1 - y) / (y1 - y2) * x2;
|
double x = MathUtil.clamp((y - y2) / (y1 - y2) * x1 + (y1 - y) / (y1 - y2) * x2,
|
||||||
|
Math.min(x1, x2), Math.max(x1, x2));
|
||||||
if (x < chordLead[i])
|
if (x < chordLead[i])
|
||||||
chordLead[i] = x;
|
chordLead[i] = x;
|
||||||
if (x > chordTrail[i])
|
if (x > chordTrail[i])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user