-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector3D.h
More file actions
144 lines (119 loc) · 3.45 KB
/
Vector3D.h
File metadata and controls
144 lines (119 loc) · 3.45 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
Vector: The vector interface
@file vector3D.h
@author Adanna Obibuaku
@date 14/11/20
*/
#ifndef IO
#define IO
#include <iostream>
using namespace std;
#endif
#define SIZE 3
class Vector3D {
public:
/*
* Consturctor: creates our vector
* Input:
* x (int): The x componet of the vector
* y (int): The y componet of the vector
* z (int): The z componet of the vector
*/
Vector3D(float x, float y, float z);
/*
* Consturctor: No input, will initialize with
* default values.
*/
Vector3D();
/*
* magnitude: Find the magnitude of this vector
*/
float magnitude();
/*
* unit: Caculate the unit of our vector
*/
Vector3D unit();
/*
* orthongonal: will caculate if the vectors are orthogonal (vectors) are perpendicular
* Input:
* rhs (Vector): The vector in the right hand said
* Output:
* (bool): Denotes True when two vectors are perpendicular or false when not.
*/
Vector3D orthogonal(Vector3D rhs);
/*
* getX: This will get the x componet
* Ouput:
* (float): componet x of the vector
*/
float getX();
/*
* getY: This will get the y componet
* Output:
* (float): componet y of the vector
*/
float getY();
/*
* getZ: This will get the z componet
* Output:
* (float): componet z of the vector
*/
float getZ();
/*
* Operator +: Addition of a vector
* Input:
* rhs (Vector): A given vector
* Output:
* (Vector3D): A vector equal to (this) vector additioned with the input vector
*/
Vector3D operator+ (Vector3D rhs);
/*
* Operator -: Subtraction of a vector
* Input:
* rhs (Vector): A given vector
* Output:
* (Vector3D): A vector equal to (this) vector subtracted with the input vector
*/
Vector3D operator- (Vector3D rhs);
/*
* Operator %: Vector product
* Input:
* rhs (Vector): A given vector
* Output:
* (Vector): A vector equal to the Vector product of (this) vector with the input vector
*/
Vector3D operator% (Vector3D rhs);
/*
* Operator *: Scalar product
* Input:
* rhs (Vector): A given scalae
* Output:
* (float): The scalar
*/
float operator* (Vector3D rhs);
/*
* Opertor *: Mutiple vector by scalar
* Input:
* rhs (Vector): A given scalae
* Output:
* (Vector): A vector equal to the Multiplication of (this) vector with the input vector
*/
Vector3D operator* (float scalar);
/*
* Opertor /: Vector devision
* Inputs:
* rhs (Vector): A given vector
* Output:
* (Vector): Vector with the scalar devision applied
*/
Vector3D operator/ (float scalar);
/*ostream& operator<< (ostream& outStream, const Vector &v);*/
private:
float static const DEFAULT_X;
float static const DEFAULT_Y;
float static const DEFAULT_Z;
float x;
float y;
float z;
};
ostream& operator<< (ostream& ostream , Vector3D& v);