WPILibC++  2020.3.2
Vector2d.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 namespace frc {
11 
15 struct Vector2d {
16  Vector2d() = default;
17  Vector2d(double x, double y);
18 
24  void Rotate(double angle);
25 
31  double Dot(const Vector2d& vec) const;
32 
36  double Magnitude() const;
37 
43  double ScalarProject(const Vector2d& vec) const;
44 
45  double x = 0.0;
46  double y = 0.0;
47 };
48 
49 } // namespace frc
frc::Vector2d::Magnitude
double Magnitude() const
Returns magnitude of vector.
frc::Vector2d::Dot
double Dot(const Vector2d &vec) const
Returns dot product of this vector with argument.
frc::Vector2d::ScalarProject
double ScalarProject(const Vector2d &vec) const
Returns scalar projection of this vector onto argument.
frc::Vector2d
This is a 2D vector struct that supports basic vector operations.
Definition: Vector2d.h:15
frc::Vector2d::Rotate
void Rotate(double angle)
Rotate a vector in Cartesian space.
frc
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16