Package edu.wpi.first.wpilibj.drive
Class Vector2d
java.lang.Object
edu.wpi.first.wpilibj.drive.Vector2d
public class Vector2d extends Object
This is a 2D vector struct that supports basic vector operations.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description double
dot(Vector2d vec)
Returns dot product of this vector with argument.double
magnitude()
Returns magnitude of vector.void
rotate(double angle)
Rotate a vector in Cartesian space.double
scalarProject(Vector2d vec)
Returns scalar projection of this vector onto argument.
-
Field Details
-
Constructor Details
-
Method Details
-
rotate
Rotate a vector in Cartesian space.- Parameters:
angle
- angle in degrees by which to rotate vector counter-clockwise.
-
dot
Returns dot product of this vector with argument.- Parameters:
vec
- Vector with which to perform dot product.- Returns:
- Dot product of this vector with argument.
-
magnitude
Returns magnitude of vector.- Returns:
- Magnitude of vector.
-
scalarProject
Returns scalar projection of this vector onto argument.- Parameters:
vec
- Vector onto which to project this vector.- Returns:
- scalar projection of this vector onto argument.
-