|
Basic type for a vector of 3 GfHalf components. More...
#include <vec3h.h>
Public Types | |
typedef GfHalf | ScalarType |
Scalar element type and dimension. | |
Public Member Functions | |
GfVec3h ()=default | |
Default constructor does no initialization. | |
constexpr | GfVec3h (GfHalf value) |
Initialize all elements to a single value. | |
constexpr | GfVec3h (GfHalf s0, GfHalf s1, GfHalf s2) |
Initialize all elements with explicit arguments. | |
template<class Scl > | |
constexpr | GfVec3h (Scl const *p) |
Construct with pointer to values. | |
GfVec3h (class GfVec3d const &other) | |
Construct from GfVec3d. | |
GfVec3h (class GfVec3f const &other) | |
Construct from GfVec3f. | |
GfVec3h (class GfVec3i const &other) | |
Implicitly convert from GfVec3i. | |
GfVec3h & | Set (GfHalf s0, GfHalf s1, GfHalf s2) |
Set all elements with passed arguments. | |
GfVec3h & | Set (GfHalf const *a) |
Set all elements with a pointer to data. | |
GfHalf const * | data () const |
Direct data access. | |
GfHalf * | data () |
GfHalf const * | GetArray () const |
GfHalf const & | operator[] (size_t i) const |
Indexing. | |
GfHalf & | operator[] (size_t i) |
bool | operator== (GfVec3h const &other) const |
Equality comparison. | |
bool | operator!= (GfVec3h const &other) const |
GF_API bool | operator== (class GfVec3d const &other) const |
Equality comparison. | |
GF_API bool | operator== (class GfVec3f const &other) const |
Equality comparison. | |
GF_API bool | operator== (class GfVec3i const &other) const |
Equality comparison. | |
GfVec3h | operator- () const |
Create a vec with negated elements. | |
GfVec3h & | operator+= (GfVec3h const &other) |
Addition. | |
GfVec3h & | operator-= (GfVec3h const &other) |
Subtraction. | |
GfVec3h & | operator*= (double s) |
Multiplication by scalar. | |
GfVec3h | operator* (double s) const |
GfVec3h & | operator/= (double s) |
Division by scalar. | |
GfVec3h | operator/ (double s) const |
GfHalf | operator* (GfVec3h const &v) const |
See GfDot(). | |
GfVec3h | GetProjection (GfVec3h const &v) const |
Returns the projection of this onto v . | |
GfVec3h | GetComplement (GfVec3h const &b) const |
Returns the orthogonal complement of this->GetProjection(b) . | |
GfHalf | GetLengthSq () const |
Squared length. | |
GfHalf | GetLength () const |
Length. | |
GfHalf | Normalize (GfHalf eps=0.001) |
Normalizes the vector in place to unit length, returning the length before normalization. | |
GfVec3h | GetNormalized (GfHalf eps=0.001) const |
GF_API void | BuildOrthonormalFrame (GfVec3h *v1, GfVec3h *v2, GfHalf eps=0.001) const |
Sets v1 and v2 to unit vectors such that v1, v2 and *this are mutually orthogonal. | |
Static Public Member Functions | |
static GfVec3h | XAxis () |
Create a unit vector along the X-axis. | |
static GfVec3h | YAxis () |
Create a unit vector along the Y-axis. | |
static GfVec3h | ZAxis () |
Create a unit vector along the Z-axis. | |
static GfVec3h | Axis (size_t i) |
Create a unit vector along the i-th axis, zero-based. | |
static GF_API bool | OrthogonalizeBasis (GfVec3h *tx, GfVec3h *ty, GfVec3h *tz, const bool normalize, double eps=GF_MIN_ORTHO_TOLERANCE) |
Orthogonalize and optionally normalize a set of basis vectors. | |
Static Public Attributes | |
static const size_t | dimension = 3 |
Friends | |
size_t | hash_value (GfVec3h const &vec) |
Hash. | |
GfVec3h | operator+ (GfVec3h const &l, GfVec3h const &r) |
GfVec3h | operator- (GfVec3h const &l, GfVec3h const &r) |
GfVec3h | operator* (double s, GfVec3h const &v) |
Basic type for a vector of 3 GfHalf components.
Represents a vector of 3 components of type GfHalf
. It is intended to be fast and simple.
typedef GfHalf ScalarType |
|
default |
Default constructor does no initialization.
|
inlineexplicitconstexpr |
|
inlinestatic |
Sets v1
and v2
to unit vectors such that v1, v2 and *this are mutually orthogonal.
If the length L of *this is smaller than eps
, then v1 and v2 will have magnitude L/eps. As a result, the function delivers a continuous result as *this shrinks in length.
Returns the orthogonal complement of this->GetProjection(b)
.
That is:
Normalizes the vector in place to unit length, returning the length before normalization.
If the length of the vector is smaller than eps
, then the vector is set to vector/eps
. The original length of the vector is returned. See also GfNormalize().
|
inline |
|
inline |
GF_API bool operator== | ( | class GfVec3d const & | other | ) | const |
Equality comparison.
GF_API bool operator== | ( | class GfVec3f const & | other | ) | const |
Equality comparison.
GF_API bool operator== | ( | class GfVec3i const & | other | ) | const |
Equality comparison.
|
inline |
|
inline |
|
static |
Orthogonalize and optionally normalize a set of basis vectors.
This uses an iterative method that is very stable even when the vectors are far from orthogonal (close to colinear). The number of iterations and thus the computation time does increase as the vectors become close to colinear, however. Returns a bool specifying whether the solution converged after a number of iterations. If it did not converge, the returned vectors will be as close as possible to orthogonal within the iteration limit. Colinear vectors will be unaltered, and the method will return false.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |