From 786dd9755896f3bbdba667e36c8ba271bcaec808 Mon Sep 17 00:00:00 2001 From: Daniel_M_Williams Date: Sun, 4 Nov 2018 12:59:28 -0500 Subject: [PATCH] [fixes #468] Fixes rendering issue with freeform fins Cause by a fencepost-error when generating body points for freeform fins on transitions. Induced by the imprecision of floating point calculations. --- core/src/net/sf/openrocket/rocketcomponent/FinSet.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index d3f124131..37b2663cf 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -1095,6 +1095,13 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab xCur += increment; } + + // correct last point, if beyond a rounding error from body's end. + final int lastIndex = points.length - 1; + if( body.getLength()-0.000001 < points[lastIndex].x) { + points[lastIndex] = points[lastIndex].setX(body.getLength()).setY(body.getAftRadius()); + } + return points; }