From d2cdea21131c85d2550e9e29dc71f0411d224bdd Mon Sep 17 00:00:00 2001 From: Joe Pfeiffer Date: Sun, 26 Aug 2018 16:32:44 -0600 Subject: [PATCH] Little bit more massaging for clarity (replace avgImpulse with impulse) --- core/src/net/sf/openrocket/motor/ThrustCurveMotor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java index 8bb8afddd..ec5f82605 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java @@ -318,26 +318,26 @@ public class ThrustCurveMotor implements Motor, Comparable, Se return (startThrust + endThrust) / 2.0; } - double avgImpulse = 0.0; + double impulse = 0.0; // portion from startTime through time[timeIndex+1] double startThrust = MathUtil.map(startTime, time[timeIndex], time[timeIndex+1], thrust[timeIndex], thrust[timeIndex+1]); - avgImpulse = (time[timeIndex+1] - startTime) * (startThrust + thrust[timeIndex+1]) / 2.0; + impulse = (time[timeIndex+1] - startTime) * (startThrust + thrust[timeIndex+1]) / 2.0; // Now add the whole steps; timeIndex++; while ( timeIndex < time.length -1 && endTime >= time[timeIndex+1] ) { - avgImpulse += (time[timeIndex+1] - time[timeIndex]) * (thrust[timeIndex] + thrust[timeIndex+1]) / 2.0; + impulse += (time[timeIndex+1] - time[timeIndex]) * (thrust[timeIndex] + thrust[timeIndex+1]) / 2.0; timeIndex++; } // Now add the bit after the last time index if ( timeIndex < time.length -1 ) { double endThrust = MathUtil.map( endTime, time[timeIndex], time[timeIndex+1], thrust[timeIndex], thrust[timeIndex+1]); - avgImpulse += ((thrust[timeIndex] + endThrust) / 2.0) * (endTime - time[timeIndex]); + impulse += ((thrust[timeIndex] + endThrust) / 2.0) * (endTime - time[timeIndex]); } - return avgImpulse / (endTime - startTime); + return impulse / (endTime - startTime); } @Override