Vector2d

class wpilib.drive.Vector2d(x=0.0, y=0.0)[source]

Bases: object

This is a 2D vector struct that supports basic operations

Construct a 2D vector

Parameters:
  • x – x component of the vector
  • y – y component of the vector
dot(vec)[source]

Returns dot product of this vector and argument

Parameters:vec (Vector2d) – Vector with which to perform dot product
magnitude()[source]

Returns magnitude of vector

rotate(angle)[source]

Rotate a vector in Cartesian space.

Parameters:angle – Angle in degrees by which to rotate vector counter-clockwise
scalarProject(vec)[source]

Returns scalar projection of this vector onto argument

Parameters:vec (Vector2d) – Vector onto which to project this vector
Returns:scalar projection of this vector onto argument