18 #include "cal3d/global.h" 19 #include "cal3d/matrix.h" 44 inline CalVector(): x(0.0f), y(0.0f), z(0.0f) {};
46 inline CalVector(
float vx,
float vy,
float vz): x(vx), y(vy), z(vz) {};
51 inline float& operator[](
unsigned int i)
56 inline const float& operator[](
unsigned int i)
const 68 inline void operator+=(
const CalVector& v)
76 inline void operator-=(
const CalVector& v)
83 inline void operator*=(
const float d)
92 inline void operator*=(
const CalMatrix &m)
97 x = m.dxdx*ox + m.dxdy*oy + m.dxdz*oz;
98 y = m.dydx*ox + m.dydy*oy + m.dydz*oz;
99 z = m.dzdx*ox + m.dzdy*oy + m.dzdz*oz;
102 inline void operator/=(
const float d)
109 inline bool operator==(
const CalVector& v)
const 111 return ((x == v.x) && (y == v.y) && (z == v.z));
114 inline bool operator!=(
const CalVector& v)
const 116 return !operator==(v);
119 inline void blend(
float d,
const CalVector& v)
133 inline float length()
const 135 return (
float)sqrt(x * x + y * y + z * z);
137 inline float normalize()
141 length = (float) sqrt(x * x + y * y + z * z);
143 float lenRecip = 1.0f / length;
153 void set(
float vx,
float vy,
float vz)
164 return CalVector(v.x + u.x, v.y + u.y, v.z + u.z);
169 return CalVector(v.x - u.x, v.y - u.y, v.z - u.z);
174 return CalVector(v.x * d, v.y * d, v.z * d);
179 return CalVector(v.x * d, v.y * d, v.z * d);
184 return CalVector(v.x / d, v.y / d, v.z / d);
189 return v.x * u.x + v.y * u.y + v.z * u.z;
194 return CalVector(v.y * u.z - v.z * u.y, v.z * u.x - v.x * u.z, v.x * u.y - v.y * u.x);
The plane class.
Definition: vector.h:203
The bounding box class.
Definition: vector.h:222
The matrix class.
Definition: matrix.h:34
The vector class.
Definition: vector.h:36
The quaternion class.
Definition: quaternion.h:35