WPILibC++  2018.4.1-20180824234721-1176-gd6d5321
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
double Dot(const Vector2d &vec) const
Returns dot product of this vector with argument.
double Magnitude() const
Returns magnitude of vector.
double ScalarProject(const Vector2d &vec) const
Returns scalar projection of this vector onto argument.
void Rotate(double angle)
Rotate a vector in Cartesian space.
This is a 2D vector struct that supports basic vector operations.
Definition: Vector2d.h:15