Panda3D
|
This is a two-component vector offset. More...
Public Member Functions | |
Vec2D () | |
Vec2D (VBase2D const copy) | |
Vec2D (double x, double y) | |
Vec2D (double fill_value) | |
unsigned int | addHash (unsigned int hash) |
Adds the vector into the running hash. | |
unsigned int | addHash (unsigned int hash, double threshold) |
Adds the vector into the running hash. | |
addToCell (int i, double value) | |
addX (double value) | |
addY (double value) | |
bool | almostEqual (VBase2D const other) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. | |
bool | almostEqual (VBase2D const other, double threshold) |
Returns true if two vectors are memberwise equal within a specified tolerance. | |
int | compareTo (VBase2D const other) |
This flavor of compare_to uses a default threshold value based on the numeric type. | |
int | compareTo (VBase2D const other, double threshold) |
Sorts vectors lexicographically, componentwise. | |
double | dot (VBase2D const other) |
fill (double fill_value) | |
Sets each element of the vector to the indicated fill_value. | |
VBase2D | fmax (VBase2D const other) |
VBase2D | fmin (VBase2D const other) |
PyObject | getattr (string attr_name) |
This is used to implement swizzle masks. | |
double | getCell (int i) |
getData () | |
Returns the address of the first of the two data elements in the vector. | |
unsigned int | getHash (double threshold) |
Returns a suitable hash for phash_map. | |
unsigned int | getHash () |
Returns a suitable hash for phash_map. | |
int | getNumComponents () |
Returns the number of elements in the vector, two. | |
double | getX () |
double | getY () |
bool | isNan () |
Returns true if any component of the vector is not-a-number, false otherwise. | |
double | length () |
Returns the length of the vector, by the Pythagorean theorem. | |
double | lengthSquared () |
Returns the square of the vector's length, cheap and easy. | |
bool | normalize () |
Normalizes the vector in place. | |
operator new (unsigned int size) | |
bool | operator!= (VBase2D const other) |
Vec2D | operator* (double scalar) |
VBase2D | operator*= (double scalar) |
Vec2D | operator+ (Vec2D const other) |
VBase2D | operator+ (VBase2D const other) |
VBase2D | operator+= (VBase2D const other) |
Vec2D | operator- () |
VBase2D | operator- (VBase2D const other) |
Vec2D | operator- (Vec2D const other) |
VBase2D | operator-= (VBase2D const other) |
Vec2D | operator/ (double scalar) |
VBase2D | operator/= (double scalar) |
bool | operator< (VBase2D const other) |
This performs a lexicographical comparison. | |
Vec2D | operator= (double fill_value) |
Vec2D | operator= (VBase2D const copy) |
bool | operator== (VBase2D const other) |
operator[] (int i) | |
double | operator[] (int i) |
output (ostream out) | |
Vec2D | project (VBase2D const onto) |
Returns a new vector representing the projection of this vector onto another one. | |
pythonRepr (ostream out, string class_name) | |
PyObject | reduce (PyObject self) |
This special Python method is implement to provide support for the pickle module. | |
set (double x, double y) | |
int | setattr (PyObject self, string attr_name, PyObject assign) |
This is used to implement write masks. | |
setCell (int i, double value) | |
setitem (int i, double v) | |
setX (double value) | |
setY (double value) | |
double | signedAngleDeg (Vec2D const other) |
returns the signed angled between two vectors. | |
double | signedAngleRad (Vec2D const other) |
returns the signed angled between two vectors. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static int | size () |
Returns 2: the number of components of a LVecBase2. | |
static Vec2D const | unitX () |
Returns a unit X vector. | |
static Vec2D const | unitY () |
Returns a unit Y vector. | |
static Vec2D const | zero () |
Returns a zero-length vector. |
This is a two-component vector offset.
Vec2D | ( | ) |
Vec2D | ( | double | fill_value | ) |
Vec2D | ( | double | x, |
double | y | ||
) |
Adds the vector into the running hash.
addToCell | ( | int | i, |
double | value | ||
) | [inherited] |
addX | ( | double | value | ) | [inherited] |
addY | ( | double | value | ) | [inherited] |
bool almostEqual | ( | VBase2D const | other | ) | [inherited] |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | VBase2D const | other, |
double | threshold | ||
) | [inherited] |
Returns true if two vectors are memberwise equal within a specified tolerance.
This flavor of compare_to uses a default threshold value based on the numeric type.
Sorts vectors lexicographically, componentwise.
Returns a number less than 0 if this vector sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent (within the indicated tolerance).
double dot | ( | VBase2D const | other | ) | [inherited] |
fill | ( | double | fill_value | ) | [inherited] |
Sets each element of the vector to the indicated fill_value.
This is particularly useful for initializing to zero.
PyObject getattr | ( | string | attr_name | ) |
This is used to implement swizzle masks.
Reimplemented from VBase2D.
double getCell | ( | int | i | ) | [inherited] |
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from VBase2D.
getData | ( | ) | [inherited] |
Returns the address of the first of the two data elements in the vector.
The next element occupies the next position consecutively in memory.
unsigned int getHash | ( | ) | [inherited] |
Returns a suitable hash for phash_map.
unsigned int getHash | ( | double | threshold | ) | [inherited] |
Returns a suitable hash for phash_map.
int getNumComponents | ( | ) | [inherited] |
Returns the number of elements in the vector, two.
double getX | ( | ) | [inherited] |
double getY | ( | ) | [inherited] |
bool isNan | ( | ) | [inherited] |
Returns true if any component of the vector is not-a-number, false otherwise.
double length | ( | ) | [inherited] |
Returns the length of the vector, by the Pythagorean theorem.
double lengthSquared | ( | ) | [inherited] |
Returns the square of the vector's length, cheap and easy.
bool normalize | ( | ) | [inherited] |
Normalizes the vector in place.
Returns true if the vector was normalized, false if it was a zero-length vector.
operator new | ( | unsigned int | size | ) | [inherited] |
bool operator!= | ( | VBase2D const | other | ) | [inherited] |
VBase2D operator*= | ( | double | scalar | ) | [inherited] |
VBase2D operator/= | ( | double | scalar | ) | [inherited] |
bool operator< | ( | VBase2D const | other | ) | [inherited] |
This performs a lexicographical comparison.
It's of questionable mathematical meaning, but sometimes has a practical purpose for sorting unique vectors, especially in an STL container. Also see compare_to().
bool operator== | ( | VBase2D const | other | ) | [inherited] |
double operator[] | ( | int | i | ) | [inherited] |
operator[] | ( | int | i | ) | [inherited] |
output | ( | ostream | out | ) | [inherited] |
Returns a new vector representing the projection of this vector onto another one.
The resulting vector will be a scalar multiple of onto.
Reimplemented from VBase2D.
PyObject reduce | ( | PyObject | self | ) | [inherited] |
This special Python method is implement to provide support for the pickle module.
set | ( | double | x, |
double | y | ||
) | [inherited] |
int setattr | ( | PyObject | self, |
string | attr_name, | ||
PyObject | assign | ||
) |
This is used to implement write masks.
Reimplemented from VBase2D.
setCell | ( | int | i, |
double | value | ||
) | [inherited] |
setitem | ( | int | i, |
double | v | ||
) | [inherited] |
setX | ( | double | value | ) | [inherited] |
setY | ( | double | value | ) | [inherited] |
double signedAngleDeg | ( | Vec2D const | other | ) |
returns the signed angled between two vectors.
normalization is NOT necessary
double signedAngleRad | ( | Vec2D const | other | ) |
returns the signed angled between two vectors.
normalization is NOT necessary
static int size | ( | ) | [static, inherited] |
Returns 2: the number of components of a LVecBase2.