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

Inheritance diagram for LVecBase2f:
LPoint2f LVector2f

List of all members.

Public Member Functions

 __init__ ()
 __init__ (LVecBase2f const copy)
 __init__ (float fill_value)
 __init__ (float x, float y)
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)
 addX (float value)
 addY (float value)
bool almostEqual (LVecBase2f const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (LVecBase2f const other, float threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo (LVecBase2f const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo (LVecBase2f const other, float threshold)
 Sorts vectors lexicographically, componentwise.
float dot (LVecBase2f const other)
 fill (float fill_value)
 Sets each element of the vector to the indicated fill_value.
LVecBase2f fmax (LVecBase2f const other)
LVecBase2f fmin (LVecBase2f const 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.
PyObject getattr (string attr_name)
float getCell (int i)
 getData ()
 Returns the address of the first of the two data elements in the vector.
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, two.
float getX ()
float getY ()
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!= (LVecBase2f const other)
LVecBase2f operator* (float scalar)
LVecBase2f operator*= (float scalar)
LVecBase2f operator+ (LVecBase2f const other)
LVecBase2f operator+= (LVecBase2f const other)
LVecBase2f operator- ()
LVecBase2f operator- (LVecBase2f const other)
LVecBase2f operator-= (LVecBase2f const other)
LVecBase2f operator/ (float scalar)
LVecBase2f operator/= (float scalar)
bool operator< (LVecBase2f const other)
 This performs a lexicographical comparison.
LVecBase2f operator= (LVecBase2f const copy)
LVecBase2f operator= (float fill_value)
bool operator== (LVecBase2f const other)
 operator[] (int i)
float operator[] (int i)
 output (ostream out)
LVecBase2f project (LVecBase2f 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 (float x, float y)
int setattr (PyObject self, string attr_name, PyObject assign)
 setCell (int i, float value)
 setitem (int i, float v)
 setX (float value)
 setY (float 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 2: the number of components of a LVecBase2.
static LVecBase2f const unitX ()
 Returns a unit X vector.
static LVecBase2f const unitY ()
 Returns a unit Y vector.
static LVecBase2f const zero ()
 Returns a zero-length vector.

Detailed Description

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


Member Function Documentation

__init__ ( )

Reimplemented in LPoint2f, and LVector2f.

__init__ ( LVecBase2f const  copy)

Reimplemented in LPoint2f, and LVector2f.

__init__ ( float  fill_value)

Reimplemented in LPoint2f, and LVector2f.

__init__ ( float  x,
float  y 
)

Reimplemented in LPoint2f, and LVector2f.

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 
)
addX ( float  value)
addY ( float  value)
bool almostEqual ( LVecBase2f const  other)

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

bool almostEqual ( LVecBase2f const  other,
float  threshold 
)

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

int compareTo ( LVecBase2f const  other)

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

int compareTo ( LVecBase2f 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 ( LVecBase2f 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.

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

PyObject getattr ( string  attr_name)

Reimplemented in LPoint2f, and LVector2f.

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

Reimplemented in LPoint2f, and LVector2f.

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.

unsigned int getHash ( )

Returns a suitable hash for phash_map.

unsigned int getHash ( float  threshold)

Returns a suitable hash for phash_map.

Returns the number of elements in the vector, two.

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

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

Reimplemented in LPoint2f, and LVector2f.

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

Reimplemented in LPoint2f, and LVector2f.

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

Reimplemented in LPoint2f, and LVector2f.

LVecBase2f operator- ( LVecBase2f const  other)

Reimplemented in LPoint2f, and LVector2f.

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

Reimplemented in LPoint2f, and LVector2f.

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

LVecBase2f operator= ( LVecBase2f const  copy)

Reimplemented in LPoint2f, and LVector2f.

LVecBase2f operator= ( float  fill_value)

Reimplemented in LPoint2f, and LVector2f.

bool operator== ( LVecBase2f const  other)
operator[] ( int  i)
float operator[] ( int  i)
output ( ostream  out)
LVecBase2f project ( LVecBase2f 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 LPoint2f, and LVector2f.

pythonRepr ( ostream  out,
string  class_name 
)

Reimplemented in LPoint2f, and LVector2f.

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 ( float  x,
float  y 
)
int setattr ( PyObject  self,
string  attr_name,
PyObject  assign 
)

Reimplemented in LPoint2f, and LVector2f.

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

Returns 2: the number of components of a LVecBase2.

static LVecBase2f const unitX ( ) [static]

Returns a unit X vector.

Reimplemented in LPoint2f, and LVector2f.

static LVecBase2f const unitY ( ) [static]

Returns a unit Y vector.

Reimplemented in LPoint2f, and LVector2f.

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

Returns a zero-length vector.

Reimplemented in LPoint2f, and LVector2f.