-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector.h
More file actions
57 lines (42 loc) · 1.44 KB
/
Copy pathVector.h
File metadata and controls
57 lines (42 loc) · 1.44 KB
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
52
53
54
55
56
57
#pragma once
#include <string>
class Vector
{
private:
float m_x = 0.0f; // Vector X Coord - defaults to 0.0f
float m_y = 0.0f; // Vector Y Coord - defaults to 0.0f
float m_z = 0.0f; // Vector Z Coord - defaults to 0.0f
float m_a = 0.0f; // Additional Vector property for 4D Vectors (i.e. RGBA) - defaults to 0.0f
public:
Vector(); // Constructor
Vector(float x, float y); // 2D Constructor
Vector(float x, float y, float z); // 3D Constructor
Vector(float x, float y, float z, float a); // 4D/Color Constructor
Vector operator-();
Vector operator+(Vector const &);
Vector operator-(Vector const &);
Vector operator*(float const&);
Vector operator+=(Vector const &);
Vector operator-=(Vector const &);
Vector operator*=(float const&);
bool operator==(Vector const&);
bool operator!=(Vector const&);
// Setters
void setX(float x);
void setY(float y);
void setZ(float z);
void setA(float a);
Vector scale(float s); // multiply each value by s, return new values
// Getters
float getX();
float getY();
float getZ();
float getA();
float pythagorean2D(); // Return the result of the applying the Pythagorean Theorem to the X and Y coords
float pythagorean3D(); // Return the result of the applying the Pythagorean Theorem to the X, Y, and Z coords
// Normalizers
void normalize2D();
void normalize3D();
// Prints out the Vector's info as a string
std::string toString();
};