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