28 #ifndef PXR_BASE_GF_VEC2I_H
29 #define PXR_BASE_GF_VEC2I_H
72 : _data{
value, value }
120 return Set(a[0], a[1]);
124 int const *
data()
const {
return _data; }
139 return _data[0] == other[0] &&
140 _data[1] == other[1];
143 return !(*
this == other);
159 return GfVec2i(-_data[0], -_data[1]);
164 _data[0] += other[0];
165 _data[1] += other[1];
174 _data[0] -= other[0];
175 _data[1] -= other[1];
207 return _data[0] * v[0] + _data[1] * v[1];
215 return v * (*
this *
v);
229 return *
this * *
this;
269 #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
GLsizei const GLfloat * value
GfVec2i()=default
Default constructor does no initialization.
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.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
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.