Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions
VBase4D Class Reference

This is the base class for all three-component vectors and points. More...

Inheritance diagram for VBase4D:
LPlaned Point4D QuatD Vec4D LOrientationd LRotationd

List of all members.

Public Member Functions

 VBase4D ()
 VBase4D (VBase4D const copy)
 VBase4D (UnalignedLVecBase4d const copy)
 VBase4D (double fill_value)
 VBase4D (double x, double y, double z, double w)
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)
 addW (double value)
 addX (double value)
 addY (double value)
 addZ (double value)
bool almostEqual (VBase4D const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (VBase4D const other, double threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo (VBase4D const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo (VBase4D const other, double threshold)
 Sorts vectors lexicographically, componentwise.
double dot (VBase4D const other)
 fill (double fill_value)
 Sets each element of the vector to the indicated fill_value.
VBase4D fmax (VBase4D const other)
VBase4D fmin (VBase4D const 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.
PyObject getattr (string attr_name)
double getCell (int i)
 getData ()
 Returns the address of the first of the four data elements in the vector.
unsigned int getHash ()
 Returns a suitable hash for phash_map.
unsigned int getHash (double threshold)
 Returns a suitable hash for phash_map.
int getNumComponents ()
 Returns the number of elements in the vector, four.
double getW ()
double getX ()
double getY ()
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!= (VBase4D const other)
VBase4D operator* (double scalar)
VBase4D operator*= (double scalar)
VBase4D operator+ (VBase4D const other)
VBase4D operator+= (VBase4D const other)
VBase4D operator- ()
VBase4D operator- (VBase4D const other)
VBase4D operator-= (VBase4D const other)
VBase4D operator/ (double scalar)
VBase4D operator/= (double scalar)
bool operator< (VBase4D const other)
 This performs a lexicographical comparison.
VBase4D operator= (VBase4D const copy)
VBase4D operator= (UnalignedLVecBase4d const copy)
VBase4D operator= (double fill_value)
bool operator== (VBase4D const other)
 operator[] (int i)
double operator[] (int i)
 output (ostream out)
VBase4D project (VBase4D const onto)
 Returns a new vector representing the projection of this vector onto another one.
 pythonRepr (ostream out, string class_name)
 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().
PyObject reduce (PyObject self)
 set (double x, double y, double z, double w)
int setattr (PyObject self, string attr_name, PyObject assign)
 setCell (int i, double value)
 setitem (int i, double v)
 setW (double value)
 setX (double value)
 setY (double value)
 setZ (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 size ()
 Returns 4: the number of components of a LVecBase4.
static VBase4D const unitW ()
 Returns a unit W vector.
static VBase4D const unitX ()
 Returns a unit X vector.
static VBase4D const unitY ()
 Returns a unit Y vector.
static VBase4D const unitZ ()
 Returns a unit Z vector.
static VBase4D const zero ()
 Returns a zero-length vector.

Detailed Description

This is the base class for all three-component vectors and points.


Constructor & Destructor Documentation

VBase4D ( )
VBase4D ( VBase4D const  copy)
VBase4D ( UnalignedLVecBase4d const  copy)
VBase4D ( double  fill_value)
VBase4D ( double  x,
double  y,
double  z,
double  w 
)

Member Function Documentation

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 
)
addW ( double  value)
addX ( double  value)
addY ( double  value)
addZ ( double  value)
bool almostEqual ( VBase4D const  other)

Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.

bool almostEqual ( VBase4D const  other,
double  threshold 
)

Returns true if two vectors are memberwise equal within a specified tolerance.

int compareTo ( VBase4D const  other)

This flavor of compare_to uses a default threshold value based on the numeric type.

int compareTo ( VBase4D const  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).

double dot ( VBase4D const  other)
fill ( double  fill_value)

Sets each element of the vector to the indicated fill_value.

This is particularly useful for initializing to zero.

VBase4D fmax ( VBase4D const  other)
VBase4D fmin ( VBase4D const  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.

PyObject getattr ( string  attr_name)

Reimplemented in Point4D, and Vec4D.

double getCell ( int  i)
static TypeHandle getClassType ( ) [static]

Reimplemented in LOrientationd, LRotationd, QuatD, Point4D, and Vec4D.

getData ( )

Returns the address of the first of the four data elements in the vector.

The remaining elements occupy the next positions consecutively in memory.

unsigned int getHash ( )

Returns a suitable hash for phash_map.

unsigned int getHash ( double  threshold)

Returns a suitable hash for phash_map.

Returns the number of elements in the vector, four.

double getW ( )
double getX ( )
double getY ( )
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.

Returns true if the vector was normalized, false if it was a zero-length vector.

Reimplemented in QuatD.

operator new ( unsigned int  size)
bool operator!= ( VBase4D const  other)
VBase4D operator* ( double  scalar)

Reimplemented in LRotationd, QuatD, Point4D, and Vec4D.

VBase4D operator*= ( double  scalar)
VBase4D operator+ ( VBase4D const  other)

Reimplemented in Point4D, and Vec4D.

VBase4D operator+= ( VBase4D const  other)
VBase4D operator- ( )

Reimplemented in LPlaned, QuatD, Point4D, and Vec4D.

VBase4D operator- ( VBase4D const  other)

Reimplemented in Point4D, and Vec4D.

VBase4D operator-= ( VBase4D const  other)
VBase4D operator/ ( double  scalar)

Reimplemented in LRotationd, QuatD, Point4D, and Vec4D.

VBase4D operator/= ( double  scalar)
bool operator< ( VBase4D const  other)

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().

VBase4D operator= ( VBase4D const  copy)

Reimplemented in Point4D, and Vec4D.

VBase4D operator= ( UnalignedLVecBase4d const  copy)
VBase4D operator= ( double  fill_value)

Reimplemented in Point4D, and Vec4D.

bool operator== ( VBase4D const  other)
operator[] ( int  i)
double operator[] ( int  i)
output ( ostream  out)

Reimplemented in LPlaned, and QuatD.

VBase4D project ( VBase4D const  onto)

Returns a new vector representing the projection of this vector onto another one.

The resulting vector will be a scalar multiple of onto.

Reimplemented in Point4D, and Vec4D.

pythonRepr ( ostream  out,
string  class_name 
)

Reimplemented in Point4D, and Vec4D.

Reads the vector from the Datagram using get_stdfloat().

Reads the vector from the Datagram using get_float32() or get_float64().

See write_datagram_fixed().

PyObject reduce ( PyObject  self)
set ( double  x,
double  y,
double  z,
double  w 
)
int setattr ( PyObject  self,
string  attr_name,
PyObject  assign 
)

Reimplemented in Point4D, and Vec4D.

setCell ( int  i,
double  value 
)
setitem ( int  i,
double  v 
)
setW ( double  value)
setX ( double  value)
setY ( double  value)
setZ ( double  value)
static int size ( ) [static]

Returns 4: the number of components of a LVecBase4.

static VBase4D const unitW ( ) [static]

Returns a unit W vector.

Reimplemented in Point4D, and Vec4D.

static VBase4D const unitX ( ) [static]

Returns a unit X vector.

Reimplemented in Point4D, and Vec4D.

static VBase4D const unitY ( ) [static]

Returns a unit Y vector.

Reimplemented in Point4D, and Vec4D.

static VBase4D const unitZ ( ) [static]

Returns a unit Z vector.

Reimplemented in Point4D, and Vec4D.

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 VBase4D const zero ( ) [static]

Returns a zero-length vector.

Reimplemented in Point4D, and Vec4D.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties