double rateOfChange = footprintWidth / 360;
// Show some logging of the value of rateOfChange
System.out.println("I:RWDCCalc:CalculatingTools.pathDistance: - rateOfChange is " + rateOfChange);
// A and B will be used for the calculations of the distances
Coordinates A = new Coordinates();
Coordinates B = new Coordinates();
// These ArrayLists will update every iteration with information provided
ArrayList<String> distanceFromCenter = new ArrayList<String>();
ArrayList<String> angleFromCenter = new ArrayList<String>();
ArrayList<String> segmentType = new ArrayList<String>();
// Only run this if there is a greater than 0 amount of iterations
if (iterationsDouble != 0)
for (double x = 0; x < iterationsDouble; x+=0.0041666666666666666667) {
// Add the distance from center, angle from center, and segment type here
distanceFromCenter.add(Double.toString(baseRadius - (footprintWidth * x)));
angleFromCenter.add(Double.toString(angle * x));
segmentType.add("P");
// We will go around the circle and calculate the distance every degree around the circle
for (double y = 0; y <= 1.5; y++) {
// Set theta to whatever y is, which will be where
// we are around the circle
theta = y;
// Let's update the radius of the flight path as the plane flys
// around the circle in a spiral
if (y == 0 && x == 0) {
A.setX(baseRadius * Math.cos(Math.toRadians(theta)));
A.setY(baseRadius * Math.sin(Math.toRadians(theta)));
radius = baseRadius;
} else {
radius -= rateOfChange;
// Let's figure out the coordinates of B
B.setX(radius * Math.cos(Math.toRadians(theta)));
B.setY(radius * Math.sin(Math.toRadians(theta)));
// Let's find the distance between coordinate A and coordinate B
distance = pointDistance(A.getX(), B.getX(), A.getY(), B.getY());
// Let's add the distance to the totalDistance array
totalDistance.add(new DoubleObject(distance));
// Let's set B to A, and clear B, so B can be set on the next iteration
A.clearAll();
A.set(B);
B.clearAll();
}
}
}
// Add in the distance of the outside circle that the plane will have to travel as well