vector3 Struct Reference
3 component vector
More...
#include <3dmath.h>
List of all members.
Detailed Description
3 component vector
Definition at line 58 of file 3dmath.h.
Constructor & Destructor Documentation
| vector3::vector3 |
( |
float |
_x = 0, |
|
|
float |
_y = 0, |
|
|
float |
_z = 0 | |
|
) |
| | [inline] |
Constructor.
Definition at line 72 of file 3dmath.h.
00072 : x(_x), y(_y), z(_z) {}
| vector3::vector3 |
( |
const float * |
v |
) |
[inline] |
Constructor.
Definition at line 74 of file 3dmath.h.
00074 : x(v[0]), y(v[1]), z(v[2]) {}
| vector3::vector3 |
( |
const vector3 & |
v |
) |
[inline] |
Copy constructor.
Definition at line 76 of file 3dmath.h.
00076 : x(v.x), y(v.y), z(v.z) {}
Member Function Documentation
Assignment operator.
Definition at line 79 of file 3dmath.h.
00080 {
00081 x = v.x;
00082 y = v.y;
00083 z = v.z;
00084 return *this;
00085 }
| float vector3::operator[] |
( |
unsigned |
i |
) |
const [inline] |
Get component.
Definition at line 88 of file 3dmath.h.
00089 {
00090 return _v[i];
00091 }
Subtract operator.
Definition at line 94 of file 3dmath.h.
| vector3 vector3::operator- |
( |
|
) |
const [inline] |
Unary operator.
Definition at line 100 of file 3dmath.h.
| vector3 vector3::operator* |
( |
float |
f |
) |
const [inline] |
Scalar multiply operator.
Definition at line 112 of file 3dmath.h.
00113 {
00114 return vector3(f*x, f*y, f*z);
00115 }
| vector3 vector3::operator/ |
( |
float |
f |
) |
const [inline] |
Scalar divide operator.
Definition at line 124 of file 3dmath.h.
00125 {
00126 float div = 1.0f/f;
00127 return operator*(div);
00128 }
Add assignment operator.
Definition at line 138 of file 3dmath.h.
00139 {
00140 x += v.x;
00141 y += v.y;
00142 z += v.z;
00143 return *this;
00144 }
Subtract assignment operator.
Definition at line 147 of file 3dmath.h.
00148 {
00149 x -= v.x;
00150 y -= v.y;
00151 z -= v.z;
00152 return *this;
00153 }
| vector3& vector3::operator*= |
( |
float |
f |
) |
[inline] |
Multiply assignment operator.
Definition at line 156 of file 3dmath.h.
00157 {
00158 x *= f;
00159 y *= f;
00160 z *= f;
00161 return *this;
00162 }
| vector3& vector3::operator/= |
( |
float |
f |
) |
[inline] |
Divide assignment operator.
Definition at line 165 of file 3dmath.h.
00166 {
00167 x /= f;
00168 y /= f;
00169 z /= f;
00170 return *this;
00171 }
| bool vector3::operator== |
( |
const vector3 & |
v |
) |
const [inline] |
Equal operator.
Definition at line 174 of file 3dmath.h.
00175 {
00176 return (x == v.x) && ( y == v.y) && (z == v.z);
00177 }
| bool vector3::operator!= |
( |
const vector3 & |
v |
) |
const [inline] |
Not Equal operator.
Definition at line 180 of file 3dmath.h.
00181 {
00182 return (x != v.x) || ( y != v.y) || (z != v.z);
00183 }
| bool vector3::operator< |
( |
const vector3 & |
v |
) |
const [inline] |
Less then operator.
Definition at line 186 of file 3dmath.h.
00187 {
00188 return (x < v.x) || ((x == v.x) && ( y < v.y)) || ((x == v.x) && ( y == v.y) && (z < v.z));
00189 }
| float vector3::Dot |
( |
const vector3 & |
v |
) |
const [inline] |
Get dot product.
Definition at line 192 of file 3dmath.h.
00193 {
00194 return x * v.x + y * v.y + z * v.z;
00195 }
Get cross product.
Definition at line 198 of file 3dmath.h.
| vector3 vector3::Normalize |
( |
|
) |
const [inline] |
Get normalized vector.
Definition at line 204 of file 3dmath.h.
| float vector3::LengthSq |
( |
|
) |
const [inline] |
Get squared length.
Definition at line 211 of file 3dmath.h.
00212 {
00213 return x*x + y*y + z*z;
00214 }
| float vector3::Length |
( |
|
) |
const [inline] |
Get length.
Definition at line 217 of file 3dmath.h.
00218 {
00219 return sqrtf(x*x + y*y + z*z);
00220 }
| wxString vector3::ToString |
( |
|
) |
const [inline] |
Get string.
Definition at line 223 of file 3dmath.h.
00224 {
00225 return wxString(wxT("(")) << x << wxT(", ") << y << wxT(", ") << z << wxT(")");
00226 }
| vector3* vector3::Clone |
( |
|
) |
const [inline] |
Get copy of instance.
Definition at line 235 of file 3dmath.h.
00236 {
00237 return new vector3(*this);
00238 }
Friends And Related Function Documentation
Scalar multiply operator.
Definition at line 118 of file 3dmath.h.
00119 {
00120 return vector3(f*v.x, f*v.y, f*v.z);
00121 }
Scalar divide operator.
Definition at line 131 of file 3dmath.h.
00132 {
00133 float div = 1.0f/f;
00134 return v*div;
00135 }
| std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const vector3 & |
v | |
|
) |
| | [friend] |
Output stream operator.
Definition at line 229 of file 3dmath.h.
00230 {
00231 return os << "(" << v.x << ", " << v.y << ", " << v.z << ")";
00232 }
Definition at line 240 of file 3dmath.h.
00240 {
00241 return (a-b).Length();
00242 }
Definition at line 243 of file 3dmath.h.
00243 {
00244 return (a-b).LengthSq();
00245 }
Member Data Documentation
Components.
Definition at line 65 of file 3dmath.h.
Components.
Definition at line 68 of file 3dmath.h.
The documentation for this struct was generated from the following file:
- /cygdrive/d/src/svn/vrut/trunk/core/src/3dmath.h