|
@@ -22,4 +22,21 @@ module.exports = class Moon {
|
|
|
*/
|
|
|
this.velocity = new Vector3(0, 0, 0);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Check whether or not the moon has returned to its initial position
|
|
|
+ *
|
|
|
+ * @returns {bool} True if the current position is the same as the initial position and if the velocity is zero
|
|
|
+ */
|
|
|
+ hasReachedInitialState() {
|
|
|
+ return (
|
|
|
+ this._initialPosition.x == this.position.x
|
|
|
+ && this._initialPosition.y == this.position.y
|
|
|
+ && this._initialPosition.z == this.position.z
|
|
|
+ ) && (
|
|
|
+ this.velocity.x == 0
|
|
|
+ && this.velocity.y == 0
|
|
|
+ && this.velocity.z == 0
|
|
|
+ );
|
|
|
+ }
|
|
|
};
|