Panda3D
|
This is a three-component vector distance (as opposed to a three-component point, which represents a particular point in space). More...
Public Member Functions | |
Vec3D () | |
Vec3D (VBase3D const copy) | |
Vec3D (double x, double y, double z) | |
Vec3D (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) | |
addZ (double value) | |
bool | almostEqual (VBase3D const other) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. | |
bool | almostEqual (VBase3D const other, double threshold) |
Returns true if two vectors are memberwise equal within a specified tolerance. | |
double | angleDeg (Vec3D const other) |
Returns the angle between this vector and the other one, expressed in degrees. | |
double | angleRad (Vec3D const other) |
Returns the unsigned angle between this vector and the other one, expressed in radians. | |
int | compareTo (VBase3D const other, double threshold) |
Sorts vectors lexicographically, componentwise. | |
int | compareTo (VBase3D const other) |
This flavor of compare_to uses a default threshold value based on the numeric type. | |
Vec3D | cross (VBase3D const other) |
crossInto (VBase3D const other) | |
double | dot (VBase3D const other) |
fill (double fill_value) | |
Sets each element of the vector to the indicated fill_value. | |
VBase3D | fmax (VBase3D const other) |
VBase3D | fmin (VBase3D 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 three 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, three. | |
VBase3D | getStandardizedHpr () |
Try to un-spin the hpr to a standard form. | |
double | getX () |
Vec2D | getXy () |
Returns a 2-component vector that shares just the first two components of this vector. | |
Vec2D | getXz () |
Returns a 2-component vector that shares just the first and last components of this vector. | |
double | getY () |
Vec2D | getYz () |
Returns a 2-component vector that shares just the last two components of this vector. | |
double | getZ () |
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!= (VBase3D const other) |
Vec3D | operator* (double scalar) |
VBase3D | operator*= (double scalar) |
VBase3D | operator+ (VBase3D const other) |
Vec3D | operator+ (Vec3D const other) |
VBase3D | operator+= (VBase3D const other) |
VBase3D | operator- (VBase3D const other) |
Vec3D | operator- (Vec3D const other) |
Vec3D | operator- () |
VBase3D | operator-= (VBase3D const other) |
Vec3D | operator/ (double scalar) |
VBase3D | operator/= (double scalar) |
bool | operator< (VBase3D const other) |
This performs a lexicographical comparison. | |
Vec3D | operator= (double fill_value) |
Vec3D | operator= (VBase3D const copy) |
bool | operator== (VBase3D const other) |
operator[] (int i) | |
double | operator[] (int i) |
output (ostream out) | |
Vec3D | project (VBase3D 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. | |
double | relativeAngleDeg (Vec3D const other) |
This method is deprecated. | |
double | relativeAngleRad (Vec3D const other) |
This method is deprecated. | |
set (double x, double y, double z) | |
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) | |
setZ (double value) | |
double | signedAngleDeg (Vec3D const other, Vec3D const ref) |
Returns the signed angle between two vectors. | |
double | signedAngleRad (Vec3D const other, Vec3D const ref) |
returns the signed angle between two vectors. | |
Static Public Member Functions | |
static Vec3D | back (CoordinateSystem cs) |
Returns the back vector for the given coordinate system. | |
static Vec3D | back () |
Returns the back vector for the given coordinate system. | |
static Vec3D | down (CoordinateSystem cs) |
Returns the down vector for the given coordinate system. | |
static Vec3D | down () |
Returns the down vector for the given coordinate system. | |
static Vec3D | forward (CoordinateSystem cs) |
Returns the forward vector for the given coordinate system. | |
static Vec3D | forward () |
Returns the forward vector for the given coordinate system. | |
static TypeHandle | getClassType () |
static Vec3D | left (CoordinateSystem cs) |
Returns the left vector for the given coordinate system. | |
static Vec3D | left () |
Returns the left vector for the given coordinate system. | |
static Vec3D | rfu (double right, double fwd, double up, CoordinateSystem cs) |
Returns a vector that is described by its right, forward, and up components, in whatever way the coordinate system represents that vector. | |
static Vec3D | rfu (double right, double fwd, double up) |
Returns a vector that is described by its right, forward, and up components, in whatever way the coordinate system represents that vector. | |
static Vec3D | right (CoordinateSystem cs) |
Returns the right vector for the given coordinate system. | |
static Vec3D | right () |
Returns the right vector for the given coordinate system. | |
static int | size () |
Returns 3: the number of components of a LVecBase3. | |
static Vec3D const | unitX () |
Returns a unit X vector. | |
static Vec3D const | unitY () |
Returns a unit Y vector. | |
static Vec3D const | unitZ () |
Returns a unit Z vector. | |
static Vec3D | up () |
Returns the up vector for the given coordinate system. | |
static Vec3D | up (CoordinateSystem cs) |
Returns the up vector for the given coordinate system. | |
static Vec3D const | zero () |
Returns a zero-length vector. |
This is a three-component vector distance (as opposed to a three-component point, which represents a particular point in space).
Some of the methods are slightly different between LPoint3 and LVector3; in particular, subtraction of two points yields a vector, while addition of a vector and a point yields a point.
Vec3D | ( | ) |
Vec3D | ( | double | fill_value | ) |
Vec3D | ( | double | x, |
double | y, | ||
double | z | ||
) |
Adds the vector into the running hash.
addToCell | ( | int | i, |
double | value | ||
) | [inherited] |
addX | ( | double | value | ) | [inherited] |
addY | ( | double | value | ) | [inherited] |
addZ | ( | double | value | ) | [inherited] |
bool almostEqual | ( | VBase3D const | other | ) | [inherited] |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | VBase3D const | other, |
double | threshold | ||
) | [inherited] |
Returns true if two vectors are memberwise equal within a specified tolerance.
double angleDeg | ( | Vec3D const | other | ) |
Returns the angle between this vector and the other one, expressed in degrees.
Both vectors should be initially normalized.
double angleRad | ( | Vec3D const | other | ) |
Returns the unsigned angle between this vector and the other one, expressed in radians.
Both vectors should be initially normalized.
static Vec3D back | ( | CoordinateSystem | cs | ) | [static] |
Returns the back vector for the given coordinate system.
static Vec3D back | ( | ) | [static] |
Returns the back vector for the given coordinate system.
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).
crossInto | ( | VBase3D const | other | ) | [inherited] |
double dot | ( | VBase3D const | other | ) | [inherited] |
static Vec3D down | ( | ) | [static] |
Returns the down vector for the given coordinate system.
static Vec3D down | ( | CoordinateSystem | cs | ) | [static] |
Returns the down vector for the given coordinate system.
fill | ( | double | fill_value | ) | [inherited] |
Sets each element of the vector to the indicated fill_value.
This is particularly useful for initializing to zero.
static Vec3D forward | ( | ) | [static] |
Returns the forward vector for the given coordinate system.
static Vec3D forward | ( | CoordinateSystem | cs | ) | [static] |
Returns the forward vector for the given coordinate system.
PyObject getattr | ( | string | attr_name | ) |
This is used to implement swizzle masks.
Reimplemented from VBase3D.
double getCell | ( | int | i | ) | [inherited] |
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from VBase3D.
getData | ( | ) | [inherited] |
Returns the address of the first of the three data elements in the vector.
The remaining elements occupy the next positions 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, three.
VBase3D getStandardizedHpr | ( | ) | [inherited] |
Try to un-spin the hpr to a standard form.
Like all standards, someone decides between many arbitrary possible standards. This function assumes that 0 and 360 are the same, as is 720 and -360. Also 180 and -180 are the same. Another example is -90 and 270. Each element will be in the range -180.0 to 179.99999. The original usage of this function is for human readable output.
It doesn't work so well for asserting that foo_hpr is roughly equal to bar_hpr. Try using LQuaternionf.is_same_direction() for that. See Also: get_standardized_rotation, LQuaternion.is_same_direction
double getX | ( | ) | [inherited] |
Vec2D getXy | ( | ) |
Returns a 2-component vector that shares just the first two components of this vector.
Reimplemented from VBase3D.
Vec2D getXz | ( | ) |
Returns a 2-component vector that shares just the first and last components of this vector.
Reimplemented from VBase3D.
double getY | ( | ) | [inherited] |
Vec2D getYz | ( | ) |
Returns a 2-component vector that shares just the last two components of this vector.
Reimplemented from VBase3D.
double getZ | ( | ) | [inherited] |
bool isNan | ( | ) | [inherited] |
Returns true if any component of the vector is not-a-number, false otherwise.
static Vec3D left | ( | CoordinateSystem | cs | ) | [static] |
Returns the left vector for the given coordinate system.
static Vec3D left | ( | ) | [static] |
Returns the left vector for the given coordinate system.
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!= | ( | VBase3D const | other | ) | [inherited] |
VBase3D operator*= | ( | double | scalar | ) | [inherited] |
VBase3D operator/= | ( | double | scalar | ) | [inherited] |
bool operator< | ( | VBase3D 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== | ( | VBase3D const | other | ) | [inherited] |
operator[] | ( | int | i | ) | [inherited] |
double 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 VBase3D.
PyObject reduce | ( | PyObject | self | ) | [inherited] |
This special Python method is implement to provide support for the pickle module.
double relativeAngleDeg | ( | Vec3D const | other | ) |
This method is deprecated.
Do not use.
double relativeAngleRad | ( | Vec3D const | other | ) |
This method is deprecated.
Do not use.
static Vec3D rfu | ( | double | right, |
double | fwd, | ||
double | up, | ||
CoordinateSystem | cs | ||
) | [static] |
Returns a vector that is described by its right, forward, and up components, in whatever way the coordinate system represents that vector.
INLINE_LINMATH FLOATNAME(LVector3) & FLOATNAME(LVector3)::
static Vec3D rfu | ( | double | right, |
double | fwd, | ||
double | up | ||
) | [static] |
Returns a vector that is described by its right, forward, and up components, in whatever way the coordinate system represents that vector.
INLINE_LINMATH FLOATNAME(LVector3) & FLOATNAME(LVector3)::
static Vec3D right | ( | CoordinateSystem | cs | ) | [static] |
Returns the right vector for the given coordinate system.
static Vec3D right | ( | ) | [static] |
Returns the right vector for the given coordinate system.
set | ( | double | x, |
double | y, | ||
double | z | ||
) | [inherited] |
int setattr | ( | PyObject | self, |
string | attr_name, | ||
PyObject | assign | ||
) |
This is used to implement write masks.
Reimplemented from VBase3D.
setCell | ( | int | i, |
double | value | ||
) | [inherited] |
setitem | ( | int | i, |
double | v | ||
) | [inherited] |
setX | ( | double | value | ) | [inherited] |
setY | ( | double | value | ) | [inherited] |
setZ | ( | double | value | ) | [inherited] |
Returns the signed angle between two vectors.
The angle is positive if the rotation from this vector to other is clockwise when looking in the direction of the ref vector.
Vectors (except the ref vector) should be initially normalized.
returns the signed angle between two vectors.
The angle is positive if the rotation from this vector to other is clockwise when looking in the direction of the ref vector.
Vectors (except the ref vector) should be initially normalized.
static int size | ( | ) | [static, inherited] |
Returns 3: the number of components of a LVecBase3.
static Vec3D up | ( | CoordinateSystem | cs | ) | [static] |
Returns the up vector for the given coordinate system.
static Vec3D up | ( | ) | [static] |
Returns the up vector for the given coordinate system.