5 inline _D3DVECTOR::_D3DVECTOR(D3DVALUE f)
11 _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
18 inline _D3DVECTOR::_D3DVECTOR(const D3DVALUE f[3])
25 inline const D3DVALUE& _D3DVECTOR::operator[](int i) const
30 inline D3DVALUE& _D3DVECTOR::operator[](int i)
35 inline _D3DVECTOR& _D3DVECTOR::operator += (const _D3DVECTOR& v)
43 inline _D3DVECTOR& _D3DVECTOR::operator -= (const _D3DVECTOR& v)
51 inline _D3DVECTOR& _D3DVECTOR::operator *= (const _D3DVECTOR& v)
59 inline _D3DVECTOR& _D3DVECTOR::operator /= (const _D3DVECTOR& v)
67 inline _D3DVECTOR& _D3DVECTOR::operator *= (D3DVALUE s)
75 inline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s)
83 inline _D3DVECTOR operator + (const _D3DVECTOR& v)
88 inline _D3DVECTOR operator - (const _D3DVECTOR& v)
90 return _D3DVECTOR(-v.x, -v.y, -v.z);
93 inline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
95 return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
98 inline _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
100 return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
103 inline _D3DVECTOR operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
105 return _D3DVECTOR(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z);
108 inline _D3DVECTOR operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
110 return _D3DVECTOR(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z);
113 inline int operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
115 return v1[0] < v2[0] && v1[1] < v2[1] && v1[2] < v2[2];
118 inline int operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
120 return v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2];
123 inline _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s)
125 return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
128 inline _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v)
130 return _D3DVECTOR(s*v.x, s*v.y, s*v.z);
133 inline _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s)
135 return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
138 inline int operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
140 return v1.x==v2.x && v1.y==v2.y && v1.z == v2.z;
143 inline D3DVALUE Magnitude (const _D3DVECTOR& v)
145 return (D3DVALUE) sqrt(SquareMagnitude(v));
148 inline D3DVALUE SquareMagnitude (const _D3DVECTOR& v)
150 return v.x*v.x + v.y*v.y + v.z*v.z;
153 inline _D3DVECTOR Normalize (const _D3DVECTOR& v)
155 return v / Magnitude(v);
158 inline D3DVALUE Min (const _D3DVECTOR& v)
170 inline D3DVALUE Max (const _D3DVECTOR& v)
182 inline _D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
184 return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0],
185 v1[1] < v2[1] ? v1[1] : v2[1],
186 v1[2] < v2[2] ? v1[2] : v2[2]);
189 inline _D3DVECTOR Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
191 return _D3DVECTOR( v1[0] > v2[0] ? v1[0] : v2[0],
192 v1[1] > v2[1] ? v1[1] : v2[1],
193 v1[2] > v2[2] ? v1[2] : v2[2]);
196 inline D3DVALUE DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
198 return v1.x*v2.x + v1.y * v2.y + v1.z*v2.z;
201 inline _D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
204 result[0] = v1[1] * v2[2] - v1[2] * v2[1];
205 result[1] = v1[2] * v2[0] - v1[0] * v2[2];
206 result[2] = v1[0] * v2[1] - v1[1] * v2[0];
211 inline _D3DMATRIX operator* (const _D3DMATRIX& a, const _D3DMATRIX& b)
214 for (int i=0; i<4; i++)
216 for (int j=0; j<4; j++)
219 for (int k=0; k<4; k++)
221 ret(i, j) += a(i, k) * b(k, j);