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

Inheritance diagram for LVecBase2f:
LPoint2f LVector2f

Public Types

enum  { num_components = 2, is_int = 0 }
 

Public Member Functions

object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2f copy)
 
 __init__ (float fill_value)
 
 __init__ (float x, float y)
 
object __ipow__ (float exponent)
 
LVecBase2f __pow__ (float exponent)
 
object __reduce__ ()
 
str __repr__ ()
 
int __setattr__ (str attr_name, object assign)
 
size_t addHash (size_t hash)
 Adds the vector into the running hash. More...
 
size_t addHash (size_t hash, float threshold)
 Adds the vector into the running hash. More...
 
 addToCell (int i, float value)
 
 addX (float value)
 
 addY (float value)
 
bool almostEqual (const LVecBase2f other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. More...
 
bool almostEqual (const LVecBase2f other, float threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance. More...
 
int compareTo (const LVecBase2f other)
 This flavor of compare_to uses a default threshold value based on the numeric type. More...
 
int compareTo (const LVecBase2f 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). More...
 
 componentwiseMult (const LVecBase2f other)
 
float dot (const LVecBase2f other)
 
 fill (float fill_value)
 Sets each element of the vector to the indicated fill_value. This is particularly useful for initializing to zero. More...
 
LVecBase2f fmax (const LVecBase2f other)
 
LVecBase2f fmin (const LVecBase2f other)
 
 generateHash (ChecksumHashGenerator hashgen)
 Adds the vector to the indicated hash generator. More...
 
 generateHash (ChecksumHashGenerator hashgen, float threshold)
 Adds the vector to the indicated hash generator. More...
 
float getCell (int i)
 
 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. More...
 
size_t getHash ()
 Returns a suitable hash for phash_map. More...
 
size_t getHash (float threshold)
 Returns a suitable hash for phash_map. More...
 
int getNumComponents ()
 Returns the number of elements in the vector, two. More...
 
float getX ()
 
float getY ()
 
bool isNan ()
 Returns true if any component of the vector is not-a-number, false otherwise. More...
 
float length ()
 Returns the length of the vector, by the Pythagorean theorem. More...
 
float lengthSquared ()
 Returns the square of the vector's length, cheap and easy. More...
 
bool normalize ()
 Normalizes the vector in place. Returns true if the vector was normalized, false if it was a zero-length vector. More...
 
 operator new (size_t size)
 
bool operator!= (const LVecBase2f other)
 
LVecBase2f operator* (float scalar)
 
LVecBase2f operator*= (float scalar)
 
LVecBase2f operator+ (const LVecBase2f other)
 
LVecBase2f operator+= (const LVecBase2f other)
 
LVecBase2f operator- ()
 
LVecBase2f operator- (const LVecBase2f other)
 
LVecBase2f operator-= (const LVecBase2f other)
 
LVecBase2f operator/ (float scalar)
 
LVecBase2f operator/= (float scalar)
 
bool operator< (const LVecBase2f other)
 
LVecBase2f operator= (const LVecBase2f copy)
 
LVecBase2f operator= (float fill_value)
 
bool operator== (const LVecBase2f other)
 
 operator[] (int i, float assign_val)
 
float operator[] (int i)
 
 output (Ostream out)
 
LVecBase2f project (const LVecBase2f onto)
 Returns a new vector representing the projection of this vector onto another one. The resulting vector will be a scalar multiple of onto. More...
 
 readDatagram (DatagramIterator source)
 Reads the vector from the Datagram using get_stdfloat(). More...
 
 readDatagramFixed (DatagramIterator source)
 Reads the vector from the Datagram using get_float32() or get_float64(). See write_datagram_fixed(). More...
 
 set (float x, float y)
 
 setCell (int i, float value)
 
 setX (float value)
 
 setY (float value)
 
 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. More...
 
 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. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
static int size ()
 Returns 2: the number of components of a LVecBase2. More...
 
static const LVecBase2f unitX ()
 Returns a unit X vector. More...
 
static const LVecBase2f unitY ()
 Returns a unit Y vector. More...
 
static const LVecBase2f zero ()
 Returns a zero-length vector. More...
 

Detailed Description

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

Member Enumeration Documentation

anonymous enum
Enumerator
num_components 
is_int 

Member Function Documentation

object __getattr__ ( str  attr_name)
__init__ ( )
__init__ ( const LVecBase2f  copy)
__init__ ( float  fill_value)
__init__ ( float  x,
float  y 
)
object __ipow__ ( float  exponent)
LVecBase2f __pow__ ( float  exponent)
object __reduce__ ( )
str __repr__ ( )
int __setattr__ ( str  attr_name,
object  assign 
)
size_t addHash ( size_t  hash)

Adds the vector into the running hash.

size_t addHash ( size_t  hash,
float  threshold 
)

Adds the vector into the running hash.

addToCell ( int  i,
float  value 
)
addX ( float  value)
addY ( float  value)
bool almostEqual ( const LVecBase2f  other)

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

bool almostEqual ( const LVecBase2f  other,
float  threshold 
)

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

int compareTo ( const LVecBase2f  other)

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

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

componentwiseMult ( const LVecBase2f  other)
float dot ( const LVecBase2f  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 ( const LVecBase2f  other)
LVecBase2f fmin ( const LVecBase2f  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.

float getCell ( int  i)
static TypeHandle getClassType ( )
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.

size_t getHash ( )

Returns a suitable hash for phash_map.

size_t 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. Returns true if the vector was normalized, false if it was a zero-length vector.

operator new ( size_t  size)
bool operator!= ( const LVecBase2f  other)
LVecBase2f operator* ( float  scalar)
LVecBase2f operator*= ( float  scalar)
LVecBase2f operator+ ( const LVecBase2f  other)
LVecBase2f operator+= ( const LVecBase2f  other)
LVecBase2f operator- ( )
LVecBase2f operator- ( const LVecBase2f  other)
LVecBase2f operator-= ( const LVecBase2f  other)
LVecBase2f operator/ ( float  scalar)
LVecBase2f operator/= ( float  scalar)
bool operator< ( const LVecBase2f  other)
LVecBase2f operator= ( const LVecBase2f  copy)
LVecBase2f operator= ( float  fill_value)
bool operator== ( const LVecBase2f  other)
operator[] ( int  i,
float  assign_val 
)
float operator[] ( int  i)
output ( Ostream  out)
LVecBase2f project ( const LVecBase2f  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 ( float  x,
float  y 
)
setCell ( int  i,
float  value 
)
setX ( float  value)
setY ( float  value)
static int size ( )
static

Returns 2: the number of components of a LVecBase2.

static const LVecBase2f unitX ( )
static

Returns a unit X vector.

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

Returns a zero-length vector.