11#ifndef PXR_BASE_GF_VEC4I_H
12#define PXR_BASE_GF_VEC4I_H
18#include "pxr/base/gf/api.h"
20#include "pxr/base/gf/traits.h"
29PXR_NAMESPACE_OPEN_SCOPE
50 static const size_t dimension = 4;
72 : x(value), y(value), z(value), w(value)
77 constexpr GfVec4i(
int s0,
int s1,
int s2,
int s3)
78 : x(s0), y(s1), z(s2), w(s3)
85 : x(p[0]), y(p[1]), z(p[2]), w(p[3])
136 return Set(a[0], a[1], a[2], a[3]);
144 int const *
data()
const {
return &x; }
145 int *
data() {
return &x; }
146 int const *GetArray()
const {
return data(); }
159 return x == other.x &&
164 bool operator!=(
GfVec4i const &other)
const {
165 return !(*
this == other);
181 return GfVec4i(-x, -y, -z, -w);
216 GfVec4i operator*(
double s)
const {
231 GfVec4i operator/(
int s)
const {
237 return x * v.x + y * v.y + z * v.z + w * v.w;
245 return v * (*
this * v);
259 return *
this * *
this;
315 constexpr GfVec4i xyzw()
const;
316 constexpr GfVec4i xywz()
const;
317 constexpr GfVec4i xzyw()
const;
318 constexpr GfVec4i xzwy()
const;
319 constexpr GfVec4i xwyz()
const;
320 constexpr GfVec4i xwzy()
const;
321 constexpr GfVec4i yxzw()
const;
322 constexpr GfVec4i yxwz()
const;
323 constexpr GfVec4i yzxw()
const;
324 constexpr GfVec4i yzwx()
const;
325 constexpr GfVec4i ywxz()
const;
326 constexpr GfVec4i ywzx()
const;
327 constexpr GfVec4i zxyw()
const;
328 constexpr GfVec4i zxwy()
const;
329 constexpr GfVec4i zyxw()
const;
330 constexpr GfVec4i zywx()
const;
331 constexpr GfVec4i zwxy()
const;
332 constexpr GfVec4i zwyx()
const;
333 constexpr GfVec4i wxyz()
const;
334 constexpr GfVec4i wxzy()
const;
335 constexpr GfVec4i wyxz()
const;
336 constexpr GfVec4i wyzx()
const;
337 constexpr GfVec4i wzxy()
const;
338 constexpr GfVec4i wzyx()
const;
345 template <
class Vec = GfVec2i>
constexpr Vec xy()
const;
346 template <
class Vec = GfVec2i>
constexpr Vec xz()
const;
347 template <
class Vec = GfVec2i>
constexpr Vec xw()
const;
348 template <
class Vec = GfVec2i>
constexpr Vec yx()
const;
349 template <
class Vec = GfVec2i>
constexpr Vec yz()
const;
350 template <
class Vec = GfVec2i>
constexpr Vec yw()
const;
351 template <
class Vec = GfVec2i>
constexpr Vec zx()
const;
352 template <
class Vec = GfVec2i>
constexpr Vec zy()
const;
353 template <
class Vec = GfVec2i>
constexpr Vec zw()
const;
354 template <
class Vec = GfVec2i>
constexpr Vec wx()
const;
355 template <
class Vec = GfVec2i>
constexpr Vec wy()
const;
356 template <
class Vec = GfVec2i>
constexpr Vec wz()
const;
357 template <
class Vec = GfVec3i>
constexpr Vec xyz()
const;
358 template <
class Vec = GfVec3i>
constexpr Vec xyw()
const;
359 template <
class Vec = GfVec3i>
constexpr Vec xzy()
const;
360 template <
class Vec = GfVec3i>
constexpr Vec xzw()
const;
361 template <
class Vec = GfVec3i>
constexpr Vec xwy()
const;
362 template <
class Vec = GfVec3i>
constexpr Vec xwz()
const;
363 template <
class Vec = GfVec3i>
constexpr Vec yxz()
const;
364 template <
class Vec = GfVec3i>
constexpr Vec yxw()
const;
365 template <
class Vec = GfVec3i>
constexpr Vec yzx()
const;
366 template <
class Vec = GfVec3i>
constexpr Vec yzw()
const;
367 template <
class Vec = GfVec3i>
constexpr Vec ywx()
const;
368 template <
class Vec = GfVec3i>
constexpr Vec ywz()
const;
369 template <
class Vec = GfVec3i>
constexpr Vec zxy()
const;
370 template <
class Vec = GfVec3i>
constexpr Vec zxw()
const;
371 template <
class Vec = GfVec3i>
constexpr Vec zyx()
const;
372 template <
class Vec = GfVec3i>
constexpr Vec zyw()
const;
373 template <
class Vec = GfVec3i>
constexpr Vec zwx()
const;
374 template <
class Vec = GfVec3i>
constexpr Vec zwy()
const;
375 template <
class Vec = GfVec3i>
constexpr Vec wxy()
const;
376 template <
class Vec = GfVec3i>
constexpr Vec wxz()
const;
377 template <
class Vec = GfVec3i>
constexpr Vec wyx()
const;
378 template <
class Vec = GfVec3i>
constexpr Vec wyz()
const;
379 template <
class Vec = GfVec3i>
constexpr Vec wzx()
const;
380 template <
class Vec = GfVec3i>
constexpr Vec wzy()
const;
381 template <
class Vec = GfVec4i>
constexpr Vec xyzw()
const;
382 template <
class Vec = GfVec4i>
constexpr Vec xywz()
const;
383 template <
class Vec = GfVec4i>
constexpr Vec xzyw()
const;
384 template <
class Vec = GfVec4i>
constexpr Vec xzwy()
const;
385 template <
class Vec = GfVec4i>
constexpr Vec xwyz()
const;
386 template <
class Vec = GfVec4i>
constexpr Vec xwzy()
const;
387 template <
class Vec = GfVec4i>
constexpr Vec yxzw()
const;
388 template <
class Vec = GfVec4i>
constexpr Vec yxwz()
const;
389 template <
class Vec = GfVec4i>
constexpr Vec yzxw()
const;
390 template <
class Vec = GfVec4i>
constexpr Vec yzwx()
const;
391 template <
class Vec = GfVec4i>
constexpr Vec ywxz()
const;
392 template <
class Vec = GfVec4i>
constexpr Vec ywzx()
const;
393 template <
class Vec = GfVec4i>
constexpr Vec zxyw()
const;
394 template <
class Vec = GfVec4i>
constexpr Vec zxwy()
const;
395 template <
class Vec = GfVec4i>
constexpr Vec zyxw()
const;
396 template <
class Vec = GfVec4i>
constexpr Vec zywx()
const;
397 template <
class Vec = GfVec4i>
constexpr Vec zwxy()
const;
398 template <
class Vec = GfVec4i>
constexpr Vec zwyx()
const;
399 template <
class Vec = GfVec4i>
constexpr Vec wxyz()
const;
400 template <
class Vec = GfVec4i>
constexpr Vec wxzy()
const;
401 template <
class Vec = GfVec4i>
constexpr Vec wyxz()
const;
402 template <
class Vec = GfVec4i>
constexpr Vec wyzx()
const;
403 template <
class Vec = GfVec4i>
constexpr Vec wzxy()
const;
404 template <
class Vec = GfVec4i>
constexpr Vec wzyx()
const;
412PXR_NAMESPACE_CLOSE_SCOPE
419PXR_NAMESPACE_OPEN_SCOPE
426 static_assert(std::is_same<Vec, GfVec2i>::value);
434 static_assert(std::is_same<Vec, GfVec2i>::value);
442 static_assert(std::is_same<Vec, GfVec2i>::value);
450 static_assert(std::is_same<Vec, GfVec2i>::value);
458 static_assert(std::is_same<Vec, GfVec2i>::value);
466 static_assert(std::is_same<Vec, GfVec2i>::value);
474 static_assert(std::is_same<Vec, GfVec2i>::value);
482 static_assert(std::is_same<Vec, GfVec2i>::value);
490 static_assert(std::is_same<Vec, GfVec2i>::value);
498 static_assert(std::is_same<Vec, GfVec2i>::value);
506 static_assert(std::is_same<Vec, GfVec2i>::value);
514 static_assert(std::is_same<Vec, GfVec2i>::value);
522 static_assert(std::is_same<Vec, GfVec3i>::value);
530 static_assert(std::is_same<Vec, GfVec3i>::value);
538 static_assert(std::is_same<Vec, GfVec3i>::value);
546 static_assert(std::is_same<Vec, GfVec3i>::value);
554 static_assert(std::is_same<Vec, GfVec3i>::value);
562 static_assert(std::is_same<Vec, GfVec3i>::value);
570 static_assert(std::is_same<Vec, GfVec3i>::value);
578 static_assert(std::is_same<Vec, GfVec3i>::value);
586 static_assert(std::is_same<Vec, GfVec3i>::value);
594 static_assert(std::is_same<Vec, GfVec3i>::value);
602 static_assert(std::is_same<Vec, GfVec3i>::value);
610 static_assert(std::is_same<Vec, GfVec3i>::value);
618 static_assert(std::is_same<Vec, GfVec3i>::value);
626 static_assert(std::is_same<Vec, GfVec3i>::value);
634 static_assert(std::is_same<Vec, GfVec3i>::value);
642 static_assert(std::is_same<Vec, GfVec3i>::value);
650 static_assert(std::is_same<Vec, GfVec3i>::value);
658 static_assert(std::is_same<Vec, GfVec3i>::value);
666 static_assert(std::is_same<Vec, GfVec3i>::value);
674 static_assert(std::is_same<Vec, GfVec3i>::value);
682 static_assert(std::is_same<Vec, GfVec3i>::value);
690 static_assert(std::is_same<Vec, GfVec3i>::value);
698 static_assert(std::is_same<Vec, GfVec3i>::value);
706 static_assert(std::is_same<Vec, GfVec3i>::value);
714 static_assert(std::is_same<Vec, GfVec4i>::value);
715 return Vec(x, y, z, w);
722 static_assert(std::is_same<Vec, GfVec4i>::value);
723 return Vec(x, y, w, z);
730 static_assert(std::is_same<Vec, GfVec4i>::value);
731 return Vec(x, z, y, w);
738 static_assert(std::is_same<Vec, GfVec4i>::value);
739 return Vec(x, z, w, y);
746 static_assert(std::is_same<Vec, GfVec4i>::value);
747 return Vec(x, w, y, z);
754 static_assert(std::is_same<Vec, GfVec4i>::value);
755 return Vec(x, w, z, y);
762 static_assert(std::is_same<Vec, GfVec4i>::value);
763 return Vec(y, x, z, w);
770 static_assert(std::is_same<Vec, GfVec4i>::value);
771 return Vec(y, x, w, z);
778 static_assert(std::is_same<Vec, GfVec4i>::value);
779 return Vec(y, z, x, w);
786 static_assert(std::is_same<Vec, GfVec4i>::value);
787 return Vec(y, z, w, x);
794 static_assert(std::is_same<Vec, GfVec4i>::value);
795 return Vec(y, w, x, z);
802 static_assert(std::is_same<Vec, GfVec4i>::value);
803 return Vec(y, w, z, x);
810 static_assert(std::is_same<Vec, GfVec4i>::value);
811 return Vec(z, x, y, w);
818 static_assert(std::is_same<Vec, GfVec4i>::value);
819 return Vec(z, x, w, y);
826 static_assert(std::is_same<Vec, GfVec4i>::value);
827 return Vec(z, y, x, w);
834 static_assert(std::is_same<Vec, GfVec4i>::value);
835 return Vec(z, y, w, x);
842 static_assert(std::is_same<Vec, GfVec4i>::value);
843 return Vec(z, w, x, y);
850 static_assert(std::is_same<Vec, GfVec4i>::value);
851 return Vec(z, w, y, x);
858 static_assert(std::is_same<Vec, GfVec4i>::value);
859 return Vec(w, x, y, z);
866 static_assert(std::is_same<Vec, GfVec4i>::value);
867 return Vec(w, x, z, y);
874 static_assert(std::is_same<Vec, GfVec4i>::value);
875 return Vec(w, y, x, z);
882 static_assert(std::is_same<Vec, GfVec4i>::value);
883 return Vec(w, y, z, x);
890 static_assert(std::is_same<Vec, GfVec4i>::value);
891 return Vec(w, z, x, y);
898 static_assert(std::is_same<Vec, GfVec4i>::value);
899 return Vec(w, z, y, x);
932PXR_NAMESPACE_CLOSE_SCOPE
Low-level utilities for informing users of various internal and external diagnostic conditions.
Basic type for a vector of 2 int components.
Basic type for a vector of 3 int components.
Basic type for a vector of 4 double components.
Basic type for a vector of 4 float components.
Basic type for a vector of 4 GfHalf components.
Basic type for a vector of 4 int components.
int ScalarType
Scalar element type and dimension.
static GfVec4i ZAxis()
Create a unit vector along the Z-axis.
constexpr GfVec4i(int s0, int s1, int s2, int s3)
Initialize all elements with explicit arguments.
constexpr GfVec4i(Scl const *p)
Construct with pointer to values.
static GfVec4i Axis(size_t i)
Create a unit vector along the i-th axis, zero-based.
GfVec4i & operator-=(GfVec4i const &other)
Subtraction.
friend size_t hash_value(GfVec4i const &vec)
Hash.
static GfVec4i XAxis()
Create a unit vector along the X-axis.
GfVec4i operator-() const
Create a vec with negated elements.
GfVec4i()=default
GfVec4i value-initializes to zero and performs no default initialization, like float or double.
static GfVec4i YAxis()
Create a unit vector along the Y-axis.
GfVec4i & operator+=(GfVec4i const &other)
Addition.
bool operator==(GfVec4i const &other) const
Equality comparison.
int operator*(GfVec4i const &v) const
See GfDot().
GfVec4i GetProjection(GfVec4i const &v) const
Returns the projection of this onto v.
int const * data() const
Direct data access.
GF_API bool operator==(class GfVec4f const &other) const
Equality comparison.
int const & operator[](size_t i) const
Indexing.
GF_API bool operator==(class GfVec4h const &other) const
Equality comparison.
GfVec4i & operator*=(double s)
Multiplication by scalar.
static GfVec4i WAxis()
Create a unit vector along the W-axis.
GfVec4i GetComplement(GfVec4i const &b) const
Returns the orthogonal complement of this->GetProjection(b).
GfVec4i & Set(int s0, int s1, int s2, int s3)
Set all elements with passed arguments.
GF_API bool operator==(class GfVec4d const &other) const
Equality comparison.
GfVec4i & Set(int const *a)
Set all elements with a pointer to data.
int GetLengthSq() const
Squared length.
constexpr GfVec4i(int value)
Initialize all elements to a single value.
GfVec4i & operator/=(int s)
Division by scalar.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
GF_API std::ostream & operator<<(std::ostream &, GfVec4i const &)
Output a GfVec4i.
Defines useful mathematical limits.
A metafunction with a static const bool member 'value' that is true for GfVec types,...
GfVec4i GfCompMult(GfVec4i const &v1, GfVec4i const &v2)
Returns component-wise multiplication of vectors v1 and v2.
int GfDot(GfVec4i const &v1, GfVec4i const &v2)
Returns the dot (inner) product of two vectors.
GfVec4i GfCompDiv(GfVec4i const &v1, GfVec4i const &v2)
Returns component-wise quotient of vectors v1 and v2.