Companion object for Vector2D containing utility methods and constants.
Attributes
Members list
Type members
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
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)
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'
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