Panda3D
|
This is the base class for all three-component vectors and points. More...
Public Types | |
enum | { num_components = 3, is_int = 0 } |
Public Member Functions | |
object | __getattr__ (str attr_name) |
__init__ () | |
__init__ (const LVecBase2f copy, float z) | |
__init__ (const LVecBase3f) | |
__init__ (float fill_value) | |
__init__ (float x, float y, float z) | |
object | __ipow__ (float exponent) |
LVecBase3f | __pow__ (float exponent) |
object | __reduce__ () |
str | __repr__ () |
int | __setattr__ (str attr_name, object assign) |
int | addHash (int hash) |
Adds the vector into the running hash. More... | |
int | addHash (int hash, float threshold) |
Adds the vector into the running hash. More... | |
addToCell (int i, float value) | |
addX (float value) | |
addY (float value) | |
addZ (float value) | |
bool | almostEqual (const LVecBase3f other) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. More... | |
bool | almostEqual (const LVecBase3f other, float threshold) |
Returns true if two vectors are memberwise equal within a specified tolerance. More... | |
int | compareTo (const LVecBase3f other) |
This flavor of compare_to uses a default threshold value based on the numeric type. More... | |
int | compareTo (const LVecBase3f other, float threshold) |
Sorts vectors lexicographically, componentwise. More... | |
componentwiseMult (const LVecBase3f other) | |
LVecBase3f | cross (const LVecBase3f other) |
crossInto (const LVecBase3f other) | |
float | dot (const LVecBase3f other) |
fill (float fill_value) | |
Sets each element of the vector to the indicated fill_value. More... | |
LVecBase3f | fmax (const LVecBase3f other) |
LVecBase3f | fmin (const LVecBase3f other) |
generateHash (ChecksumHashGenerator hashgen) | |
Adds the vector to the indicated hash generator. More... | |
generateHash (ChecksumHashGenerator hashgen, float threshold) | |
Adds the vector to the indicated hash generator. More... | |
float | getCell (int i) |
getData () | |
Returns the address of the first of the three data elements in the vector. More... | |
int | getHash () |
Returns a suitable hash for phash_map. More... | |
int | getHash (float threshold) |
Returns a suitable hash for phash_map. More... | |
LVecBase3f | getStandardizedHpr () |
Try to un-spin the hpr to a standard form. More... | |
float | getX () |
LVecBase2f | getXy () |
Returns a 2-component vector that shares just the first two components of this vector. More... | |
LVecBase2f | getXz () |
Returns a 2-component vector that shares just the first and last components of this vector. More... | |
float | getY () |
LVecBase2f | getYz () |
Returns a 2-component vector that shares just the last two components of this vector. More... | |
float | getZ () |
bool | isNan () |
Returns true if any component of the vector is not-a-number, false otherwise. More... | |
float | length () |
Returns the length of the vector, by the Pythagorean theorem. More... | |
float | lengthSquared () |
Returns the square of the vector's length, cheap and easy. More... | |
bool | normalize () |
Normalizes the vector in place. More... | |
LVecBase3f | normalized () |
Normalizes the vector and returns the normalized vector as a copy. More... | |
operator new (int size) | |
bool | operator!= (const LVecBase3f other) |
LVecBase3f | operator* (float scalar) |
LVecBase3f | operator*= (float scalar) |
LVecBase3f | operator+ (const LVecBase3f other) |
LVecBase3f | operator+= (const LVecBase3f other) |
LVecBase3f | operator- () |
LVecBase3f | operator- (const LVecBase3f other) |
LVecBase3f | operator-= (const LVecBase3f other) |
LVecBase3f | operator/ (float scalar) |
LVecBase3f | operator/= (float scalar) |
bool | operator< (const LVecBase3f other) |
LVecBase3f | operator= (const LVecBase3f copy) |
LVecBase3f | operator= (float fill_value) |
bool | operator== (const LVecBase3f other) |
float | operator[] (int i) |
operator[] (int i, float assign_val) | |
output (Ostream out) | |
LVecBase3f | project (const LVecBase3f onto) |
Returns a new vector representing the projection of this vector onto another one. More... | |
readDatagram (DatagramIterator source) | |
Reads the vector from the Datagram using get_stdfloat(). More... | |
readDatagramFixed (DatagramIterator source) | |
Reads the vector from the Datagram using get_float32() or get_float64(). More... | |
set (float x, float y, float z) | |
setCell (int i, float value) | |
setX (float value) | |
setY (float value) | |
setZ (float value) | |
writeDatagram (Datagram destination) | |
Writes the vector to the Datagram using add_stdfloat(). More... | |
writeDatagramFixed (Datagram destination) | |
Writes the vector to the Datagram using add_float32() or add_float64(), depending on the type of floats in the vector, regardless of the setting of Datagram::set_stdfloat_double(). More... | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static int | getNumComponents () |
static int | size () |
static const LVecBase3f | unitX () |
Returns a unit X vector. More... | |
static const LVecBase3f | unitY () |
Returns a unit Y vector. More... | |
static const LVecBase3f | unitZ () |
Returns a unit Z vector. More... | |
static const LVecBase3f | zero () |
Returns a zero-length vector. More... | |
Public Attributes | |
float | x |
LVecBase2f | xy |
Returns a 2-component vector that shares just the first two components of this vector. More... | |
LVecBase2f | xz |
Returns a 2-component vector that shares just the first and last components of this vector. More... | |
float | y |
LVecBase2f | yz |
Returns a 2-component vector that shares just the last two components of this vector. More... | |
float | z |
This is the base class for all three-component vectors and points.
object __getattr__ | ( | str | attr_name | ) |
__init__ | ( | ) |
__init__ | ( | const LVecBase2f | copy, |
float | z | ||
) |
__init__ | ( | const | LVecBase3f | ) |
__init__ | ( | float | fill_value | ) |
__init__ | ( | float | x, |
float | y, | ||
float | z | ||
) |
object __ipow__ | ( | float | exponent | ) |
LVecBase3f __pow__ | ( | float | exponent | ) |
object __reduce__ | ( | ) |
str __repr__ | ( | ) |
int __setattr__ | ( | str | attr_name, |
object | assign | ||
) |
int addHash | ( | int | hash | ) |
Adds the vector into the running hash.
int addHash | ( | int | hash, |
float | threshold | ||
) |
Adds the vector into the running hash.
addToCell | ( | int | i, |
float | value | ||
) |
addX | ( | float | value | ) |
addY | ( | float | value | ) |
addZ | ( | float | value | ) |
bool almostEqual | ( | const LVecBase3f | other | ) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | const LVecBase3f | other, |
float | threshold | ||
) |
Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo | ( | const LVecBase3f | other | ) |
This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo | ( | const LVecBase3f | other, |
float | threshold | ||
) |
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).
componentwiseMult | ( | const LVecBase3f | other | ) |
LVecBase3f cross | ( | const LVecBase3f | other | ) |
crossInto | ( | const LVecBase3f | other | ) |
float dot | ( | const LVecBase3f | other | ) |
fill | ( | float | fill_value | ) |
Sets each element of the vector to the indicated fill_value.
This is particularly useful for initializing to zero.
LVecBase3f fmax | ( | const LVecBase3f | other | ) |
LVecBase3f fmin | ( | const LVecBase3f | other | ) |
generateHash | ( | ChecksumHashGenerator | hashgen | ) |
Adds the vector to the indicated hash generator.
generateHash | ( | ChecksumHashGenerator | hashgen, |
float | threshold | ||
) |
Adds the vector to the indicated hash generator.
float getCell | ( | int | i | ) |
|
static |
getData | ( | ) |
Returns the address of the first of the three data elements in the vector.
The remaining elements occupy the next positions consecutively in memory.
int getHash | ( | ) |
Returns a suitable hash for phash_map.
int getHash | ( | float | threshold | ) |
Returns a suitable hash for phash_map.
|
static |
LVecBase3f getStandardizedHpr | ( | ) |
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
float getX | ( | ) |
LVecBase2f getXy | ( | ) |
Returns a 2-component vector that shares just the first two components of this vector.
LVecBase2f getXz | ( | ) |
Returns a 2-component vector that shares just the first and last components of this vector.
float getY | ( | ) |
LVecBase2f getYz | ( | ) |
Returns a 2-component vector that shares just the last two components of this vector.
float getZ | ( | ) |
bool isNan | ( | ) |
Returns true if any component of the vector is not-a-number, false otherwise.
float length | ( | ) |
Returns the length of the vector, by the Pythagorean theorem.
float lengthSquared | ( | ) |
Returns the square of the vector's length, cheap and easy.
bool normalize | ( | ) |
Normalizes the vector in place.
Returns true if the vector was normalized, false if it was a zero-length vector.
LVecBase3f normalized | ( | ) |
Normalizes the vector and returns the normalized vector as a copy.
If the vector was a zero-length vector, a zero length vector will be returned.
operator new | ( | int | size | ) |
bool operator!= | ( | const LVecBase3f | other | ) |
LVecBase3f operator* | ( | float | scalar | ) |
LVecBase3f operator*= | ( | float | scalar | ) |
LVecBase3f operator+ | ( | const LVecBase3f | other | ) |
LVecBase3f operator+= | ( | const LVecBase3f | other | ) |
LVecBase3f operator- | ( | ) |
LVecBase3f operator- | ( | const LVecBase3f | other | ) |
LVecBase3f operator-= | ( | const LVecBase3f | other | ) |
LVecBase3f operator/ | ( | float | scalar | ) |
LVecBase3f operator/= | ( | float | scalar | ) |
bool operator< | ( | const LVecBase3f | other | ) |
LVecBase3f operator= | ( | const LVecBase3f | copy | ) |
LVecBase3f operator= | ( | float | fill_value | ) |
bool operator== | ( | const LVecBase3f | other | ) |
float operator[] | ( | int | i | ) |
operator[] | ( | int | i, |
float | assign_val | ||
) |
output | ( | Ostream | out | ) |
LVecBase3f project | ( | const LVecBase3f | onto | ) |
Returns a new vector representing the projection of this vector onto another one.
The resulting vector will be a scalar multiple of onto.
readDatagram | ( | DatagramIterator | source | ) |
Reads the vector from the Datagram using get_stdfloat().
readDatagramFixed | ( | DatagramIterator | source | ) |
Reads the vector from the Datagram using get_float32() or get_float64().
See write_datagram_fixed().
set | ( | float | x, |
float | y, | ||
float | z | ||
) |
setCell | ( | int | i, |
float | value | ||
) |
setX | ( | float | value | ) |
setY | ( | float | value | ) |
setZ | ( | float | value | ) |
|
static |
|
static |
Returns a unit X vector.
|
static |
Returns a unit Y vector.
|
static |
Returns a unit Z vector.
writeDatagram | ( | Datagram | destination | ) |
Writes the vector to the Datagram using add_stdfloat().
This is appropriate when you want to write the vector using the standard width setting, especially when you are writing a bam file.
writeDatagramFixed | ( | Datagram | destination | ) |
Writes the vector to the Datagram using add_float32() or add_float64(), depending on the type of floats in the vector, regardless of the setting of Datagram::set_stdfloat_double().
This is appropriate when you want to write a fixed-width value to the datagram, especially when you are not writing a bam file.
|
static |
Returns a zero-length vector.
float x |
LVecBase2f xy |
Returns a 2-component vector that shares just the first two components of this vector.
LVecBase2f xz |
Returns a 2-component vector that shares just the first and last components of this vector.
float y |
LVecBase2f yz |
Returns a 2-component vector that shares just the last two components of this vector.
float z |