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);
151 void set(
float vx,
float vy,
float vz)
162 return CalVector(v.x + u.x, v.y + u.y, v.z + u.z);
167 return CalVector(v.x - u.x, v.y - u.y, v.z - u.z);
172 return CalVector(v.x * d, v.y * d, v.z * d);
177 return CalVector(v.x * d, v.y * d, v.z * d);
182 return CalVector(v.x / d, v.y / d, v.z / d);
187 return v.x * u.x + v.y * u.y + v.z * u.z;
192 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:201
The bounding box class.
Definition: vector.h:220
The matrix class.
Definition: matrix.h:34
The vector class.
Definition: vector.h:36
The quaternion class.
Definition: quaternion.h:35