Panda3D
|
This is the base class for all two-component vectors and points. More...
#include <pandadoc.hpp>
Public Types | |
enum | { num_components = 2 , is_int = 0 } |
Public Member Functions | |
object | __ceil__ () |
object | __floor__ () |
object | __floordiv__ (double scalar) |
object | __getattr__ (str attr_name) |
object | __ifloordiv__ (double scalar) |
__init__ () | |
__init__ (const LVecBase2d) | |
__init__ (double fill_value) | |
__init__ (double x, double y) | |
object | __ipow__ (double exponent) |
object | __pow__ (double exponent) |
object | __reduce__ () |
str | __repr__ () |
object | __round__ () |
int | __setattr__ (str attr_name, object assign) |
int | addHash (int hash) |
Adds the vector into the running hash. | |
int | addHash (int hash, double threshold) |
Adds the vector into the running hash. | |
addToCell (int i, double value) | |
addX (double value) | |
addY (double value) | |
bool | almostEqual (const LVecBase2d other) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. | |
bool | almostEqual (const LVecBase2d other, double threshold) |
Returns true if two vectors are memberwise equal within a specified tolerance. | |
int | compareTo (const LVecBase2d other) |
This flavor of compare_to uses a default threshold value based on the numeric type. | |
int | compareTo (const LVecBase2d other, double threshold) |
Sorts vectors lexicographically, componentwise. | |
componentwiseMult (const LVecBase2d other) | |
double | dot (const LVecBase2d other) |
fill (double fill_value) | |
Sets each element of the vector to the indicated fill_value. | |
LVecBase2d | fmax (const LVecBase2d other) |
LVecBase2d | fmin (const LVecBase2d other) |
generateHash (ChecksumHashGenerator hashgen) | |
Adds the vector to the indicated hash generator. | |
generateHash (ChecksumHashGenerator hashgen, double threshold) | |
Adds the vector to the indicated hash generator. | |
double | getCell (int i) |
getData () | |
Returns the address of the first of the two data elements in the vector. | |
int | getHash () |
Returns a suitable hash for phash_map. | |
int | getHash (double threshold) |
Returns a suitable hash for phash_map. | |
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. | |
LVecBase2d | normalized () |
Normalizes the vector and returns the normalized vector as a copy. | |
operator new (int size) | |
bool | operator!= (const LVecBase2d other) |
LVecBase2d | operator* (double scalar) |
LVecBase2d | operator*= (double scalar) |
LVecBase2d | operator+ (const LVecBase2d other) |
LVecBase2d | operator+= (const LVecBase2d other) |
LVecBase2d | operator- () |
LVecBase2d | operator- (const LVecBase2d other) |
LVecBase2d | operator-= (const LVecBase2d other) |
LVecBase2d | operator/ (double scalar) |
LVecBase2d | operator/= (double scalar) |
bool | operator< (const LVecBase2d other) |
LVecBase2d | operator= (const LVecBase2d copy) |
LVecBase2d | operator= (double fill_value) |
bool | operator== (const LVecBase2d other) |
double | operator[] (int i) |
operator[] (int i, double assign_val) | |
output (Ostream out) | |
LVecBase2d | project (const LVecBase2d onto) |
Returns a new vector representing the projection of this vector onto another one. | |
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(). | |
set (double x, double y) | |
setCell (int i, double value) | |
setX (double value) | |
setY (double value) | |
writeDatagram (Datagram destination) | |
Writes the vector to the Datagram using add_stdfloat(). | |
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(). | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static int | getNumComponents () |
static int | size () |
static const LVecBase2d | unitX () |
Returns a unit X vector. | |
static const LVecBase2d | unitY () |
Returns a unit Y vector. | |
static const LVecBase2d | zero () |
Returns a zero-length vector. | |
Public Attributes | |
double | x |
double | y |
This is the base class for all two-component vectors and points.
object __ceil__ | ( | ) |
object __floor__ | ( | ) |
object __floordiv__ | ( | double | scalar | ) |
object __getattr__ | ( | str | attr_name | ) |
object __ifloordiv__ | ( | double | scalar | ) |
__init__ | ( | ) |
__init__ | ( | const LVecBase2d | ) |
__init__ | ( | double | fill_value | ) |
__init__ | ( | double | x, |
double | y ) |
object __ipow__ | ( | double | exponent | ) |
object __pow__ | ( | double | exponent | ) |
object __reduce__ | ( | ) |
str __repr__ | ( | ) |
object __round__ | ( | ) |
int __setattr__ | ( | str | attr_name, |
object | assign ) |
int addHash | ( | int | hash | ) |
Adds the vector into the running hash.
int addHash | ( | int | hash, |
double | threshold ) |
Adds the vector into the running hash.
addToCell | ( | int | i, |
double | value ) |
addX | ( | double | value | ) |
addY | ( | double | value | ) |
bool almostEqual | ( | const LVecBase2d | other | ) |
Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | const LVecBase2d | other, |
double | threshold ) |
Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo | ( | const LVecBase2d | other | ) |
This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo | ( | const LVecBase2d | other, |
double | 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 LVecBase2d | other | ) |
double dot | ( | const LVecBase2d | other | ) |
fill | ( | double | fill_value | ) |
Sets each element of the vector to the indicated fill_value.
This is particularly useful for initializing to zero.
LVecBase2d fmax | ( | const LVecBase2d | other | ) |
LVecBase2d fmin | ( | const LVecBase2d | other | ) |
generateHash | ( | ChecksumHashGenerator | hashgen | ) |
Adds the vector to the indicated hash generator.
generateHash | ( | ChecksumHashGenerator | hashgen, |
double | threshold ) |
Adds the vector to the indicated hash generator.
double getCell | ( | int | i | ) |
|
static |
getData | ( | ) |
Returns the address of the first of the two data elements in the vector.
The next element occupies the next position consecutively in memory.
int getHash | ( | ) |
Returns a suitable hash for phash_map.
int getHash | ( | double | threshold | ) |
Returns a suitable hash for phash_map.
|
static |
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.
Returns true if the vector was normalized, false if it was a zero-length vector.
LVecBase2d 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 LVecBase2d | other | ) |
LVecBase2d operator* | ( | double | scalar | ) |
LVecBase2d operator*= | ( | double | scalar | ) |
LVecBase2d operator+ | ( | const LVecBase2d | other | ) |
LVecBase2d operator+= | ( | const LVecBase2d | other | ) |
LVecBase2d operator- | ( | ) |
LVecBase2d operator- | ( | const LVecBase2d | other | ) |
LVecBase2d operator-= | ( | const LVecBase2d | other | ) |
LVecBase2d operator/ | ( | double | scalar | ) |
LVecBase2d operator/= | ( | double | scalar | ) |
bool operator< | ( | const LVecBase2d | other | ) |
LVecBase2d operator= | ( | const LVecBase2d | copy | ) |
LVecBase2d operator= | ( | double | fill_value | ) |
bool operator== | ( | const LVecBase2d | other | ) |
double operator[] | ( | int | i | ) |
operator[] | ( | int | i, |
double | assign_val ) |
output | ( | Ostream | out | ) |
LVecBase2d project | ( | const LVecBase2d | 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 | ( | double | x, |
double | y ) |
setCell | ( | int | i, |
double | value ) |
setX | ( | double | value | ) |
setY | ( | double | value | ) |
|
static |
|
static |
Returns a unit X vector.
|
static |
Returns a unit Y 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.
double x |
double y |