10 #ifndef INCLUDED_IMATHVEC_H
11 #define INCLUDED_IMATHVEC_H
23 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
25 # pragma warning(push)
26 # pragma warning(disable : 4290)
29 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
31 template <
class T>
class Vec2;
32 template <
class T>
class Vec3;
33 template <
class T>
class Vec4;
85 ~
Vec2() IMATH_NOEXCEPT = default;
89 #if IMATH_FOREIGN_VECTOR_INTEROP
107 :
Vec2(
T(v.x),
T(v.y)) { }
248 const
Vec2& normalizeExc();
260 Vec2<
T> normalizedExc() const;
274 IMATH_HOSTDEVICE constexpr static
T baseTypeLowest() IMATH_NOEXCEPT {
return std::numeric_limits<T>::lowest(); }
349 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator= (const Vec3& v) IMATH_NOEXCEPT;
352 ~Vec3() IMATH_NOEXCEPT = default;
356 #if IMATH_FOREIGN_VECTOR_INTEROP
374 : Vec3(
T(v.x),
T(v.y),
T(v.z)) { }
457 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator%= (const Vec3& v) IMATH_NOEXCEPT;
460 IMATH_HOSTDEVICE constexpr Vec3 operator% (const Vec3& v) const IMATH_NOEXCEPT;
463 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator+= (const Vec3& v) IMATH_NOEXCEPT;
466 IMATH_HOSTDEVICE constexpr Vec3 operator+ (const Vec3& v) const IMATH_NOEXCEPT;
469 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator-= (const Vec3& v) IMATH_NOEXCEPT;
472 IMATH_HOSTDEVICE constexpr Vec3 operator- (const Vec3& v) const IMATH_NOEXCEPT;
481 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator*= (const Vec3& v) IMATH_NOEXCEPT;
487 IMATH_HOSTDEVICE constexpr Vec3 operator* (const Vec3& v) const IMATH_NOEXCEPT;
493 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator/= (const Vec3& v) IMATH_NOEXCEPT;
499 IMATH_HOSTDEVICE constexpr Vec3 operator/ (const Vec3& v) const IMATH_NOEXCEPT;
520 const Vec3& normalizeExc();
532 Vec3<
T> normalizedExc() const;
546 IMATH_HOSTDEVICE constexpr static
T baseTypeLowest() IMATH_NOEXCEPT {
return std::numeric_limits<T>::lowest(); }
613 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator= (const Vec4& v) IMATH_NOEXCEPT;
616 ~Vec4() IMATH_NOEXCEPT = default;
620 #if IMATH_FOREIGN_VECTOR_INTEROP
638 : Vec4(
T(v.x),
T(v.y),
T(v.z),
T(v.w)) { }
713 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator*= (const Vec4& v) IMATH_NOEXCEPT;
719 IMATH_HOSTDEVICE constexpr Vec4 operator* (const Vec4& v) const IMATH_NOEXCEPT;
725 IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator/= (const Vec4& v) IMATH_NOEXCEPT;
731 IMATH_HOSTDEVICE constexpr Vec4 operator/ (const Vec4& v) const IMATH_NOEXCEPT;
752 const Vec4& normalizeExc();
764 Vec4<
T> normalizedExc() const;
778 IMATH_HOSTDEVICE constexpr static
T baseTypeLowest() IMATH_NOEXCEPT {
return std::numeric_limits<T>::lowest(); }
803 template <
class T> std::ostream& operator<< (std::ostream&
s, const
Vec2<
T>& v);
806 template <
class T> std::ostream& operator<< (std::ostream& s, const Vec3<
T>& v);
809 template <
class T> std::ostream& operator<< (std::ostream& s, const Vec4<
T>& v);
880 template <> const
Vec2<
short>&
Vec2<
short>::normalizeExc() = delete;
883 template <>
Vec2<
short>
Vec2<
short>::normalizedExc() const = delete;
889 template <> const
Vec2<
int>&
Vec2<
int>::normalizeExc() = delete;
892 template <>
Vec2<
int>
Vec2<
int>::normalizedExc() const = delete;
898 template <> const
Vec2<int64_t>&
Vec2<int64_t>::normalizeExc() = delete;
901 template <>
Vec2<int64_t>
Vec2<int64_t>::normalizedExc() const = delete;
907 template <> const Vec3<
short>& Vec3<
short>::normalizeExc() = delete;
908 template <>
IMATH_HOSTDEVICE const Vec3<
short>& Vec3<
short>::normalizeNonNull() IMATH_NOEXCEPT = delete;
910 template <> Vec3<
short> Vec3<
short>::normalizedExc() const = delete;
911 template <>
IMATH_HOSTDEVICE Vec3<
short> Vec3<
short>::normalizedNonNull() const IMATH_NOEXCEPT = delete;
916 template <> const Vec3<
int>& Vec3<
int>::normalizeExc() = delete;
917 template <>
IMATH_HOSTDEVICE const Vec3<
int>& Vec3<
int>::normalizeNonNull() IMATH_NOEXCEPT = delete;
919 template <> Vec3<
int> Vec3<
int>::normalizedExc() const = delete;
920 template <>
IMATH_HOSTDEVICE Vec3<
int> Vec3<
int>::normalizedNonNull() const IMATH_NOEXCEPT = delete;
925 template <> const Vec3<int64_t>& Vec3<int64_t>::normalizeExc() = delete;
926 template <>
IMATH_HOSTDEVICE const Vec3<int64_t>& Vec3<int64_t>::normalizeNonNull() IMATH_NOEXCEPT = delete;
928 template <> Vec3<int64_t> Vec3<int64_t>::normalizedExc() const = delete;
929 template <>
IMATH_HOSTDEVICE Vec3<int64_t> Vec3<int64_t>::normalizedNonNull() const IMATH_NOEXCEPT = delete;
934 template <> const Vec4<
short>& Vec4<
short>::normalizeExc() = delete;
935 template <>
IMATH_HOSTDEVICE const Vec4<
short>& Vec4<
short>::normalizeNonNull() IMATH_NOEXCEPT = delete;
937 template <> Vec4<
short> Vec4<
short>::normalizedExc() const = delete;
938 template <>
IMATH_HOSTDEVICE Vec4<
short> Vec4<
short>::normalizedNonNull() const IMATH_NOEXCEPT = delete;
943 template <> const Vec4<
int>& Vec4<
int>::normalizeExc() = delete;
944 template <>
IMATH_HOSTDEVICE const Vec4<
int>& Vec4<
int>::normalizeNonNull() IMATH_NOEXCEPT = delete;
946 template <> Vec4<
int> Vec4<
int>::normalizedExc() const = delete;
947 template <>
IMATH_HOSTDEVICE Vec4<
int> Vec4<
int>::normalizedNonNull() const IMATH_NOEXCEPT = delete;
952 template <> const Vec4<int64_t>& Vec4<int64_t>::normalizeExc() = delete;
953 template <>
IMATH_HOSTDEVICE const Vec4<int64_t>& Vec4<int64_t>::normalizeNonNull() IMATH_NOEXCEPT = delete;
955 template <> Vec4<int64_t> Vec4<int64_t>::normalizedExc() const = delete;
956 template <>
IMATH_HOSTDEVICE Vec4<int64_t> Vec4<int64_t>::normalizedNonNull() const IMATH_NOEXCEPT = delete;
966 Vec2<
T>::operator[] (
int i) IMATH_NOEXCEPT
999 :
x(
T(v.x)),
y(
T(v.y))
1059 return (
const T*) &
x;
1067 return x == v.x && y == v.y;
1075 return x != v.x || y != v.y;
1082 for (
int i = 0; i < 2; i++)
1093 for (
int i = 0; i < 2; i++)
1104 return x * v.x + y * v.y;
1118 return x * v.y - y * v.x;
1125 return x * v.y - y * v.x;
1141 return Vec2 (x + v.x, y + v.y);
1157 return Vec2 (x - v.x, y - v.y);
1164 return Vec2 (-x, -y);
1198 return Vec2 (x * v.x, y * v.y);
1205 return Vec2 (x * a, y * a);
1230 return Vec2 (x / v.x, y / v.y);
1237 return Vec2 (x / a, y / a);
1264 return max *
std::sqrt (absX * absX + absY * absY);
1271 T length2 =
dot (*
this);
1274 return lengthTiny();
1314 throw std::domain_error (
"Cannot normalize null vector.");
1338 return Vec2 (
T (0));
1340 return Vec2 (x / l, y / l);
1350 throw std::domain_error (
"Cannot normalize null vector.");
1352 return Vec2 (x / l, y / l);
1360 return Vec2 (x / l, y / l);
1369 IMATH_CONSTEXPR14
inline T&
1398 :
x(v.x),
y(v.y),
z(v.z)
1402 template <
class T>
template <
class S>
1404 :
x(
T(v.x)),
y(
T(v.y)),
z(
T(v.z))
1418 template <
class T>
template <
class S>
1420 :
x(
T(v.x/v.w)),
y(
T(v.y/v.w)),
z(
T(v.z/v.w))
1433 T absW = (vw >=
T (0)) ? vw : -vw;
1437 T m = baseTypeMax() * absW;
1439 if (vx <= -m || vx >= m || vy <= -m || vy >= m || vz <= -m || vz >= m)
1440 throw std::domain_error (
"Cannot normalize point at infinity.");
1499 return (
const T*) &
x;
1507 return x == v.x && y == v.y && z == v.z;
1515 return x != v.x || y != v.y || z != v.z;
1522 for (
int i = 0; i < 3; i++)
1533 for (
int i = 0; i < 3; i++)
1544 return x * v.x + y * v.y + z * v.z;
1558 return Vec3 (y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
1565 T a = y * v.z - z * v.y;
1566 T b = z * v.x - x * v.z;
1567 T c = x * v.y - y * v.x;
1578 return Vec3 (y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
1595 return Vec3 (x + v.x, y + v.y, z + v.z);
1612 return Vec3 (x - v.x, y - v.y, z - v.z);
1619 return Vec3 (-x, -y, -z);
1656 return Vec3 (x * v.x, y * v.y, z * v.z);
1663 return Vec3 (x * a, y * a, z * a);
1690 return Vec3 (x / v.x, y / v.y, z / v.z);
1697 return Vec3 (x / a, y / a, z / a);
1704 T absX = (x >=
T (0)) ? x : -x;
1705 T absY = (y >=
T (0)) ? y : -y;
1706 T absZ = (z >=
T (0)) ? z : -z;
1729 return max *
std::sqrt (absX * absX + absY * absY + absZ * absZ);
1736 T length2 =
dot (*
this);
1739 return lengthTiny();
1780 throw std::domain_error (
"Cannot normalize null vector.");
1806 return Vec3 (
T (0));
1808 return Vec3 (x / l, y / l, z / l);
1818 throw std::domain_error (
"Cannot normalize null vector.");
1820 return Vec3 (x / l, y / l, z / l);
1828 return Vec3 (x / l, y / l, z / l);
1837 IMATH_CONSTEXPR14
inline T&
1856 :
x(a),
y(a),
z(a),
w(a)
1861 :
x(a),
y(b),
z(c),
w(d)
1866 :
x(v.x),
y(v.y),
z(v.z),
w(v.w)
1870 template <
class T>
template <
class S>
1872 :
x(
T(v.x)),
y(
T(v.y)),
z(
T(v.z)),
w(
T(v.w))
1887 template <
class T>
template <
class S>
1889 :
x(
T(v.x)),
y(
T(v.y)),
z(
T(v.z)),
w(
T(1))
1898 return x == v.x && y == v.y && z == v.z && w == v.w;
1906 return x != v.x || y != v.y || z != v.z || w != v.w;
1913 for (
int i = 0; i < 4; i++)
1924 for (
int i = 0; i < 4; i++)
1935 return x * v.x + y * v.y + z * v.z + w * v.w;
1960 return Vec4 (x + v.x, y + v.y, z + v.z, w + v.w);
1978 return Vec4 (x - v.x, y - v.y, z - v.z, w - v.w);
1985 return Vec4 (-x, -y, -z, -w);
2025 return Vec4 (x * v.x, y * v.y, z * v.z, w * v.w);
2032 return Vec4 (x * a, y * a, z * a, w * a);
2061 return Vec4 (x / v.x, y / v.y, z / v.z, w / v.w);
2068 return Vec4 (x / a, y / a, z / a, w / a);
2075 T absX = (x >=
T (0)) ? x : -x;
2076 T absY = (y >=
T (0)) ? y : -y;
2077 T absZ = (z >=
T (0)) ? z : -z;
2078 T absW = (w >=
T (0)) ? w : -w;
2105 return max *
std::sqrt (absX * absX + absY * absY + absZ * absZ + absW * absW);
2112 T length2 =
dot (*
this);
2115 return lengthTiny();
2157 throw std::domain_error (
"Cannot normalize null vector.");
2185 return Vec4 (
T (0));
2187 return Vec4 (x / l, y / l, z / l, w / l);
2197 throw std::domain_error (
"Cannot normalize null vector.");
2199 return Vec4 (x / l, y / l, z / l, w / l);
2207 return Vec4 (x / l, y / l, z / l, w / l);
2216 operator<< (std::ostream& s, const Vec2<T>&
v)
2218 return s <<
'(' << v.x <<
' ' << v.y <<
')';
2223 operator<< (std::ostream& s, const Vec3<T>&
v)
2225 return s <<
'(' << v.x <<
' ' << v.y <<
' ' << v.z <<
')';
2230 operator<< (std::ostream& s, const Vec4<T>&
v)
2232 return s <<
'(' << v.x <<
' ' << v.y <<
' ' << v.z <<
' ' << v.w <<
')';
2243 return Vec2<T> (a * v.x, a * v.y);
2250 return Vec3<T> (a * v.x, a * v.y, a * v.z);
2257 return Vec4<T> (a * v.x, a * v.y, a * v.z, a * v.w);
2260 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
2261 # pragma warning(pop)
2264 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
2266 #endif // INCLUDED_IMATHVEC_H
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(T x1, T x2, T e) IMATH_NOEXCEPT
IMATH_HOSTDEVICE Vec4(const V &v)
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
IMATH_HOSTDEVICE Vec4< T > normalized() const IMATH_NOEXCEPT
Return a normalized vector. Does not modify *this.
IMATH_HOSTDEVICE constexpr T length2() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2 & operator+=(const Vec2 &v) IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2 & operator*=(const Vec2 &v) IMATH_NOEXCEPT
Component-wise multiplication.
Vec4< T > normalizedExc() const
IMATH_HOSTDEVICE constexpr bool operator==(const Vec4< S > &v) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE const Vec4 & normalizeNonNull() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Vec3< T > &v, T e) const IMATH_NOEXCEPT
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2 & operator-=(const Vec2 &v) IMATH_NOEXCEPT
Component-wise subtraction.
IMATH_HOSTDEVICE T length() const IMATH_NOEXCEPT
Return the Euclidean norm.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(T x1, T x2, T e) IMATH_NOEXCEPT
GLsizei const GLfloat * value
IMATH_HOSTDEVICE const Vec3 & normalizeNonNull() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4 & operator+=(const Vec4 &v) IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr T dot(const Vec4 &v) const IMATH_NOEXCEPT
Dot product.
vfloat4 sqrt(const vfloat4 &a)
GLdouble GLdouble GLdouble z
IMATH_HOSTDEVICE constexpr Plane3< T > operator-(const Plane3< T > &plane) IMATH_NOEXCEPT
Reflect the pla.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator*=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4 & operator*=(const Vec4 &v) IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE constexpr T operator^(const Vec4 &v) const IMATH_NOEXCEPT
Dot product.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Vec4< T > &v, T e) const IMATH_NOEXCEPT
GLboolean GLboolean GLboolean GLboolean a
IMATH_HOSTDEVICE Vec3< T > normalized() const IMATH_NOEXCEPT
Return a normalized vector. Does not modify *this.
GLuint GLsizei GLsizei * length
IMATH_HOSTDEVICE constexpr T dot(const Vec3 &v) const IMATH_NOEXCEPT
Dot product.
IMATH_HOSTDEVICE constexpr T length2() const IMATH_NOEXCEPT
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator+=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE constexpr Vec2 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4 & operator=(const Vec4 &v) IMATH_NOEXCEPT
Assignment.
__hostdev__ void setValue(uint32_t offset, bool v)
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2 & operator=(const Vec2 &v) IMATH_NOEXCEPT
Assignment.
IMATH_HOSTDEVICE Vec2< T > normalizedNonNull() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
IMATH_HOSTDEVICE Vec3(const V &v)
IMATH_HOSTDEVICE constexpr Vec2< T > operator*(T a, const Vec2< T > &v) IMATH_NOEXCEPT
Reverse multiplication: S * Vec2<T>
IMATH_HOSTDEVICE Vec2(const V &v)
__hostdev__ float getValue(uint32_t i) const
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
Vec3< T > normalizedExc() const
IMATH_HOSTDEVICE Vec2< T > normalized() const IMATH_NOEXCEPT
Return a normalized vector. Does not modify *this.
IMATH_HOSTDEVICE Vec2() IMATH_NOEXCEPT
Uninitialized by default.
IMATH_HOSTDEVICE constexpr bool operator!=(const Vec4< S > &v) const IMATH_NOEXCEPT
Inequality.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Vec4< T > &v, T e) const IMATH_NOEXCEPT
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
IMATH_HOSTDEVICE constexpr Vec4 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr Vec3 operator-() const IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE static constexpr unsigned int dimensions() IMATH_NOEXCEPT
Return the number of dimensions, i.e. 4.
IMATH_HOSTDEVICE T length() const IMATH_NOEXCEPT
Return the Euclidean norm.
IMATH_HOSTDEVICE constexpr T dot(const Vec2 &v) const IMATH_NOEXCEPT
Dot product.
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
const Vec4 & normalizeExc()
Normalize in place. If length()==0, throw an exception.
IMATH_HOSTDEVICE void setValue(S a, S b, S c) IMATH_NOEXCEPT
Set the value.
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
const Vec3 & normalizeExc()
Normalize in place. If length()==0, throw an exception.
IMATH_HOSTDEVICE constexpr bool operator==(const Vec3< S > &v) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T & operator[](int i) IMATH_NOEXCEPT
Element access by index.
IMATH_HOSTDEVICE constexpr Vec3 operator+(const Vec3 &v) const IMATH_NOEXCEPT
Component-wise addition.
#define IMATH_EXPORT_ENUM
IMATH_HOSTDEVICE constexpr Vec4 operator*(const Vec4 &v) const IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & negate() IMATH_NOEXCEPT
Component-wise multiplication by -1.
IMATH_HOSTDEVICE constexpr T length2() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2 & operator/=(const Vec2 &v) IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE Vec3< T > normalizedNonNull() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr T operator^(const Vec3 &v) const IMATH_NOEXCEPT
Dot product.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator%=(const Vec3 &v) IMATH_NOEXCEPT
Right-handed cross product.
GLint GLenum GLboolean normalized
GLboolean GLboolean GLboolean b
IMATH_HOSTDEVICE constexpr Quat< T > operator+(const Quat< T > &q1, const Quat< T > &q2) IMATH_NOEXCEPT
Quaterion addition.
IMATH_HOSTDEVICE static constexpr unsigned int dimensions() IMATH_NOEXCEPT
Return the number of dimensions, i.e. 2.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4 & operator-=(const Vec4 &v) IMATH_NOEXCEPT
Component-wise subtraction.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError(const Vec2< T > &v, T e) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE static constexpr unsigned int dimensions() IMATH_NOEXCEPT
Return the number of dimensions, i.e. 3.
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator-=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise subtraction.
IMATH_HOSTDEVICE constexpr Vec4 operator+(const Vec4 &v) const IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE Vec4< T > normalizedNonNull() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr bool operator!=(const Vec2< S > &v) const IMATH_NOEXCEPT
Inequality.
IMATH_HOSTDEVICE constexpr bool operator==(const Vec2< S > &v) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE constexpr Vec2 operator*(const Vec2 &v) const IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
IMATH_HOSTDEVICE T * getValue() IMATH_NOEXCEPT
Return a raw pointer to the array of values.
IMATH_HOSTDEVICE constexpr Vec2 operator/(const Vec2 &v) const IMATH_NOEXCEPT
Component-wise division.
#define IMATH_UNLIKELY(x)
IMATH_HOSTDEVICE constexpr bool operator!=(const Vec3< S > &v) const IMATH_NOEXCEPT
Inequality.
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon() IMATH_NOEXCEPT
Smallest possible e for which 1+e != 1.
#define IMATH_EXPORT_TEMPLATE_TYPE
IMATH_HOSTDEVICE const Vec2 & normalizeNonNull() IMATH_NOEXCEPT
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE constexpr Vec4 operator/(const Vec4 &v) const IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4 & operator/=(const Vec4 &v) IMATH_NOEXCEPT
Component-wise division.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Vec3< T > &v, T e) const IMATH_NOEXCEPT
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
IMATH_HOSTDEVICE constexpr Vec2 operator+(const Vec2 &v) const IMATH_NOEXCEPT
Component-wise addition.
IMATH_HOSTDEVICE constexpr T cross(const Vec2 &v) const IMATH_NOEXCEPT
GLubyte GLubyte GLubyte GLubyte w
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T & operator[](int i) IMATH_NOEXCEPT
Element access by index.
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE constexpr T abs(T a) IMATH_NOEXCEPT
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
const Vec2 & normalizeExc()
Normalize in place. If length()==0, throw an exception.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError(const Vec2< T > &v, T e) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator=(const Vec3 &v) IMATH_NOEXCEPT
Assignment.
IMATH_HOSTDEVICE Vec4() IMATH_NOEXCEPT
Uninitialized by default.
IMATH_HOSTDEVICE constexpr T operator%(const Vec2 &v) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr T operator^(const Vec2 &v) const IMATH_NOEXCEPT
Dot product.
enum IMATH_EXPORT_ENUM InfException
Enum for the Vec4 to Vec3 conversion constructor.
IMATH_HOSTDEVICE constexpr Vec3 operator%(const Vec3 &v) const IMATH_NOEXCEPT
Right-handed cross product.
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest() IMATH_NOEXCEPT
Smallest possible positive value.
IMATH_HOSTDEVICE constexpr Vec3 cross(const Vec3 &v) const IMATH_NOEXCEPT
Right-handed cross product.
IMATH_HOSTDEVICE const Vec3 & normalize() IMATH_NOEXCEPT
Normalize in place. If length()==0, return a null vector.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3 & operator/=(const Vec3 &v) IMATH_NOEXCEPT
Component-wise division.
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
Vec2< T > normalizedExc() const
IMATH_HOSTDEVICE void setValue(S a, S b) IMATH_NOEXCEPT
Set the value.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T & operator[](int i) IMATH_NOEXCEPT
Element access by index.
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept
IMATH_HOSTDEVICE T length() const IMATH_NOEXCEPT
Return the Euclidean norm.
IMATH_HOSTDEVICE constexpr Vec3 operator*(const Vec3 &v) const IMATH_NOEXCEPT
Component-wise multiplication.
IMATH_HOSTDEVICE const Vec2 & normalize() IMATH_NOEXCEPT
Normalize in place. If length()==0, return a null vector.
IMATH_HOSTDEVICE Vec3() IMATH_NOEXCEPT
Uninitialized by default.
IMATH_HOSTDEVICE const Vec4 & normalize() IMATH_NOEXCEPT
Normalize in place. If length()==0, return a null vector.
IMATH_HOSTDEVICE constexpr Vec3 operator/(const Vec3 &v) const IMATH_NOEXCEPT
Component-wise division.
const TypeMask operator^(const TypeMask &m1, const TypeMask &m2)