Vector2D

utils.Vector2D
See theVector2D companion class
object Vector2D

Companion object for Vector2D containing utility methods and constants.

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector2D.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply(): Vector2D

Creates a zero vector.

Creates a zero vector.

Alternative constructor that returns the zero vector without parameters.

Attributes

Returns

the zero vector Vector2D(0.0, 0.0)

def direction(from: Vector2D, to: Vector2D): Vector2D

Calculates the unit direction vector from one point to another.

Calculates the unit direction vector from one point to another.

Returns a normalized vector pointing from the first vector to the second. If the vectors are the same, returns the zero vector.

Value parameters

from

the starting vector

to

the target vector

Attributes

Returns

a unit vector pointing from 'from' to 'to'

def distance(u: Vector2D, v: Vector2D): Double

Calculates the Euclidean distance between two vectors.

Calculates the Euclidean distance between two vectors.

Computes the magnitude of the difference vector between the two points.

Value parameters

u

the first vector

v

the second vector

Attributes

Returns

the distance between the vectors as a non-negative double

Concrete fields

val zero: Vector2D

The zero vector (origin point).

The zero vector (origin point).

A constant representing the vector with both components equal to 0.0.

Attributes