Panda3D
Public Member Functions | Static Public Member Functions

Vec4D Class Reference

This is a four-component vector distance. More...

Inheritance diagram for Vec4D:
VBase4D

List of all members.

Public Member Functions

 Vec4D ()
 Vec4D (VBase4D const copy)
 Vec4D (double x, double y, double z, double w)
 Vec4D (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)
 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, double threshold)
 Sorts vectors lexicographically, componentwise.
int compareTo (VBase4D const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
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)
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 four 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, 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)
Vec4D operator* (double scalar)
VBase4D operator*= (double scalar)
Vec4D operator+ (Vec4D const other)
VBase4D operator+ (VBase4D const other)
VBase4D operator+= (VBase4D const other)
Vec4D operator- ()
VBase4D operator- (VBase4D const other)
Vec4D operator- (Vec4D const other)
VBase4D operator-= (VBase4D const other)
Vec4D operator/ (double scalar)
VBase4D operator/= (double scalar)
bool operator< (VBase4D const other)
 This performs a lexicographical comparison.
Vec4D operator= (VBase4D const copy)
Vec4D operator= (double fill_value)
bool operator== (VBase4D const other)
double operator[] (int i)
 operator[] (int i)
 output (ostream out)
Vec4D project (VBase4D 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 (double x, double y, double z, double w)
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)
 setW (double value)
 setX (double value)
 setY (double value)
 setZ (double value)

Static Public Member Functions

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

Detailed Description

This is a four-component vector distance.


Constructor & Destructor Documentation

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

Member Function Documentation

unsigned int addHash ( unsigned int  hash) [inherited]

Adds the vector into the running hash.

unsigned int addHash ( unsigned int  hash,
double  threshold 
) [inherited]

Adds the vector into the running hash.

addToCell ( int  i,
double  value 
) [inherited]
addW ( double  value) [inherited]
addX ( double  value) [inherited]
addY ( double  value) [inherited]
addZ ( double  value) [inherited]
bool almostEqual ( VBase4D const  other) [inherited]

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

bool almostEqual ( VBase4D const  other,
double  threshold 
) [inherited]

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

int compareTo ( VBase4D const  other,
double  threshold 
) [inherited]

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

int compareTo ( VBase4D const  other) [inherited]

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

double dot ( VBase4D const  other) [inherited]
fill ( double  fill_value) [inherited]

Sets each element of the vector to the indicated fill_value.

This is particularly useful for initializing to zero.

VBase4D fmax ( VBase4D const  other) [inherited]
VBase4D fmin ( VBase4D const  other) [inherited]
PyObject getattr ( string  attr_name)

This is used to implement swizzle masks.

Reimplemented from VBase4D.

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

Reimplemented from VBase4D.

getData ( ) [inherited]

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 ( ) [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, four.

double getW ( ) [inherited]
double getX ( ) [inherited]
double getY ( ) [inherited]
double getZ ( ) [inherited]
bool isNan ( ) [inherited]

Returns true if any component of the vector is not-a-number, false otherwise.

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.

Reimplemented in QuatD.

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

Reimplemented from VBase4D.

VBase4D operator*= ( double  scalar) [inherited]
VBase4D operator+ ( VBase4D const  other)

Reimplemented from VBase4D.

Vec4D operator+ ( Vec4D const  other)
VBase4D operator+= ( VBase4D const  other) [inherited]
Vec4D operator- ( Vec4D const  other)
Vec4D operator- ( )

Reimplemented from VBase4D.

VBase4D operator- ( VBase4D const  other)

Reimplemented from VBase4D.

VBase4D operator-= ( VBase4D const  other) [inherited]
Vec4D operator/ ( double  scalar)

Reimplemented from VBase4D.

VBase4D operator/= ( double  scalar) [inherited]
bool operator< ( VBase4D 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().

Vec4D operator= ( double  fill_value)

Reimplemented from VBase4D.

Vec4D operator= ( VBase4D const  copy)

Reimplemented from VBase4D.

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

Reimplemented in PlaneD, and QuatD.

Vec4D 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 from VBase4D.

pythonRepr ( ostream  out,
string  class_name 
)

Reimplemented from VBase4D.

PyObject reduce ( PyObject  self) [inherited]

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

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

This is used to implement write masks.

Reimplemented from VBase4D.

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

Returns 4: the number of components of a LVecBase4.

static Vec4D const unitW ( ) [static]

Returns a unit W vector.

Reimplemented from VBase4D.

static Vec4D const unitX ( ) [static]

Returns a unit X vector.

Reimplemented from VBase4D.

static Vec4D const unitY ( ) [static]

Returns a unit Y vector.

Reimplemented from VBase4D.

static Vec4D const unitZ ( ) [static]

Returns a unit Z vector.

Reimplemented from VBase4D.

static Vec4D const zero ( ) [static]

Returns a zero-length vector.

Reimplemented from VBase4D.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties