32 const T &
operator[](
const size_t i)
const {
return (
const_cast<const T *
>(&
x))[i]; }
66 const T inva = T(1.0 / a);
74 const T inva = T(1.0 / a);
104 const T inv = 1.0 / scalar;
105 return vector3(a.
x * inv, a.
y * inv, a.
z * inv);
109 const T inv = 1.0 / scalar;
110 return vector3(a.
x * inv, a.
y * inv, a.
z * inv);
114 return vector3(scalar / a.
x, scalar / a.
y, scalar / a.
z);
123 return *
this + percent * (b - *
this);
127 const T l = 1.0f / sqrt(
x *
x +
y *
y +
z *
z);
132 const T lenSqr =
x *
x +
y *
y +
z *
z;
136 const T l = sqrt(lenSqr);
141 void Print()
const { printf(
"v(%f,%f,%f)\n",
x,
y,
z); }
155 T inv_poo = 1.0f / (u * u + v * v + w * w);
156 t.
x = a * (v * v + w * w) + u * (-b * v - c * w + u *
x + v *
y + w *
z) + (-a * (v * v + w * w) + u * (b * v + c * w - v *
y - w *
z) + (v * v + w * w) *
x) * cos_a +
157 sqrtf(u * u + v * v + w * w) * (-c * v + b * w - w *
y + v *
z) * sin_a;
159 t.
y = b * (u * u + w * w) + v * (-a * u - c * w + u *
x + v *
y + w *
z) + (-b * (u * u + w * w) + v * (a * u + c * w - u *
x - w *
z) + (u * u + w * w) *
y) * cos_a +
160 sqrtf(u * u + v * v + w * w) * (-c * u - a * w + w *
x - u *
z) * sin_a;
162 t.
z = c * (u * u + v * v) + w * (-a * u + b * v + u *
x + v *
y + w *
z) + (-c * (u * u + v * v) + w * (a * u + b * v - u *
x - v *
y) + (u * u + v * v) *
z) * cos_a +
163 sqrtf(u * u + v * v + w * w) * (-b * u + a * v - v *
x + u *
y) * sin_a;
177 T inv_poo = 1.0f / (u * u + v * v + w * w);
178 t.
x = u * (u *
x + v *
y + w *
z) + (u * (-v *
y - w *
z) + (v * v + w * w) *
x) * cos_a +
179 sqrtf(u * u + v * v + w * w) * (-w *
y + v *
z) * sin_a;
181 t.
y = v * (u *
x + v *
y + w *
z) + (v * (-u *
x - w *
z) + (u * u + w * w) *
y) * cos_a +
182 sqrtf(u * u + v * v + w * w) * (w *
x - u *
z) * sin_a;
184 t.
z = w * (u *
x + v *
y + w *
z) + (w * (-u *
x - v *
y) + (u * u + v * v) *
z) * cos_a +
185 sqrtf(u * u + v * v + w * w) * (-v *
x + u *
y) * sin_a;
293static_assert(
alignof(
vector3d) == 8);
294static_assert(offsetof(
vector3d, y) == 8);
295static_assert(offsetof(
vector3d, z) == 16);
297static_assert(
alignof(
vector3f) == 4);
298static_assert(offsetof(
vector3f, y) == 4);
299static_assert(offsetof(
vector3f, z) == 8);
bool is_equal_exact(float a, float b)
Definition FloatComparison.h:112
double val
Definition PrecalcPath.cpp:40
T y
Definition vector2.h:26
T x
Definition vector2.h:26
T Dot(const vector3 &b) const
Definition vector3.h:118
vector2< T > xy()
Definition vector3.h:206
T & operator[](const size_t i)
Definition vector3.h:33
vector3 operator-(const vector3 &a) const
Definition vector3.h:80
vector2< T > xz()
Definition vector3.h:207
vector3 & operator/=(const double a)
Definition vector3.h:72
T y
Definition vector3.h:18
vector3 & operator/=(const float a)
Definition vector3.h:64
void xy(const vector2< T > &v2)
Definition vector3.h:190
vector3(T _x, T _y, T _z)
void ArbRotateAroundPoint(const vector3 &o, const vector3 &__v, T ang)
Definition vector3.h:144
void Print() const
Definition vector3.h:141
vector3 & operator*=(const float a)
Definition vector3.h:50
friend vector3 operator/(const vector3 &a, const float scalar)
Definition vector3.h:102
const T & operator[](const size_t i) const
Definition vector3.h:32
T LengthSqr() const
Definition vector3.h:120
vector3 Lerp(const vector3 &b, const double percent) const
Definition vector3.h:121
vector3 & operator+=(const vector3 &a)
Definition vector3.h:36
T x
Definition vector3.h:18
friend vector3 operator*(const vector3 &a, const T scalar)
Definition vector3.h:98
vector2< T > yx()
Definition vector3.h:209
vector3 NormalizedSafe() const
Definition vector3.h:130
friend vector3 operator*(const vector3 &a, const vector3 &b)
Definition vector3.h:97
friend vector3 operator/(const vector3 &a, const double scalar)
Definition vector3.h:107
void xz(const vector2< T > &v2)
Definition vector3.h:195
T Length() const
Definition vector3.h:119
friend vector3 operator-(const T scalar, const vector3 &a)
Definition vector3.h:95
vector2< T > zx()
Definition vector3.h:210
T z
Definition vector3.h:18
friend vector3 operator*(const T scalar, const vector3 &a)
Definition vector3.h:100
void ArbRotate(const vector3 &__v, T ang)
Definition vector3.h:169
friend vector3 operator/(const T scalar, const vector3 &a)
Definition vector3.h:112
vector3 & operator-=(const vector3 &a)
Definition vector3.h:43
vector3 operator-() const
Definition vector3.h:81
void yz(const vector2< T > &v2)
Definition vector3.h:200
friend vector3 operator+(const vector3 &a, const T &scalar)
Definition vector3.h:92
bool ExactlyEqual(const vector3 &a) const
Definition vector3.h:87
vector2< T > yz()
Definition vector3.h:208
bool operator==(const vector3 &a) const
Definition vector3.h:83
vector3 Normalized() const
Definition vector3.h:125
friend vector3 operator+(const T scalar, const vector3 &a)
Definition vector3.h:93
vector3 & operator*=(const double a)
Definition vector3.h:57
vector3(const vector3< typename other_floating_type< T >::type > &v)
friend vector3 operator-(const vector3 &a, const T &scalar)
Definition vector3.h:94
vector3 Cross(const vector3 &b) const
Definition vector3.h:117
vector3 operator+(const vector3 &a) const
Definition vector3.h:35
vector3(const typename other_floating_type< T >::type vals[3])
vector3(const vector2f &v, T t)
vector3< float > vector3f
Definition vector3.h:289
vector3< double > vector3d
Definition vector3.h:290