public double length(Position point1, Position point2) { // TODO semantic SJ, JR // TODO implementation // TODO test // TODO documentation /* Default-Values */ if (point1 == null && point2 == null) return this.length(); // if (point1 == null) // point1 = new PositionImpl(this.getStartPoint()); // if (point2 == null) // point2 = new PositionImpl(this.getEndPoint()); /* Get all Params for closest points to startposition point1 */ ParamForPoint startParams = this.getParamForPoint(point1.getPosition()); /* Get all Params for closest points to endposition point2 */ ParamForPoint endParams = this.getParamForPoint(point2.getPosition()); /* * Compare the distances between each found startParam and endParam and * choose the smallest one */ double minDistance = Math.abs(DoubleOperation.subtract(startParams.getDistance(), endParams.getDistance())); // double actDistance = 0.0; // for (int i = 1; i < startParams.length; i++) { // for (int j = 1; i < endParams.length; j++) { // actDistance = Math.abs((Double) this.getStartParams[0] // - (Double) endParams[0]); // if (actDistance < minDistance) { // minDistance = actDistance; return minDistance; }
.getParamForPoint(p); double minDistanceSquare = AlgoPointND.getDistanceSquare(p.getCoordinates(), paramForPoints.getPosition().getCoordinates()); .getParamForPoint(p); actDistanceSquare = AlgoPointND.getDistanceSquare(p.getCoordinates(), paramForPoints1.getPosition().getCoordinates());