11#ifndef PXR_BASE_GF_VEC3I_H
12#define PXR_BASE_GF_VEC3I_H
19#include "pxr/base/gf/api.h"
21#include "pxr/base/gf/traits.h"
28PXR_NAMESPACE_OPEN_SCOPE
48 static const size_t dimension = 3;
55 : _data{ value, value, value }
68 : _data{ p[0], p[1], p[2] }
110 return Set(a[0], a[1], a[2]);
114 int const *
data()
const {
return _data; }
115 int *
data() {
return _data; }
116 int const *GetArray()
const {
return data(); }
120 int &
operator[](
size_t i) {
return _data[i]; }
129 return _data[0] == other[0] &&
130 _data[1] == other[1] &&
131 _data[2] == other[2];
133 bool operator!=(
GfVec3i const &other)
const {
134 return !(*
this == other);
150 return GfVec3i(-_data[0], -_data[1], -_data[2]);
155 _data[0] += other[0];
156 _data[1] += other[1];
157 _data[2] += other[2];
166 _data[0] -= other[0];
167 _data[1] -= other[1];
168 _data[2] -= other[2];
182 GfVec3i operator*(
double s)
const {
196 GfVec3i operator/(
int s)
const {
202 return _data[0] * v[0] + _data[1] * v[1] + _data[2] * v[2];
210 return v * (*
this * v);
224 return *
this * *
this;
264PXR_NAMESPACE_CLOSE_SCOPE
Low-level utilities for informing users of various internal and external diagnostic conditions.
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.
GF_API bool operator==(class GfVec3h const &other) const
Equality comparison.
int operator*(GfVec3i const &v) const
See GfDot().
GfVec3i()=default
Default constructor does no initialization.
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 ScalarType
Scalar element type and dimension.
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 &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
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.