Class JavaPhysicsEngine

    • Constructor Summary

      Constructors 
      Constructor Description
      JavaPhysicsEngine()
      Construct the Java-base physic engine.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      double acceleration​(double previousSpeed, double currentSpeed, double dt)
      Replies the new acceleration according to a previous speed and a current speed, and given time.
      double motionNewtonEuler1Law​(double speed, double dt)
      Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).
      double motionNewtonEuler1Law1D​(double speed, double minSpeed, double maxSpeed, double dt)
      Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).
      void motionNewtonEuler1Law1D5​(Vector1D<?,​?,​?> velocity, double minSpeed, double maxSpeed, double dt, Vector1D<?,​?,​?> result)
      Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).
      void motionNewtonEuler1Law1D5​(Vector2D<?,​?> velocity, double minSpeed, double maxSpeed, double dt, Vector2D<?,​?> result)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 16.0
      void motionNewtonEuler1Law2D​(Vector2D<?,​?> velocity, double minSpeed, double maxSpeed, double dt, Vector2D<?,​?> result)
      Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).
      void motionNewtonEuler1Law2D5​(Vector3D<?,​?> velocity, double minSpeed, double maxSpeed, double dt, Vector3D<?,​?> result)
      Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).
      void motionNewtonEuler1Law3D​(Vector3D<?,​?> velocity, double minSpeed, double maxSpeed, double dt, Vector3D<?,​?> result)
      Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).
      double motionNewtonLaw​(double speed, double acceleration, double dt)
      Compute and replies a motion according to high school physics Newton's equations for motion.
      double motionNewtonLaw1D​(double velocity, double minSpeed, double maxSpeed, double acceleration, double minAcceleration, double maxAcceleration, double dt)
      Compute and replies a motion according to high school physics Newton's equations for motion.
      void motionNewtonLaw1D5​(Vector1D<?,​?,​?> velocity, double minSpeed, double maxSpeed, Vector1D<?,​?,​?> acceleration, double minAcceleration, double maxAcceleration, double dt, Vector1D<?,​?,​?> result)
      Compute and replies a motion according to high school physics Newton's equations for motion.
      void motionNewtonLaw1D5​(Vector2D<?,​?> velocity, double minSpeed, double maxSpeed, Vector2D<?,​?> acceleration, double minAcceleration, double maxAcceleration, double dt, Vector2D<?,​?> result)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 16.0
      void motionNewtonLaw2D​(Vector2D<?,​?> velocity, double minSpeed, double maxSpeed, Vector2D<?,​?> acceleration, double minAcceleration, double maxAcceleration, double dt, Vector2D<?,​?> result)
      Compute and replies a motion according to high school physics Newton's equations for motion.
      void motionNewtonLaw2D5​(Vector3D<?,​?> velocity, double minSpeed, double maxSpeed, Vector3D<?,​?> acceleration, double minAcceleration, double maxAcceleration, double dt, Vector3D<?,​?> result)
      Compute and replies a motion according to high school physics Newton's equations for motion.
      void motionNewtonLaw3D​(Vector3D<?,​?> velocity, double minSpeed, double maxSpeed, Vector3D<?,​?> acceleration, double minAcceleration, double maxAcceleration, double dt, Vector3D<?,​?> result)
      Compute and replies a motion according to high school physics Newton's equations for motion.
      double speed​(double movement, double dt)
      Replies the new speed according to a previous speed and a mouvement during a given time.
    • Constructor Detail

      • JavaPhysicsEngine

        JavaPhysicsEngine()
        Construct the Java-base physic engine.
    • Method Detail

      • motionNewtonLaw

        @Pure
        public double motionNewtonLaw​(double speed,
                                      double acceleration,
                                      double dt)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to high school physics Newton's equations for motion.

        From Equation 2 of the SUVAT form:
        movement = speed * dt + 0.5 * acceleration * dt * dt

        Specified by:
        motionNewtonLaw in interface PhysicsEngine
        Parameters:
        speed - is the current speed of the object.
        acceleration - is the current acceleration of the object.
        dt - is the time
        Returns:
        a motion
      • motionNewtonLaw1D

        @Pure
        public double motionNewtonLaw1D​(double velocity,
                                        double minSpeed,
                                        double maxSpeed,
                                        double acceleration,
                                        double minAcceleration,
                                        double maxAcceleration,
                                        double dt)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to high school physics Newton's equations for motion.

        This function allows to clamp acceleration and velocity.

        From Equation 2 of the SUVAT form:
        clamped_acceleration = clamp(acceleration, minAcceleration, maxAcceleration)
        new_velocity = velocity + 0.5 * clamped_acceleration * dt
        clamped_velocity = clamp(new_velocity, minSpeed, maxSpeed)
        motion = clamped_velocity * dt

        Specified by:
        motionNewtonLaw1D in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        acceleration - is the current acceleration of the object.
        minAcceleration - is the minimal acceleration allowed.
        maxAcceleration - is the maximal acceleration allowed. Length of this vector is the acceleration amount. Direction of this vector becomes movement direction.
        dt - is the time.
        Returns:
        the motion
        See Also:
        "http://en.wikibooks.org/wiki/High_School_Physics/Velocity"
      • motionNewtonLaw1D5

        @Pure
        @Deprecated(since="16.0",
                    forRemoval=true)
        public void motionNewtonLaw1D5​(Vector2D<?,​?> velocity,
                                       double minSpeed,
                                       double maxSpeed,
                                       Vector2D<?,​?> acceleration,
                                       double minAcceleration,
                                       double maxAcceleration,
                                       double dt,
                                       Vector2D<?,​?> result)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 16.0
        Compute and replies a motion according to high school physics Newton's equations for motion.

        This function allows to clamp acceleration and velocity.

        From Equation 2 of the SUVAT form:
        clamped_acceleration = clamp(acceleration, minAcceleration, maxAcceleration)
        new_velocity = velocity + 0.5 * clamped_acceleration * dt
        clamped_velocity = clamp(new_velocity, minSpeed, maxSpeed)
        motion = clamped_velocity * dt

        Specified by:
        motionNewtonLaw1D5 in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object. Norm of vector is speed in m/s for example.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        acceleration - is the current acceleration of the object. Norm of vector is acceleration amount in m/s2 for example.
        minAcceleration - is the minimal acceleration allowed.
        maxAcceleration - is the maximal acceleration allowed. Length of this vector is the acceleration amount. Direction of this vector becomes movement direction.
        dt - is the time.
        result - the motion.
        See Also:
        "http://en.wikibooks.org/wiki/High_School_Physics/Velocity"
      • motionNewtonLaw1D5

        @Pure
        public void motionNewtonLaw1D5​(Vector1D<?,​?,​?> velocity,
                                       double minSpeed,
                                       double maxSpeed,
                                       Vector1D<?,​?,​?> acceleration,
                                       double minAcceleration,
                                       double maxAcceleration,
                                       double dt,
                                       Vector1D<?,​?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to high school physics Newton's equations for motion.

        This function allows to clamp acceleration and velocity.

        From Equation 2 of the SUVAT form:
        clamped_acceleration = clamp(acceleration, minAcceleration, maxAcceleration)
        new_velocity = velocity + 0.5 * clamped_acceleration * dt
        clamped_velocity = clamp(new_velocity, minSpeed, maxSpeed)
        motion = clamped_velocity * dt

        Caution: The resulting vector has the same segment as the provided vector.

        Specified by:
        motionNewtonLaw1D5 in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object. Norm of vector is speed in m/s for example.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        acceleration - is the current acceleration of the object. Norm of vector is acceleration amount in m/s2 for example.
        minAcceleration - is the minimal acceleration allowed.
        maxAcceleration - is the maximal acceleration allowed. Length of this vector is the acceleration amount. Direction of this vector becomes movement direction.
        dt - is the time.
        result - the motion.
        See Also:
        "http://en.wikibooks.org/wiki/High_School_Physics/Velocity"
      • motionNewtonLaw2D

        @Pure
        public void motionNewtonLaw2D​(Vector2D<?,​?> velocity,
                                      double minSpeed,
                                      double maxSpeed,
                                      Vector2D<?,​?> acceleration,
                                      double minAcceleration,
                                      double maxAcceleration,
                                      double dt,
                                      Vector2D<?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to high school physics Newton's equations for motion.

        This function allows to clamp acceleration and velocity.

        From Equation 2 of the SUVAT form:
        clamped_acceleration = clamp(acceleration, minAcceleration, maxAcceleration)
        new_velocity = velocity + 0.5 * clamped_acceleration * dt
        clamped_velocity = clamp(new_velocity, minSpeed, maxSpeed)
        motion = clamped_velocity * dt

        Specified by:
        motionNewtonLaw2D in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object. Norm of vector is speed in m/s for example.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        acceleration - is the current acceleration of the object. Norm of vector is acceleration amount in m/s2 for example.
        minAcceleration - is the minimal acceleration allowed.
        maxAcceleration - is the maximal acceleration allowed. Length of this vector is the acceleration amount. Direction of this vector becomes movement direction.
        dt - is the time.
        result - the motion.
        See Also:
        "http://en.wikibooks.org/wiki/High_School_Physics/Velocity"
      • motionNewtonLaw2D5

        @Pure
        public void motionNewtonLaw2D5​(Vector3D<?,​?> velocity,
                                       double minSpeed,
                                       double maxSpeed,
                                       Vector3D<?,​?> acceleration,
                                       double minAcceleration,
                                       double maxAcceleration,
                                       double dt,
                                       Vector3D<?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to high school physics Newton's equations for motion.

        This function allows to clamp acceleration and velocity.

        From Equation 2 of the SUVAT form:
        clamped_acceleration = clamp(acceleration, minAcceleration, maxAcceleration)
        new_velocity = velocity + 0.5 * clamped_acceleration * dt
        clamped_velocity = clamp(new_velocity, minSpeed, maxSpeed)
        motion = clamped_velocity * dt

        Specified by:
        motionNewtonLaw2D5 in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object. Norm of vector is speed in m/s for example.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        acceleration - is the current acceleration of the object. Norm of vector is acceleration amount in m/s2 for example.
        minAcceleration - is the minimal acceleration allowed.
        maxAcceleration - is the maximal acceleration allowed. Length of this vector is the acceleration amount. Direction of this vector becomes movement direction.
        dt - is the time.
        result - the motion.
        See Also:
        "http://en.wikibooks.org/wiki/High_School_Physics/Velocity"
      • motionNewtonLaw3D

        @Pure
        public void motionNewtonLaw3D​(Vector3D<?,​?> velocity,
                                      double minSpeed,
                                      double maxSpeed,
                                      Vector3D<?,​?> acceleration,
                                      double minAcceleration,
                                      double maxAcceleration,
                                      double dt,
                                      Vector3D<?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to high school physics Newton's equations for motion.

        This function allows to clamp acceleration and velocity.

        From Equation 2 of the SUVAT form:
        clamped_acceleration = clamp(acceleration, minAcceleration, maxAcceleration)
        new_velocity = velocity + 0.5 * clamped_acceleration * dt
        clamped_velocity = clamp(new_velocity, minSpeed, maxSpeed)
        motion = clamped_velocity * dt

        Specified by:
        motionNewtonLaw3D in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object. Norm of vector is speed in m/s for example.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        acceleration - is the current acceleration of the object. Norm of vector is acceleration amount in m/s2 for example.
        minAcceleration - is the minimal acceleration allowed.
        maxAcceleration - is the maximal acceleration allowed. Length of this vector is the acceleration amount. Direction of this vector becomes movement direction.
        dt - is the time.
        result - the motion.
        See Also:
        "http://en.wikibooks.org/wiki/High_School_Physics/Velocity"
      • motionNewtonEuler1Law

        @Pure
        public double motionNewtonEuler1Law​(double speed,
                                            double dt)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = speed * dt

        Specified by:
        motionNewtonEuler1Law in interface PhysicsEngine
        Parameters:
        speed - is the current speed of the object.
        dt - is the time
        Returns:
        a motion
      • motionNewtonEuler1Law1D

        @Pure
        public double motionNewtonEuler1Law1D​(double speed,
                                              double minSpeed,
                                              double maxSpeed,
                                              double dt)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = clamp(velocity) * dt

        Specified by:
        motionNewtonEuler1Law1D in interface PhysicsEngine
        Parameters:
        speed - is the current velocity of the object.
        minSpeed - is the minimal speed allowed.
        maxSpeed - is the maximal speed allowed.
        dt - is the time
        Returns:
        a motion
      • motionNewtonEuler1Law1D5

        @Pure
        @Deprecated(since="16.0",
                    forRemoval=true)
        public void motionNewtonEuler1Law1D5​(Vector2D<?,​?> velocity,
                                             double minSpeed,
                                             double maxSpeed,
                                             double dt,
                                             Vector2D<?,​?> result)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 16.0
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = clamp(velocity) * dt

        Specified by:
        motionNewtonEuler1Law1D5 in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object.
        minSpeed - is the minimal speed allowed (clamped to 0 if negative).
        maxSpeed - is the maximal speed allowed.
        dt - is the time
        result - a motion
      • motionNewtonEuler1Law1D5

        @Pure
        public void motionNewtonEuler1Law1D5​(Vector1D<?,​?,​?> velocity,
                                             double minSpeed,
                                             double maxSpeed,
                                             double dt,
                                             Vector1D<?,​?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = clamp(velocity) * dt

        Caution: The resulting vector has the same segment as the provided vector.

        Specified by:
        motionNewtonEuler1Law1D5 in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object.
        minSpeed - is the minimal speed allowed (clamped to 0 if negative).
        maxSpeed - is the maximal speed allowed.
        dt - is the time
        result - a motion
      • motionNewtonEuler1Law2D

        @Pure
        public void motionNewtonEuler1Law2D​(Vector2D<?,​?> velocity,
                                            double minSpeed,
                                            double maxSpeed,
                                            double dt,
                                            Vector2D<?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = clamp(velocity) * dt

        Specified by:
        motionNewtonEuler1Law2D in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object.
        minSpeed - is the minimal speed allowed (clamped to 0 if negative).
        maxSpeed - is the maximal speed allowed.
        dt - is the time
        result - a motion
      • motionNewtonEuler1Law2D5

        @Pure
        public void motionNewtonEuler1Law2D5​(Vector3D<?,​?> velocity,
                                             double minSpeed,
                                             double maxSpeed,
                                             double dt,
                                             Vector3D<?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = clamp(velocity) * dt

        Specified by:
        motionNewtonEuler1Law2D5 in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object.
        minSpeed - is the minimal speed allowed (clamped to 0 if negative).
        maxSpeed - is the maximal speed allowed.
        dt - is the time
        result - a motion
      • motionNewtonEuler1Law3D

        @Pure
        public void motionNewtonEuler1Law3D​(Vector3D<?,​?> velocity,
                                            double minSpeed,
                                            double maxSpeed,
                                            double dt,
                                            Vector3D<?,​?> result)
        Description copied from interface: PhysicsEngine
        Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).

        From the first-order Newton-Euler method: movement = clamp(velocity) * dt

        Specified by:
        motionNewtonEuler1Law3D in interface PhysicsEngine
        Parameters:
        velocity - is the current velocity of the object.
        minSpeed - is the minimal speed allowed (clamped to 0 if negative).
        maxSpeed - is the maximal speed allowed.
        dt - is the time
        result - a motion
      • speed

        @Pure
        public double speed​(double movement,
                            double dt)
        Description copied from interface: PhysicsEngine
        Replies the new speed according to a previous speed and a mouvement during a given time.

        From the first-order Newton-Euler method: speed = movement / dt

        Specified by:
        speed in interface PhysicsEngine
        Parameters:
        movement - is the movement distance.
        dt - is the time
        Returns:
        a new speed
      • acceleration

        @Pure
        public double acceleration​(double previousSpeed,
                                   double currentSpeed,
                                   double dt)
        Description copied from interface: PhysicsEngine
        Replies the new acceleration according to a previous speed and a current speed, and given time.

        From the second-order Newton-Euler method: (currentSpeed - previousSpeed) / dt

        Specified by:
        acceleration in interface PhysicsEngine
        Parameters:
        previousSpeed - is the previous speed of the object.
        currentSpeed - is the current speed of the object.
        dt - is the time
        Returns:
        a new acceleration