mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Tidied variable names.
This commit is contained in:
@@ -61,26 +61,19 @@ class Wake extends Group {
|
||||
void setRotationalVelocity(double rotationalVelocity, double velocity) {
|
||||
rotationalVelocities[0] = rotationalVelocity;
|
||||
for (int i = 1; i < numWakes; i++) {
|
||||
double difference = Math.atan2(
|
||||
Math.sin(
|
||||
Math.toRadians(
|
||||
rotations[i - 1] - rotations[i]
|
||||
)
|
||||
),
|
||||
Math.cos(
|
||||
Math.toRadians(
|
||||
rotations[i - 1] - rotations[i]
|
||||
)
|
||||
)
|
||||
double wakeSeparationRad = Math.toRadians(rotations[i - 1] - rotations[i]);
|
||||
double shortestDistance = Math.atan2(
|
||||
Math.sin(wakeSeparationRad),
|
||||
Math.cos(wakeSeparationRad)
|
||||
);
|
||||
difference = Math.toDegrees(difference);
|
||||
double distDeg = Math.toDegrees(shortestDistance);
|
||||
|
||||
if (rotationalVelocities[i - 1] < 0.01 && rotationalVelocities[i - 1] > -0.01) {
|
||||
rotationalVelocities[i] = difference / UNIFICATION_SPEED * Math.log(Math.abs(difference) + 1) / Math.log(MAX_DIFF / numWakes) * 1.5;
|
||||
rotationalVelocities[i] = distDeg / UNIFICATION_SPEED * Math.log(Math.abs(distDeg) + 1) / Math.log(MAX_DIFF / numWakes);
|
||||
|
||||
} else {
|
||||
if (difference < (MAX_DIFF / numWakes))
|
||||
rotationalVelocities[i] = rotationalVelocities[i-1] * Math.log(Math.abs(difference) + 1) / Math.log(MAX_DIFF / numWakes);
|
||||
if (distDeg < (MAX_DIFF / numWakes))
|
||||
rotationalVelocities[i] = rotationalVelocities[i - 1] * Math.log(Math.abs(distDeg) + 1) / Math.log(MAX_DIFF / numWakes);
|
||||
else
|
||||
rotationalVelocities[i] = rotationalVelocities[i - 1];
|
||||
}
|
||||
@@ -96,6 +89,7 @@ class Wake extends Group {
|
||||
|
||||
/**
|
||||
* Arcs rotate based on the distance they would have travelled over the supplied time interval.
|
||||
*
|
||||
* @param timeInterval the time interval, in microseconds, that the wake should move.
|
||||
*/
|
||||
void updatePosition(long timeInterval) {
|
||||
@@ -107,6 +101,7 @@ class Wake extends Group {
|
||||
|
||||
/**
|
||||
* Rotate all wakes to the given rotation.
|
||||
*
|
||||
* @param rotation the from north angle in degrees to rotate to.
|
||||
*/
|
||||
void rotate(double rotation) {
|
||||
|
||||
Reference in New Issue
Block a user