25 const int Vec4Impl::NUM_OF_COMPONENTS = 4;
41 :
mVec(v[0], v[1], v[2], v[3])
52 Vec4Impl::value_type Vec4Impl::Length()
const 59 Vec4Impl::value_type Vec4Impl::Length2()
const 65 Vec4Impl::value_type Vec4Impl::Normalize()
80 Vec4Impl::value_type& Vec4Impl::X()
86 Vec4Impl::value_type& Vec4Impl::Y()
92 Vec4Impl::value_type& Vec4Impl::Z()
98 Vec4Impl::value_type& Vec4Impl::W()
104 Vec4Impl::value_type Vec4Impl::X()
const 110 Vec4Impl::value_type Vec4Impl::Y()
const 116 Vec4Impl::value_type Vec4Impl::Z()
const 122 Vec4Impl::value_type Vec4Impl::W()
const 128 Vec4Impl::value_type& Vec4Impl::R()
134 Vec4Impl::value_type& Vec4Impl::G()
140 Vec4Impl::value_type& Vec4Impl::B()
146 Vec4Impl::value_type& Vec4Impl::A()
152 Vec4Impl::value_type Vec4Impl::R()
const 158 Vec4Impl::value_type Vec4Impl::G()
const 164 Vec4Impl::value_type Vec4Impl::B()
const 170 Vec4Impl::value_type Vec4Impl::A()
const 184 void Vec4Impl::Set(
const Vec4Impl& v)
198 mVec._v[0] = trUtil::Math::Lerp<value_type>(
mVec._v[0], to.X(), alpha);
199 mVec._v[1] = trUtil::Math::Lerp<value_type>(
mVec._v[1], to.Y(), alpha);
200 mVec._v[2] = trUtil::Math::Lerp<value_type>(
mVec._v[2], to.Z(), alpha);
201 mVec._v[3] = trUtil::Math::Lerp<value_type>(
mVec._v[3], to.W(), alpha);
207 return Vec4Impl(trUtil::Math::Lerp<value_type>(from.X(), to.X(), alpha), trUtil::Math::Lerp<value_type>(from.Y(), to.Y(), alpha), trUtil::Math::Lerp<value_type>(from.Z(), to.Z(), alpha), trUtil::Math::Lerp<value_type>(from.W(), to.W(), alpha));
213 return std::string(
"<" + trUtil::StringUtils::ToString<value_type>(
mVec._v[0], precision) +
", " + trUtil::StringUtils::ToString<value_type>(
mVec._v[1], precision) +
", " + trUtil::StringUtils::ToString<value_type>(
mVec._v[2], precision) +
", " + trUtil::StringUtils::ToString<value_type>(
mVec._v[3], precision) +
">");
217 Vec4Impl::value_type* Vec4Impl::Ptr()
223 const Vec4Impl::value_type* Vec4Impl::Ptr()
const 229 Vec4Impl::value_type& Vec4Impl::operator [] (
int i)
235 Vec4Impl::value_type Vec4Impl::operator [] (
int i)
const 241 void Vec4Impl::operator = (
const Vec4Impl& v)
255 return mVec._v[0] == v[0] &&
mVec._v[1] == v[1] &&
mVec._v[2] == v[2] &&
mVec._v[3] == v[3];
261 return mVec._v[0] != v[0] ||
mVec._v[1] != v[1] ||
mVec._v[2] != v[2] ||
mVec._v[3] != v[3];
265 bool Vec4Impl::operator < (
const Vec4Impl& v)
const 267 if (
mVec._v[0]<v[0])
return true;
268 else if (
mVec._v[0]>v[0])
return false;
269 else if (
mVec._v[1]<v[1])
return true;
270 else if (
mVec._v[1]>v[1])
return false;
271 else if (
mVec._v[2]<v[2])
return true;
272 else if (
mVec._v[2]>v[2])
return false;
273 else return (
mVec._v[3]<v[3]);
277 bool Vec4Impl::operator > (
const Vec4Impl& v)
const 279 if (
mVec._v[0]>v[0])
return true;
280 else if (
mVec._v[0]<v[0])
return false;
281 else if (
mVec._v[1]>v[1])
return true;
282 else if (
mVec._v[1]<v[1])
return false;
283 else if (
mVec._v[2]>v[2])
return true;
284 else if (
mVec._v[2]<v[2])
return false;
285 else return (
mVec._v[3]>v[3]);
289 Vec4Impl::value_type Vec4Impl::operator * (
const Vec4Impl& rhs)
const 291 return mVec._v[0] * rhs[0] +
mVec._v[1] * rhs[1] +
mVec._v[2] * rhs[2] +
mVec._v[3] * rhs[3];
295 const Vec4Impl Vec4Impl::operator * (Vec4Impl::value_type rhs)
const 301 Vec4Impl& Vec4Impl::operator *= (Vec4Impl::value_type rhs)
311 const Vec4Impl Vec4Impl::operator / (Vec4Impl::value_type rhs)
const 317 Vec4Impl& Vec4Impl::operator /= (Vec4Impl::value_type rhs)
335 mVec._v[0] += rhs[0];
336 mVec._v[1] += rhs[1];
337 mVec._v[2] += rhs[2];
338 mVec._v[3] += rhs[3];
351 mVec._v[0] -= rhs[0];
352 mVec._v[1] -= rhs[1];
353 mVec._v[2] -= rhs[2];
354 mVec._v[3] -= rhs[3];
359 const Vec4Impl Vec4Impl::operator - ()
const 391 ios <<
"<" << vec.X() <<
", " << vec.Y() <<
", " << vec.Z() <<
", " << vec.Z() <<
">";
398 return Vec4Impl(lhs[0] * rhs[0], lhs[1] * rhs[1], lhs[2] * rhs[2], lhs[3] * rhs[3]);
404 return Vec4Impl(lhs[0] / rhs[0], lhs[1] / rhs[1], lhs[2] / rhs[2], lhs[3] / rhs[3]);
std::string operator+(const std::string &s1, const RefStr &s2)
bool operator==(const std::string &s1, const RefStr &s2)
bool operator!=(const std::string &s1, const RefStr &s2)
TR_BASE_EXPORT std::ostream & operator<<(std::ostream &ios, const Matrixd &q)
Stream insertion operator.
std::string ToString(const T &t, int precision=-1)
A utility function to convert a basic type into a string.
TR_BASE_EXPORT Vec2b ComponentDivide(const Vec2b &lhs, const Vec2b &rhs)
Divide rhs components by rhs vector components.
TR_BASE_EXPORT Vec2b ComponentMultiply(const Vec2b &lhs, const Vec2b &rhs)
Multiply individual vector components.
T Lerp(T from, T to, T alpha)
Linear Interpolation function.
int value_type
Data type of vector components.