-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector3d.h
More file actions
35 lines (30 loc) · 863 Bytes
/
Copy pathvector3d.h
File metadata and controls
35 lines (30 loc) · 863 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
#ifndef VECTOR3D_H
#define VECTOR3D_H
#include <string>
#include <vector>
using namespace std;
class vector3D {
public:
vector3D(double _X, double _Y, double _Z);
double X, Y, Z;
vector3D operator+(vector3D v);
vector3D operator-(vector3D v);
vector3D operator*(double v);
double operator[](int i);
bool operator==(vector3D& v);
bool compare(double v);
// Calculate norm of vector
double getNorm();
// Normalize vector that changes XYZ
void NormalizeYourself();
// Calculate normalized vector
vector3D getNormalizedVector();
string print();
};
double getdist(vector3D& u, vector3D& v);
double getScalarproduct(
vector3D& u,
vector3D& v); // Calculate scalar product of 2 vectors (u and v)
double getProjection(vector3D& u,
vector3D& v); // Calculate projection of 2 vectors
#endif // VECTOR3D_H