|
Basic type for a vector of 2 double components. More...
#include <vec2d.h>
Public Types | |
typedef double | ScalarType |
Scalar element type and dimension. | |
Public Member Functions | |
GfVec2d ()=default | |
Default constructor does no initialization. | |
constexpr | GfVec2d (double value) |
Initialize all elements to a single value. | |
constexpr | GfVec2d (double s0, double s1) |
Initialize all elements with explicit arguments. | |
template<class Scl > | |
constexpr | GfVec2d (Scl const *p) |
Construct with pointer to values. | |
GfVec2d (class GfVec2f const &other) | |
Implicitly convert from GfVec2f. | |
GfVec2d (class GfVec2h const &other) | |
Implicitly convert from GfVec2h. | |
GfVec2d (class GfVec2i const &other) | |
Implicitly convert from GfVec2i. | |
GfVec2d & | Set (double s0, double s1) |
Set all elements with passed arguments. | |
GfVec2d & | Set (double const *a) |
Set all elements with a pointer to data. | |
double const * | data () const |
Direct data access. | |
double * | data () |
double const * | GetArray () const |
double const & | operator[] (size_t i) const |
Indexing. | |
double & | operator[] (size_t i) |
bool | operator== (GfVec2d const &other) const |
Equality comparison. | |
bool | operator!= (GfVec2d const &other) const |
GF_API bool | operator== (class GfVec2f const &other) const |
Equality comparison. | |
GF_API bool | operator== (class GfVec2h const &other) const |
Equality comparison. | |
GF_API bool | operator== (class GfVec2i const &other) const |
Equality comparison. | |
GfVec2d | operator- () const |
Create a vec with negated elements. | |
GfVec2d & | operator+= (GfVec2d const &other) |
Addition. | |
GfVec2d & | operator-= (GfVec2d const &other) |
Subtraction. | |
GfVec2d & | operator*= (double s) |
Multiplication by scalar. | |
GfVec2d | operator* (double s) const |
GfVec2d & | operator/= (double s) |
Division by scalar. | |
GfVec2d | operator/ (double s) const |
double | operator* (GfVec2d const &v) const |
See GfDot(). | |
GfVec2d | GetProjection (GfVec2d const &v) const |
Returns the projection of this onto v . | |
GfVec2d | GetComplement (GfVec2d const &b) const |
Returns the orthogonal complement of this->GetProjection(b) . | |
double | GetLengthSq () const |
Squared length. | |
double | GetLength () const |
Length. | |
double | Normalize (double eps=GF_MIN_VECTOR_LENGTH) |
Normalizes the vector in place to unit length, returning the length before normalization. | |
GfVec2d | GetNormalized (double eps=GF_MIN_VECTOR_LENGTH) const |
Static Public Member Functions | |
static GfVec2d | XAxis () |
Create a unit vector along the X-axis. | |
static GfVec2d | YAxis () |
Create a unit vector along the Y-axis. | |
static GfVec2d | Axis (size_t i) |
Create a unit vector along the i-th axis, zero-based. | |
Static Public Attributes | |
static const size_t | dimension = 2 |
Friends | |
size_t | hash_value (GfVec2d const &vec) |
Hash. | |
GfVec2d | operator+ (GfVec2d const &l, GfVec2d const &r) |
GfVec2d | operator- (GfVec2d const &l, GfVec2d const &r) |
GfVec2d | operator* (double s, GfVec2d const &v) |
Basic type for a vector of 2 double components.
Represents a vector of 2 components of type double
. It is intended to be fast and simple.
typedef double ScalarType |
|
default |
Default constructor does no initialization.
|
inlineexplicitconstexpr |
|
inlineconstexpr |
|
inlineexplicitconstexpr |
|
inlinestatic |
Returns the orthogonal complement of this->GetProjection(b)
.
That is:
|
inline |
|
inline |
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 |
|
inline |
GF_API bool operator== | ( | class GfVec2f const & | other | ) | const |
Equality comparison.
GF_API bool operator== | ( | class GfVec2h const & | other | ) | const |
Equality comparison.
GF_API bool operator== | ( | class GfVec2i const & | other | ) | const |
Equality comparison.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |