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 | class Vector3
{
public:
Vector3();
Vector3(const Vector3& rhs);
explicit Vector3(Math::Real x, Math::Real y, Math::Real z);
explicit Vector3(const Math::Real* v);
Vector3& operator= (const Vector3& rhs);
bool operator== (const Vector3& rhs) const;
bool operator!= (const Vector3& rhs) const;
bool operator< (const Vector3& rhs) const;
bool operator> (const Vector3& rhs) const;
Vector3& operator+= (const Vector3& rhs);
Vector3& operator-= (const Vector3& rhs);
Vector3& operator/= (const Math::Real& rhs);
Vector3& operator*= (const Math::Real& rhs);
bool Equal(const Vector3& rhs, Math::Real tolerance = Math::Epsilon) const;
bool NotEqual(const Vector3& rhs, Math::Real tolerance = Math::Epsilon) const;
bool Less(Math::Real rhs) const;
bool Greater(Math::Real rhs) const;
void Normalize();
void NormalizeSafe();
void Reflect(const Vector3& normal);
Math::Real Magnitude() const;
Math::Real MagnitudeSquared() const;
Math::Real DotProduct(const Vector3& v) const;
Vector3 CrossProduct(const Vector3& v) const;
const Math::Real* Data() const;
const Math::Real& x() const;
const Math::Real& y() const;
const Math::Real& z() const;
Math::Real* Data();
Math::Real& x();
Math::Real& y();
Math::Real& z();
static bool Equal(const Vector3& lhs, const Vector3& rhs);
static bool NotEqual(const Vector3& lhs, const Vector3& rhs);
static bool Less(const Vector3& lhs, const Vector3& rhs);
static bool Greater(const Vector3& lhs, const Vector3& rhs);
static Real DotProduct(const Vector3& lhs, const Vector3& rhs);
static Real MagnitudeSquared(const Vector3& v);
static Real Magnitude(const Vector3& v);
static Real MagnitudeSafe(const Vector3& v);
static Vector3 CrossProduct(const Vector3& lhs, const Vector3& rhs);
static Vector3 Reflect(const Vector3& v, const Vector3& normal);
static Vector3 Normalize(const Vector3& v);
static Vector3 NormalizeSafe(const Vector3& v);
private:
friend Vector3 operator+ (const Vector3& lhs, const Vector3& rhs);
friend Vector3 operator- (const Vector3& lhs, const Vector3& rhs);
friend Vector3 operator/ (const Vector3& lhs, const Math::Real& rhs);
friend Vector3 operator* (const Vector3& lhs, const Math::Real& rhs);
friend Vector3 operator/ (const Math::Real& lhs, const Vector3& rhs);
friend Vector3 operator* (const Math::Real& lhs, const Vector3& rhs);
Math::Real m_data[3];
};
Vector3 operator+ (const Vector3& lhs, const Vector3& rhs);
Vector3 operator- (const Vector3& lhs, const Vector3& rhs);
Vector3 operator/ (const Vector3& lhs, const Math::Real& rhs);
Vector3 operator* (const Vector3& lhs, const Math::Real& rhs);
Vector3 operator/ (const Math::Real& lhs, const Vector3& rhs);
Vector3 operator* (const Math::Real& lhs, const Vector3& rhs);
|