forked from cleroy8/PositionBasedDynamics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvec2.h
More file actions
51 lines (35 loc) · 943 Bytes
/
Copy pathvec2.h
File metadata and controls
51 lines (35 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef VEC2_H
#define VEC2_H
#include <cmath>
#include <iostream>
/**
* @brief The Vec2 class implements 2-dimensional vectors with float coordinates.
*/
class Vec2 {
public:
/**
* @brief Vec2 Constructor for 2D vector
* @param x_
* @param y_
*/
Vec2(float x_, float y_);
/**
* @brief Vec2 default constructor for Vec2
* default value is (0,0)
*/
Vec2();
const Vec2 operator+(const Vec2& v) const;
const Vec2 operator-(const Vec2& v) const;
const Vec2 operator*(const float scal) const;
friend const Vec2 operator*(const float scal, Vec2 const& v);
friend std::ostream& operator<<(std::ostream& out, Vec2 const& v);
const float dotProduct(const Vec2& v) const;
const float squaredLength() const;
const float length() const;
const float& getX() const;
const float& getY() const;
private:
float x;
float y;
};
#endif // VEC2_H