11#ifndef PXR_BASE_GF_VEC3I_H
12#define PXR_BASE_GF_VEC3I_H
18#include "pxr/base/gf/api.h"
20#include "pxr/base/gf/traits.h"
29PXR_NAMESPACE_OPEN_SCOPE
49 static const size_t dimension = 3;
71 : x(value), y(value), z(value)
84 : x(p[0]), y(p[1]), z(p[2])
127 return Set(a[0], a[1], a[2]);
135 int const *
data()
const {
return &x; }
136 int *
data() {
return &x; }
137 int const *GetArray()
const {
return data(); }
150 return x == other.x &&
154 bool operator!=(
GfVec3i const &other)
const {
155 return !(*
this == other);
203 GfVec3i operator*(
double s)
const {
217 GfVec3i operator/(
int s)
const {
223 return x * v.x + y * v.y + z * v.z;
231 return v * (*
this * v);
245 return *
this * *
this;
283 template <
class Vec = GfVec2i>
constexpr Vec xy()
const;
284 template <
class Vec = GfVec2i>
constexpr Vec xz()
const;
285 template <
class Vec = GfVec2i>
constexpr Vec yx()
const;
286 template <
class Vec = GfVec2i>
constexpr Vec yz()
const;
287 template <
class Vec = GfVec2i>
constexpr Vec zx()
const;
288 template <
class Vec = GfVec2i>
constexpr Vec zy()
const;
289 template <
class Vec = GfVec3i>
constexpr Vec xyz()
const;
290 template <
class Vec = GfVec3i>
constexpr Vec xzy()
const;
291 template <
class Vec = GfVec3i>
constexpr Vec yxz()
const;
292 template <
class Vec = GfVec3i>
constexpr Vec yzx()
const;
293 template <
class Vec = GfVec3i>
constexpr Vec zxy()
const;
294 template <
class Vec = GfVec3i>
constexpr Vec zyx()
const;
302PXR_NAMESPACE_CLOSE_SCOPE
308PXR_NAMESPACE_OPEN_SCOPE
315 static_assert(std::is_same<Vec, GfVec2i>::value);
323 static_assert(std::is_same<Vec, GfVec2i>::value);
331 static_assert(std::is_same<Vec, GfVec2i>::value);
339 static_assert(std::is_same<Vec, GfVec2i>::value);
347 static_assert(std::is_same<Vec, GfVec2i>::value);
355 static_assert(std::is_same<Vec, GfVec2i>::value);
363 static_assert(std::is_same<Vec, GfVec3i>::value);
371 static_assert(std::is_same<Vec, GfVec3i>::value);
379 static_assert(std::is_same<Vec, GfVec3i>::value);
387 static_assert(std::is_same<Vec, GfVec3i>::value);
395 static_assert(std::is_same<Vec, GfVec3i>::value);
403 static_assert(std::is_same<Vec, GfVec3i>::value);
435PXR_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 double components.
Basic type for a vector of 3 float components.
Basic type for a vector of 3 GfHalf components.
Basic type for a vector of 3 int components.
int ScalarType
Scalar element type and dimension.
GF_API bool operator==(class GfVec3h const &other) const
Equality comparison.
int operator*(GfVec3i const &v) const
See GfDot().
GfVec3i()=default
GfVec3i value-initializes to zero and performs no default initialization, like float or double.
GfVec3i & operator/=(int s)
Division by scalar.
GfVec3i & operator-=(GfVec3i const &other)
Subtraction.
GF_API bool operator==(class GfVec3d const &other) const
Equality comparison.
GF_API bool operator==(class GfVec3f const &other) const
Equality comparison.
constexpr GfVec3i(int value)
Initialize all elements to a single value.
GfVec3i & Set(int s0, int s1, int s2)
Set all elements with passed arguments.
static GfVec3i ZAxis()
Create a unit vector along the Z-axis.
GfVec3i GetComplement(GfVec3i const &b) const
Returns the orthogonal complement of this->GetProjection(b).
friend size_t hash_value(GfVec3i const &vec)
Hash.
static GfVec3i XAxis()
Create a unit vector along the X-axis.
bool operator==(GfVec3i const &other) const
Equality comparison.
int const * data() const
Direct data access.
constexpr GfVec3i(Scl const *p)
Construct with pointer to values.
static GfVec3i YAxis()
Create a unit vector along the Y-axis.
static GfVec3i Axis(size_t i)
Create a unit vector along the i-th axis, zero-based.
GfVec3i GetProjection(GfVec3i const &v) const
Returns the projection of this onto v.
int const & operator[](size_t i) const
Indexing.
constexpr GfVec3i(int s0, int s1, int s2)
Initialize all elements with explicit arguments.
GfVec3i operator-() const
Create a vec with negated elements.
int GetLengthSq() const
Squared length.
GfVec3i & operator+=(GfVec3i const &other)
Addition.
GfVec3i & Set(int const *a)
Set all elements with a pointer to data.
GfVec3i & operator*=(double s)
Multiplication 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 &, GfVec3i const &)
Output a GfVec3i.
Defines useful mathematical limits.
A metafunction with a static const bool member 'value' that is true for GfVec types,...
GfVec3i GfCompMult(GfVec3i const &v1, GfVec3i const &v2)
Returns component-wise multiplication of vectors v1 and v2.
GfVec3i GfCompDiv(GfVec3i const &v1, GfVec3i const &v2)
Returns component-wise quotient of vectors v1 and v2.
int GfDot(GfVec3i const &v1, GfVec3i const &v2)
Returns the dot (inner) product of two vectors.