Vector2D

io.github.srs.utils.geometry2d.Vector2D$package.Vector2D
object Vector2D

Companion object for Vector2D, providing utility methods for vector operations.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Vector2D.type

Members list

Value members

Concrete methods

def apply(x: Double, y: Double): Vector2D

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

extension (v: Vector2D)
def project(line: Line): Vector2D

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

def rotate(angle: Orientation): Vector2D

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