Packages

trait Vector extends AnyRef

Mixin representing a 2D vector.

The methods of this mixin won't alter the values of the classes that extends it.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Vector
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def x: Double

    Getter for the vector x component

    Getter for the vector x component

    returns

    x component

  2. abstract def y: Double

    Getter for the vector y component

    Getter for the vector y component

    returns

    y component

Concrete Value Members

  1. def add(v: Vector): Vector

    Vector addition.

    Vector addition. Leaves this vector unchanged.

    v

    vector to add

    returns

    addition result as a new instance

  2. def divide(v: Double): Vector

    Vector-scalar division.

    Vector-scalar division. Leaves this vector unchanged.

    v

    scalar

    returns

    division result as a new instance

  3. def dot(v: Vector): Double

    Vector dot product

    Vector dot product

    v

    vector to use for dot product

    returns

    dot product

  4. def getMagnitude: Double

    Gets the magnitude (module) of the vector applying parallelogram law

    Gets the magnitude (module) of the vector applying parallelogram law

    returns

    magnitude of this vector

  5. def getNewMagnitude(desiredMagnitude: Double): Vector

    Scales this vector magnitude (module) with the desired one

    Scales this vector magnitude (module) with the desired one

    desiredMagnitude

    desired vector magnitude

    returns

    a new vector with the specified module

  6. def limit(maxMagnitude: Double): Vector

    Limits the vector's magnitude if it is greater than the given one

    Limits the vector's magnitude if it is greater than the given one

    maxMagnitude

    the max magnitude of the vector

    returns

    a new vector

  7. def multiply(v: Double): Vector

    Vector-scalar multiplication.

    Vector-scalar multiplication. Leaves this vector unchanged.

    v

    scalar to multiply

    returns

    multiplication mu result as a new instance

  8. def multiply(v: Vector): Vector

    Vector multiplication.

    Vector multiplication. Leaves this vector unchanged.

    v

    vector to multiply

    returns

    multiplication result as a new instance

  9. def normalized(): Vector

    Gets the vector normalized

    Gets the vector normalized

    returns

    a new normalized instance of this vector

  10. def subtract(v: Vector): Vector

    Vector subtraction.

    Vector subtraction. Leaves this vector unchanged.

    v

    vector to subtract

    returns

    subtraction result as a new instance