Class JavaPhysicsEngine
- java.lang.Object
-
- org.arakhne.afc.math.physics.JavaPhysicsEngine
-
- All Implemented Interfaces:
PhysicsEngine
class JavaPhysicsEngine extends Object implements PhysicsEngine
Some physic utility functions implementing in Java.Definitions:
- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:49
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathphysics
-
-
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 doubleacceleration(double previousSpeed, double currentSpeed, double dt)Replies the new acceleration according to a previous speed and a current speed, and given time.doublemotionNewtonEuler1Law(double speed, double dt)Compute and replies a motion according to Newton-Euler-1 equations for motion (where acceleration is not significant).doublemotionNewtonEuler1Law1D(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).voidmotionNewtonEuler1Law1D5(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).voidmotionNewtonEuler1Law1D5(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.0voidmotionNewtonEuler1Law2D(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).voidmotionNewtonEuler1Law2D5(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).voidmotionNewtonEuler1Law3D(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).doublemotionNewtonLaw(double speed, double acceleration, double dt)Compute and replies a motion according to high school physics Newton's equations for motion.doublemotionNewtonLaw1D(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.voidmotionNewtonLaw1D5(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.voidmotionNewtonLaw1D5(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.0voidmotionNewtonLaw2D(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.voidmotionNewtonLaw2D5(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.voidmotionNewtonLaw3D(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.doublespeed(double movement, double dt)Replies the new speed according to a previous speed and a mouvement during a given time.
-
-
-
Method Detail
-
motionNewtonLaw
@Pure public double motionNewtonLaw(double speed, double acceleration, double dt)Description copied from interface:PhysicsEngineCompute 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:
motionNewtonLawin interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonLaw1Din interfacePhysicsEngine- 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.0Compute 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:
motionNewtonLaw1D5in interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonLaw1D5in interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonLaw2Din interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonLaw2D5in interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonLaw3Din interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonEuler1Lawin interfacePhysicsEngine- 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:PhysicsEngineCompute 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:
motionNewtonEuler1Law1Din interfacePhysicsEngine- 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.0Compute 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:
motionNewtonEuler1Law1D5in interfacePhysicsEngine- 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 timeresult- a motion
-
motionNewtonEuler1Law1D5
@Pure public void motionNewtonEuler1Law1D5(Vector1D<?,?,?> velocity, double minSpeed, double maxSpeed, double dt, Vector1D<?,?,?> result)
Description copied from interface:PhysicsEngineCompute 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) * dtCaution: The resulting vector has the same segment as the provided vector.
- Specified by:
motionNewtonEuler1Law1D5in interfacePhysicsEngine- 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 timeresult- a motion
-
motionNewtonEuler1Law2D
@Pure public void motionNewtonEuler1Law2D(Vector2D<?,?> velocity, double minSpeed, double maxSpeed, double dt, Vector2D<?,?> result)
Description copied from interface:PhysicsEngineCompute 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:
motionNewtonEuler1Law2Din interfacePhysicsEngine- 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 timeresult- a motion
-
motionNewtonEuler1Law2D5
@Pure public void motionNewtonEuler1Law2D5(Vector3D<?,?> velocity, double minSpeed, double maxSpeed, double dt, Vector3D<?,?> result)
Description copied from interface:PhysicsEngineCompute 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:
motionNewtonEuler1Law2D5in interfacePhysicsEngine- 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 timeresult- a motion
-
motionNewtonEuler1Law3D
@Pure public void motionNewtonEuler1Law3D(Vector3D<?,?> velocity, double minSpeed, double maxSpeed, double dt, Vector3D<?,?> result)
Description copied from interface:PhysicsEngineCompute 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:
motionNewtonEuler1Law3Din interfacePhysicsEngine- 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 timeresult- a motion
-
speed
@Pure public double speed(double movement, double dt)Description copied from interface:PhysicsEngineReplies 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:
speedin interfacePhysicsEngine- 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:PhysicsEngineReplies 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:
accelerationin interfacePhysicsEngine- 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
-
-