|
RIT VEXU Core API
|
#include <translation2d.h>
Public Member Functions | |
| constexpr | LinearVector2d () |
| Default Constructor for LinearVector2d valued (0, 0). | |
| constexpr | LinearVector2d (Q x, Q y) |
| constexpr | LinearVector2d (Q r, Rotation2d theta) |
| constexpr | LinearVector2d (Eigen::Vector2d vector, Q unit) |
| constexpr Q | x () const |
| Gets the x component. | |
| constexpr double | x (Q unit) const |
| Gets x in the supplied unit. | |
| constexpr void | set_x (Q val) |
| Sets the x component. | |
| constexpr Q | y () const |
| Gets the y component. | |
| constexpr double | y (Q unit) const |
| Gets y in the supplied unit. | |
| constexpr void | set_y (Q val) |
| Sets the y component. | |
| constexpr Rotation2d | theta () const |
| Gets the angle of the vector from the x axis. | |
| constexpr Eigen::Vector2d | as_vector (Q unit) const |
| constexpr Q | norm () const |
| Gets the norm of the vector. | |
| constexpr LinearVector2d | normalize (Q magnitude=Q(1.0)) const |
| constexpr Q | distance (LinearVector2d other) const |
| Gets the distance between two vectors. | |
| constexpr LinearVector2d | interpolate (LinearVector2d end, double fraction) const |
| constexpr LinearVector2d | rotate_by (Rotation2d rotation) const |
| constexpr LinearVector2d | rotate_around (LinearVector2d other, Rotation2d rotation) const |
| constexpr LinearVector2d | inverse () const |
| constexpr units::Multiplied< Q, Q > | dot (LinearVector2d other) const |
| constexpr LinearVector2d | operator+ (LinearVector2d other) const |
| Adds another vector to this vector component wise. | |
| constexpr LinearVector2d & | operator+= (LinearVector2d other) |
| Adds another vector to this vector component wise. | |
| constexpr LinearVector2d | operator- (LinearVector2d other) const |
| Subtracts another vector from this vector component wise. | |
| constexpr LinearVector2d & | operator-= (LinearVector2d other) |
| Subtracts another vector from this vector component wise. | |
| constexpr LinearVector2d | operator- () const |
| Inverts this vector (flipped across origin). | |
| constexpr LinearVector2d | operator* (double scalar) const |
| Multiplies this vector by a scalar. | |
| template<units::IsQuantity S> requires LinearKinematicQuantity<units::Multiplied<Q, S>> | |
| constexpr LinearVector2d< units::Multiplied< Q, S > > | operator* (S scalar) const |
| constexpr units::Multiplied< Q, Q > | operator* (LinearVector2d other) const |
| constexpr LinearVector2d & | operator*= (double scalar) |
| Multiplies this vector by a scalar. | |
| constexpr LinearVector2d | operator/ (double scalar) const |
| Divides this vector by a scalar. | |
| constexpr LinearVector2d & | operator/= (double scalar) |
| Divides this vector by a scalar. | |
| constexpr bool | operator== (LinearVector2d other) const |
| Checks exact equality between this and another vector. | |
| constexpr bool | is_near (LinearVector2d other, Q tolerance=Q(1e-6)) const |
Static Public Member Functions | |
| static constexpr LinearVector2d | mean (const std::vector< LinearVector2d > &list) |
Friends | |
| constexpr LinearVector2d | operator* (double scalar, LinearVector2d vector) |
| Multiplies a scalar by this vector. | |
| template<units::IsQuantity S> requires LinearKinematicQuantity<units::Multiplied<Q, S>> | |
| constexpr auto | operator* (S scalar, LinearVector2d vector) |
Class representing a 2d vector. Depending on unit this could be a Translation2d, Velocity2d, Acceleration2d, Jerk2d, or other
Assumes conventional cartesian coordinate system: Looking down at the coordinate plane, +X is right +Y is up +Theta is counterclockwise
|
inlineconstexpr |
Constructs a vector with the given x and y values.
| x | The x component of the vector. |
| y | The y component of the vector. |
|
inlineconstexpr |
Constructs a vector given polar coordinates of the form (r, theta).
| r | The magnitude of the vector. |
| theta | The angle of the vector. |
|
inlineconstexpr |
Constructs a vector with the values from the given Eigen::Vector.
| vector | The vector whose values will be used. |
| unit | The unit to use when assigning x and y (e.g. units::inches) |
|
inlineconstexpr |
Returns the vector as an Eigen::Vector2d.
| unit | The unit to get the x and y components as (e.g. units::inches) |
|
inlineconstexpr |
Returns the dot product of two vectors. The result has the product of the two component units.
[scalar] = [x][otherx] + [y][othery]
| other | the other vector to dot with. |
|
inlineconstexpr |
Interpolates along a straight line to another vector. Fractions outside [0, 1] return the nearest endpoint.
| end | endpoint |
| fraction | percent of the way between the points |
|
inlineconstexpr |
Returns the inverse of this vector, or mirrors it across the origin. [x] = [-x] [y] = [-y]
|
inlineconstexpr |
Checks the distance between vectors against a tolerance. Defaults to 1um for translations, 1um/s for velocities, etc.
|
inlinestaticconstexpr |
Calculates the mean of a list of vectors.
| list | std::vector containing a list of vectors. |
|
inlineconstexpr |
Returns a vector of the same angle, but specific magnitude (default 1 base unit)
| magnitude | magnitude of the vector (default 1 base unit). |
|
inlineconstexpr |
Returns the dot product of two vectors. The result has the product of the two component units.
[scalar] = [x][otherx] + [y][othery]
| other | the other vector to dot with. |
|
inlineconstexpr |
Multiplies this vector by a scalar with a unit of time. e.g. Velocity2d * Time = Translation2d
|
inlineconstexpr |
Applies a rotation to this vector around another given vector.
[x] = [cos, -sin][x - otherx] + [otherx] [y] = [sin, cos][y - othery] + [othery]
| other | the center of rotation. |
| rotation | the angle amount the vector will be rotated. |
|
inlineconstexpr |
Rotates this vector around the origin by the provided rotation.
Equivalent to multiplying a vector by a rotation matrix: x = [cos, -sin][x] y = [sin, cos][y]
| rotation | the angle amount to rotate. |
|
friend |
Multiplies a scalar with a unit of time by this vector. e.g. Time * Velocity2d = Translation2d