Panda3D
Public Member Functions | Static Public Member Functions

VBase4 Class Reference

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

Inheritance diagram for VBase4:
Plane Point4 Quat Vec4 LOrientationf LRotationf

List of all members.

Public Member Functions

 VBase4 ()
 VBase4 (VBase4 const copy)
 VBase4 (float x, float y, float z, float w)
 VBase4 (float fill_value)
unsigned int addHash (unsigned int hash)
 Adds the vector into the running hash.
unsigned int addHash (unsigned int hash, float threshold)
 Adds the vector into the running hash.
 addToCell (int i, float value)
 addW (float value)
 addX (float value)
 addY (float value)
 addZ (float value)
bool almostEqual (VBase4 const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (VBase4 const other, float threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo (VBase4 const other, float threshold)
 Sorts vectors lexicographically, componentwise.
int compareTo (VBase4 const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
float dot (VBase4 const other)
 fill (float fill_value)
 Sets each element of the vector to the indicated fill_value.
VBase4 fmax (VBase4 const other)
VBase4 fmin (VBase4 const other)
PyObject getattr (string attr_name)
 This is used to implement swizzle masks.
float getCell (int i)
 getData ()
 Returns the address of the first of the four data elements in the vector.
unsigned int getHash (float 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, four.
float getW ()
float getX ()
float getY ()
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.
 operator new (unsigned int size)
bool operator!= (VBase4 const other)
VBase4 operator* (float scalar)
VBase4 operator*= (float scalar)
VBase4 operator+ (VBase4 const other)
VBase4 operator+= (VBase4 const other)
VBase4 operator- ()
VBase4 operator- (VBase4 const other)
VBase4 operator-= (VBase4 const other)
VBase4 operator/ (float scalar)
VBase4 operator/= (float scalar)
bool operator< (VBase4 const other)
 This performs a lexicographical comparison.
VBase4 operator= (float fill_value)
VBase4 operator= (VBase4 const copy)
bool operator== (VBase4 const other)
float operator[] (int i)
 operator[] (int i)
 output (ostream out)
VBase4 project (VBase4 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 (float x, float y, float z, float w)
int setattr (PyObject self, string attr_name, PyObject assign)
 This is used to implement write masks.
 setCell (int i, float value)
 setitem (int i, float v)
 setW (float value)
 setX (float value)
 setY (float value)
 setZ (float value)

Static Public Member Functions

static TypeHandle getClassType ()
static int size ()
 Returns 4: the number of components of a LVecBase4.
static VBase4 const unitW ()
 Returns a unit W vector.
static VBase4 const unitX ()
 Returns a unit X vector.
static VBase4 const unitY ()
 Returns a unit Y vector.
static VBase4 const unitZ ()
 Returns a unit Z vector.
static VBase4 const zero ()
 Returns a zero-length vector.

Detailed Description

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


Constructor & Destructor Documentation

VBase4 ( )
VBase4 ( VBase4 const  copy)
VBase4 ( float  fill_value)
VBase4 ( float  x,
float  y,
float  z,
float  w 
)

Member Function Documentation

unsigned int addHash ( unsigned int  hash)

Adds the vector into the running hash.

unsigned int addHash ( unsigned int  hash,
float  threshold 
)

Adds the vector into the running hash.

addToCell ( int  i,
float  value 
)
addW ( float  value)
addX ( float  value)
addY ( float  value)
addZ ( float  value)
bool almostEqual ( VBase4 const  other)

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

bool almostEqual ( VBase4 const  other,
float  threshold 
)

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

int compareTo ( VBase4 const  other)

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

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

float dot ( VBase4 const  other)
fill ( float  fill_value)

Sets each element of the vector to the indicated fill_value.

This is particularly useful for initializing to zero.

VBase4 fmax ( VBase4 const  other)
VBase4 fmin ( VBase4 const  other)
PyObject getattr ( string  attr_name)

This is used to implement swizzle masks.

Reimplemented in Vec4, and Point4.

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

Reimplemented in Vec4, Point4, Quat, LRotationf, and LOrientationf.

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 ( float  threshold)

Returns a suitable hash for phash_map.

int getNumComponents ( )

Returns the number of elements in the vector, four.

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

Reimplemented in Quat.

operator new ( unsigned int  size)
bool operator!= ( VBase4 const  other)
VBase4 operator* ( float  scalar)

Reimplemented in Vec4, Point4, Quat, and LRotationf.

VBase4 operator*= ( float  scalar)
VBase4 operator+ ( VBase4 const  other)

Reimplemented in Vec4, and Point4.

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

Reimplemented in Plane, Vec4, Point4, and Quat.

VBase4 operator- ( VBase4 const  other)

Reimplemented in Vec4, and Point4.

VBase4 operator-= ( VBase4 const  other)
VBase4 operator/ ( float  scalar)

Reimplemented in Vec4, Point4, Quat, and LRotationf.

VBase4 operator/= ( float  scalar)
bool operator< ( VBase4 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().

VBase4 operator= ( float  fill_value)

Reimplemented in Vec4, and Point4.

VBase4 operator= ( VBase4 const  copy)

Reimplemented in Vec4, and Point4.

bool operator== ( VBase4 const  other)
float operator[] ( int  i)
operator[] ( int  i)
output ( ostream  out)

Reimplemented in Plane, and Quat.

VBase4 project ( VBase4 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 Vec4, and Point4.

pythonRepr ( ostream  out,
string  class_name 
)

Reimplemented in Vec4, and Point4.

PyObject reduce ( PyObject  self)

This special Python method is implement to provide support for the pickle module.

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

This is used to implement write masks.

Reimplemented in Vec4, and Point4.

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

Returns 4: the number of components of a LVecBase4.

static VBase4 const unitW ( ) [static]

Returns a unit W vector.

Reimplemented in Vec4, and Point4.

static VBase4 const unitX ( ) [static]

Returns a unit X vector.

Reimplemented in Vec4, and Point4.

static VBase4 const unitY ( ) [static]

Returns a unit Y vector.

Reimplemented in Vec4, and Point4.

static VBase4 const unitZ ( ) [static]

Returns a unit Z vector.

Reimplemented in Vec4, and Point4.

static VBase4 const zero ( ) [static]

Returns a zero-length vector.

Reimplemented in Vec4, and Point4.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties