class Vector2D extends AnyRef
- Alphabetic
- By Inheritance
- Vector2D
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Vector2D(v: Coordinate)
- new Vector2D(from: Coordinate, to: Coordinate)
- new Vector2D(v: Vector2D)
The Y component of this vector.
- new Vector2D(x: Double = 0.0, y: Double = 0.0)
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
- def add(v: Vector2D): Vector2D
- def angle(v: Vector2D): Double
- def angle: Double
- def angleTo(v: Vector2D): Double
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def average(v: Vector2D): Vector2D
- def clone(): Vector2D
Creates a copy of this vector
Creates a copy of this vector
return a copy of this vector
- Definition Classes
- Vector2D → AnyRef
- def distance(v: Vector2D): Double
Computes the distance between this vector and another one.
Computes the distance between this vector and another one.
- v
a vector return the distance between the vectors
- def divide(d: Double): Vector2D
Divides the vector by a scalar value.
Divides the vector by a scalar value.
- d
the value to divide by return a new vector with the value v / d
- def dot(v: Vector2D): Double
Computes the dot-product of two vectors
Computes the dot-product of two vectors
- v
a vector return the dot product of the vectors
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(o: Any): Boolean
Tests if a vector o has the same values for the x and y components.
Tests if a vector o has the same values for the x and y components.
- o
a Vector2D with which to do the comparison. return true if other is a Vector2D with the same values for the x and y components.
- Definition Classes
- Vector2D → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getComponent(index: Int): Double
- def getX: Double
- def getY: Double
- def hashCode(): Int
Gets a hashcode for this vector.
Gets a hashcode for this vector.
return a hashcode for this vector
- Definition Classes
- Vector2D → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isParallel(v: Vector2D): Boolean
- def length: Double
- def lengthSquared: Double
- def multiply(d: Double): Vector2D
Multiplies the vector by a scalar value.
Multiplies the vector by a scalar value.
- d
the value to multiply by return a new vector with the value v * d
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def negate: Vector2D
- def normalize: Vector2D
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def rotate(angle: Double): Vector2D
- def rotateByQuarterCircle(numQuarters: Int): Vector2D
Rotates a vector by a given number of quarter-circles (i.e.
Rotates a vector by a given number of quarter-circles (i.e. multiples of 90 degrees or Pi/2 radians). A positive number rotates counter-clockwise, a negative number rotates clockwise. Under this operation the magnitude of the vector and the absolute values of the ordinates do not change, only their sign and ordinate index.
- numQuarters
the number of quarter-circles to rotate by return the rotated vector.
- def subtract(v: Vector2D): Vector2D
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toCoordinate: Coordinate
- def toString(): String
Gets a string representation of this vector
Gets a string representation of this vector
return a string representing this vector
- Definition Classes
- Vector2D → AnyRef → Any
- def translate(coord: Coordinate): Coordinate
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()
- def weightedSum(v: Vector2D, frac: Double): Vector2D
Computes the weighted sum of this vector with another vector, with this vector contributing a fraction of frac to the total.
Computes the weighted sum of this vector with another vector, with this vector contributing a fraction of frac to the total.
In other words,
sum = frac * this + (1 - frac) * v
- v
the vector to sum
- frac
the fraction of the total contributed by this vector return the weighted sum of the two vectors
- val x: Double
- Attributes
- protected
- val y: Double
- Attributes
- protected