Documentation Index
Fetch the complete documentation index at: https://mintlify.com/saquer916/odyssey/llms.txt
Use this file to discover all available pages before exploring further.
Vector2d is an immutable 2D vector used throughout Odyssey for positions, tangents, and accelerations. Because every field is final and every operation returns a new Vector2d, instances are safe to share freely between components without defensive copying. The class is the foundation for Pose2d geometry operations, Bézier curve point and tangent evaluation, and all HeadingInterpolator computations.
Package: org.firstinspires.ftc.teamcode.odyssey.geometry
Constructor
Methods
Accessors
Returns the x component of the vector.
Returns the y component of the vector.
Returns the Euclidean length of the vector, computed as
Math.hypot(x, y). This is numerically stable for very large or very small components.Returns the angle from the positive x-axis to this vector, computed as
Math.atan2(y, x). The result is in radians in the range (−π, π].Arithmetic operations
Returns a new
Vector2d whose components are the element-wise sum of this vector and other.Vector to add.
Returns a new
Vector2d whose components are this vector minus other component-wise.Vector to subtract.
Returns a new
Vector2d with both components multiplied by factor. Equivalent to scalar multiplication.Scalar multiplier.
Returns the unit vector in the same direction. If the magnitude is exactly
0.0, returns Vector2d(0, 0) instead of throwing a divide-by-zero error.Geometric operations
Returns this vector rotated by Rotation preserves the vector’s magnitude. Used internally by
theta radians counter-clockwise, using the standard 2D rotation matrix:Pose2d.toRobotFrame and Pose2d.toFieldFrame.Rotation angle in radians, counter-clockwise positive.
Returns the scalar dot product
x·other.x + y·other.y. A result of 0 means the vectors are perpendicular.Second vector operand.
Returns the 2D cross product as a scalar:
x·other.y − y·other.x. A positive result means other is counter-clockwise from this; negative means clockwise.Second vector operand.
Example
All
Vector2d instances are immutable. Methods like add, scale, and rotateVector always return a new Vector2d — they never modify the receiver. Hold on to the returned value; discarding it silently loses the result.