11 #ifndef PXR_BASE_GF_VEC2I_H
12 #define PXR_BASE_GF_VEC2I_H
56 : _data{
value, value }
104 return Set(a[0], a[1]);
108 int const *
data()
const {
return _data; }
123 return _data[0] == other[0] &&
124 _data[1] == other[1];
127 return !(*
this == other);
143 return GfVec2i(-_data[0], -_data[1]);
148 _data[0] += other[0];
149 _data[1] += other[1];
158 _data[0] -= other[0];
159 _data[1] -= other[1];
191 return _data[0] * v[0] + _data[1] * v[1];
199 return v * (*
this *
v);
213 return *
this * *
this;
253 #endif // PXR_BASE_GF_VEC2I_H
int const & operator[](size_t i) const
Indexing.
friend GfVec2i operator+(GfVec2i const &l, GfVec2i const &r)
GfVec2i GetProjection(GfVec2i const &v) const
bool operator!=(GfVec2i const &other) const
friend GfVec2i operator*(double s, GfVec2i const &v)
*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
#define PXR_NAMESPACE_OPEN_SCOPE
GLsizei const GLfloat * value
int const * GetArray() const
GLboolean GLboolean GLboolean GLboolean a
**But if you need a result
GLfloat GLfloat GLfloat v2
GF_API std::ostream & operator<<(std::ostream &, GfVec2i const &)
bool operator==(GfVec2i const &other) const
Equality comparison.
GfVec2i & operator*=(double s)
Multiplication by scalar.
static GfVec2i XAxis()
Create a unit vector along the X-axis.
int GetLengthSq() const
Squared length.
GfVec2i & Set(int const *a)
Set all elements with a pointer to data.
GfVec2i operator-() const
Create a vec with negated elements.
GfVec2i operator/(int s) const
int GfDot(GfVec2i const &v1, GfVec2i const &v2)
Returns the dot (inner) product of two vectors.
GfVec2i GfCompMult(GfVec2i const &v1, GfVec2i const &v2)
Returns component-wise multiplication of vectors v1 and v2.
friend GfVec2i operator-(GfVec2i const &l, GfVec2i const &r)
int const * data() const
Direct data access.
GfVec2i & operator+=(GfVec2i const &other)
Addition.
static GfVec2i Axis(size_t i)
friend size_t hash_value(GfVec2i const &vec)
Hash.
GLboolean GLboolean GLboolean b
int ScalarType
Scalar element type and dimension.
int operator*(GfVec2i const &v) const
See GfDot().
GfVec2i & Set(int s0, int s1)
Set all elements with passed arguments.
GfVec2i & operator/=(int s)
Division by scalar.
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
static GfVec2i YAxis()
Create a unit vector along the Y-axis.
GfVec2i GfCompDiv(GfVec2i const &v1, GfVec2i const &v2)
Returns component-wise quotient of vectors v1 and v2.
int & operator[](size_t i)
#define PXR_NAMESPACE_CLOSE_SCOPE
constexpr GfVec2i(int value)
Initialize all elements to a single value.
GfVec2i GetComplement(GfVec2i const &b) const
constexpr GfVec2i(Scl const *p)
Construct with pointer to values.
GfVec2i & operator-=(GfVec2i const &other)
Subtraction.
GfVec2i operator*(double s) const
static const size_t dimension
constexpr GfVec2i(int s0, int s1)
Initialize all elements with explicit arguments.