Vector2D
Companion object for Vector2D, providing utility methods for vector operations.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Vector2D.type
Members list
Value members
Concrete methods
Creates a new Vector2D instance from the given x and y coordinates.
Creates a new Vector2D instance from the given x and y coordinates.
Value parameters
- x
-
the x-coordinate of the vector
- y
-
the y-coordinate of the vector
Attributes
- Returns
-
a new Vector2D instance representing the vector in 2D space
Extensions
Extensions
Projects the vector onto a line defined by its origin and direction.
Projects the vector onto a line defined by its origin and direction.
Value parameters
- line
-
the line onto which the vector will be projected
Attributes
- Returns
-
a new Vector2D instance representing the projection of the vector onto the line
Rotates the vector by the specified angle.
Rotates the vector by the specified angle.
Value parameters
- angle
-
the angle to rotate the vector by
Attributes
- Returns
-
a new Vector2D instance representing the rotated vector