Velocity
A measurement of velocity - motion in a given direction. This velocity can have positive or negative speed values and a direction relative to the absolute coordinate plane Pathfinder uses.
Fields
speed
The velocity's speed. This can be either a negative or positive number.
direction
The velocity's direction, represented as an Angle.
Methods
Velocity(double speed, Angle direction)
Constructs a new Velocity with the specified speed and direction.
blend(Velocity a, Velocity b)
Static method. Creates a new Velocity by blending (averaging) the speed and direction values of two input velocities.
getSpeed()
Returns the speed component of the velocity.
getDirection()
Returns the direction component of the velocity as an Angle.
getAbsoluteSpeed()
Returns the absolute value of the velocity's speed.
convertFromElapsedMilliseconds(double elapsedMilliseconds)
Converts the velocity into a PointXY representing the displacement over a given elapsedMilliseconds.
convertFromElapsedSeconds(double elapsedSeconds)
Converts the velocity into a PointXY representing the displacement over a given elapsedSeconds.
applyVelocityMilliseconds(PointXY original, double elapsedMilliseconds)
Applies this velocity to an original PointXY over a given elapsedMilliseconds, returning the new PointXY.
applyVelocitySeconds(PointXY original, double elapsedSeconds)
Applies this velocity to an original PointXY over a given elapsedSeconds, returning the new PointXY.
blend(Velocity velocity)
Blends this velocity with another velocity. This is an instance method that calls the static blend method.
asPointXY()
Converts the Velocity into a PointXY where the speed is used as the distance and the direction as the angle from the origin.
asPointXYZ()
Converts the Velocity into a PointXYZ where the speed is used as the distance and the direction as both the angle from the origin and the Z (heading) component.
nearestVelocity(List<Velocity> velocities, Velocity velocity)
Returns the Velocity from a list of velocities that is closest to the given velocity.
nearestVelocities(List<Velocity> velocities, Velocity velocity, int howMany)
Returns a List of howMany Velocity objects from the provided velocities list that are closest to the given velocity.
toString()
Returns a string representation of the Velocity in the format "(speed: s, direction: d)".