-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector2.h
More file actions
29 lines (22 loc) · 797 Bytes
/
vector2.h
File metadata and controls
29 lines (22 loc) · 797 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
#pragma once
#include <iostream>
namespace libMesh {
struct Vector2 {
public:
Vector2();
Vector2(float x, float y);
Vector2(const Vector2& other);
float x;
float y;
static Vector2 XAxis() { return Vector2(1.0f, 0.0f); }
static Vector2 YAxis() { return Vector2(0.0f, 1.0f); }
float dot(Vector2 other);
void scale(float value);
Vector2 scaled(float value);
bool operator ==(const Vector2& other) const;
bool operator !=(const Vector2& other) const;
friend std::ostream& operator <<(std::ostream& os, const Vector2& v) {
return os << "Vector2(" << v.x << ", " << v.y << ")";
}
};
}