object Velocity extends Serializable
This companion object of class Velocity
exists primarily to provide convenience
methods for creating new instances of Velocity
.
The object has an alias in the top-level package o1, so it’s accessible to students
simply via import o1._
.
- Alphabetic
- By Inheritance
- Velocity
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val Still: Velocity
a zero-speed Velocity with a direction of
NoDirection
- def apply(vector: Pos): Velocity
Returns a Velocity whose
dx
anddy
equal thex
andy
of the given Pos, respectively. - def apply(dx: Double, dy: Double): Velocity
Returns a Velocity with the given
dx
anddy
. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def average(velocities: Seq[Velocity]): Velocity
Returns the average of all the given velocities.
Returns the average of all the given velocities. If the given collection is empty, returns Velocity.Still.
- def between(from: Pos, to: Pos): Velocity
Returns a Velocity from two given Pos objects: the direction is determined from the first given Pos towards and the speed equals the distance between the two
Pos
es. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def sum(velocities: Seq[Velocity]): Velocity
Returns the sum of all the given velocities.
Returns the sum of all the given velocities. If the given collection is empty, returns Velocity.Still.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.