-
Notifications
You must be signed in to change notification settings - Fork 0
/
tanvector.h
42 lines (36 loc) · 1.27 KB
/
tanvector.h
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
#ifndef TANVECTOR_H
#define TANVECTOR_H
class TanVector
{
public:
TanVector();
TanVector(double x, double y, double z);
private:
static double _TOLERANCE_;
double x;
double y;
double z;
public:
static void setTolerance(double tolerance);
double getX() const;
double getY() const;
double getZ() const;
void setX(double x);
void setY(double y);
void setZ(double z);
public:
double length() const;
TanVector normalize() const;
double distanceTo(const TanVector & vec) const;
static TanVector crossProduct(const TanVector & vec1, const TanVector & vec2);
static bool opposite(const TanVector & vec1, const TanVector & vec2);
friend bool operator < (const TanVector & vec1, const TanVector & vec2);
friend TanVector operator + (const TanVector & vec1, const TanVector & vec2);
friend TanVector operator - (const TanVector & vec1, const TanVector & vec2);
friend TanVector operator * (double scale, const TanVector & vec);
};
bool operator < (const TanVector & vec1, const TanVector & vec2);
TanVector operator + (const TanVector & vec1, const TanVector & vec2);
TanVector operator - (const TanVector & vec1, const TanVector & vec2);
TanVector operator * (double scale, const TanVector & vec);
#endif // TANVECTOR_H