Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vect3d.h
Go to the documentation of this file.
1 #pragma once
2 
3 #pragma pack(push, 1)
4 
5 // unions don't like structs with assignment operators
6 /*struct _vect3d
7 {
8  float x;
9  float y;
10  float z;
11 };*/
12 
13 struct vect3d
14 {
15  float x;
16  float y;
17  float z;
18 
19  vect3d() {x = 0; y = 0; z = 0; }
20  vect3d(const vect3d& other) : x(other.x), y(other.y), z(other.z){}
21 
22  vect3d& operator=(const vect3d& rhs)
23  {
24  x = rhs.x;
25  y = rhs.y;
26  z = rhs.z;
27  return *this;
28  }
29 
30  vect3d& operator*=(float rhs)
31  {
32  x *= rhs;
33  y *= rhs;
34  z *= rhs;
35  return *this;
36  }
37 };
38 
39 // only used to check if a vector hasn't changed (fpu comparisons are bad)
40 inline bool operator==(const vect3d& lhs, const vect3d& rhs)
41 {
42  return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z;
43 }
44 
45 inline bool operator!=(const vect3d& lhs, const vect3d& rhs)
46 {
47  return !(lhs == rhs);
48 }
49 
50 #pragma pack(pop)