From 83e547bc4c92bfdefbb0aaf5cdbcac206db04646 Mon Sep 17 00:00:00 2001 From: "Christopher Ronnewinkel (D036654)" Date: Mon, 20 Oct 2014 20:16:14 +0200 Subject: [PATCH] simplify tree-grow-algorithm by strict focus on left/right steps; --- .../impl/PathGeneratorTreeGrowWind.java | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/java/com.sap.sailing.simulator/src/com/sap/sailing/simulator/impl/PathGeneratorTreeGrowWind.java b/java/com.sap.sailing.simulator/src/com/sap/sailing/simulator/impl/PathGeneratorTreeGrowWind.java index f191a1b98e8..f4659b12128 100644 --- a/java/com.sap.sailing.simulator/src/com/sap/sailing/simulator/impl/PathGeneratorTreeGrowWind.java +++ b/java/com.sap.sailing.simulator/src/com/sap/sailing/simulator/impl/PathGeneratorTreeGrowWind.java @@ -163,27 +163,9 @@ public class PathGeneratorTreeGrowWind extends PathGeneratorBase { return new TimedPositionImpl(nextTime, nextPosition); } - // use base direction to distinguish direction changes that do or don't require a turn - char getBaseDirection(char direction) { - char baseDirection = direction; - - if (direction == 'M') { - baseDirection = 'L'; - } - if (direction == 'S') { - baseDirection = 'R'; - } - - return baseDirection; - } - // check whether nextDirection is same base direction as previous direction, i.e. no turn boolean isSameDirection(char prevDirection, char nextDirection) { - - char prevBaseDirection = this.getBaseDirection(prevDirection); - char nextBaseDirection = this.getBaseDirection(nextDirection); - - return ((nextBaseDirection == prevBaseDirection)||(prevBaseDirection == '0')); + return ((nextDirection == prevDirection)||(prevDirection == '0')); } // get path candidate measuring height towards (local, current-apparent) wind @@ -248,9 +230,8 @@ public class PathGeneratorTreeGrowWind extends PathGeneratorBase { // extend path-string by step-direction String pathStr = path.path + nextDirection; - char nextBaseDirection = this.getBaseDirection(nextDirection); - return (new PathCandidate(pathPos, reachedEnd, vrtDist, hrzDist, turnCount, pathStr, nextBaseDirection, appWind)); + return (new PathCandidate(pathPos, reachedEnd, vrtDist, hrzDist, turnCount, pathStr, nextDirection, appWind)); } @@ -279,18 +260,10 @@ public class PathGeneratorTreeGrowWind extends PathGeneratorBase { newPathCand = getPathCandWind(path, 'L', timeStep, turnLoss, posStart, posEnd, tgtHeight); result.add(newPathCand); - // step wide left - //newPathCand = getPathCandWind(path, 'M', timeStep, turnLoss, posStart, posEnd, tgtHeight); - //result.add(newPathCand); - // step right newPathCand = getPathCandWind(path, 'R', timeStep, turnLoss, posStart, posEnd, tgtHeight); result.add(newPathCand); - // step wide right - //newPathCand = getPathCandWind(path, 'S', timeStep, turnLoss, posStart, posEnd, tgtHeight); - //result.add(newPathCand); - } return result;