trait HasVelocity extends HasPos
A supertype for objects that have a position and a velocity in two-dimensional space.
- Alphabetic
- By Inheritance
- HasVelocity
- HasPos
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
Concrete Value Members
- def distance(another: HasPos): Double
Determines the distance (“as the crow flies”) between this object’s
pos
and that of the given object.Determines the distance (“as the crow flies”) between this object’s
pos
and that of the given object.- Definition Classes
- HasPos
- def isBoundFor(direction: Direction): Boolean
Determines whether this objectis bound for roughly the given direction, as per Direction.sharesQuadrant.
- def isDownbound: Boolean
Determines whether this objecthas a downward velocity, as per Direction.isDownward.
- def isLeftbound: Boolean
Determines whether this objecthas a leftward velocity, as per Direction.isLeftward.
- def isRightbound: Boolean
Determines whether this objecthas a rightward velocity, as per Direction.isRightward.
- def isUpbound: Boolean
Determines whether this objecthas an upward velocity, as per Direction.isUpward.
- def nextPos: Pos
Returns the
Pos
that this object, moving from its current location at its current velocity, reaches in one unit of time.Returns the
Pos
that this object, moving from its current location at its current velocity, reaches in one unit of time. That is, adds thedx
anddy
components of the velocity to the currentPos
and returns the result.