Panda3D
Public Member Functions | Static Public Member Functions | List of all members
LVector2f Class Reference

This is a two-component vector offset. More...

Inheritance diagram for LVector2f:
LVecBase2f

Public Member Functions

object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2f copy)
 Constructs a new LVector2 from a LVecBase2. More...
 
 __init__ (const LVector2f)
 
 __init__ (float fill_value)
 Constructs a new LVector2 with all components set to the fill value. More...
 
 __init__ (float x, float y)
 
str __repr__ ()
 
int __setattr__ (str attr_name, object assign)
 
LVector2f normalized ()
 Normalizes the vector and returns the normalized vector as a copy. More...
 
LVector2f operator * (float scalar)
 
LVector2f operator - ()
 
LVecBase2f operator - (const LVecBase2f other)
 
LVector2f operator - (const LVector2f other)
 
LVecBase2f operator+ (const LVecBase2f other)
 
LVector2f operator+ (const LVector2f other)
 
LVector2f operator/ (float scalar)
 
LVector2f project (const LVecBase2f onto)
 Returns a new vector representing the projection of this vector onto another one. More...
 
float signedAngleDeg (const LVector2f other)
 returns the signed angled between two vectors. More...
 
float signedAngleRad (const LVector2f other)
 returns the signed angled between two vectors. More...
 
- Public Member Functions inherited from LVecBase2f
object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2f)
 
 __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)
 
int addHash (int hash)
 Adds the vector into the running hash. More...
 
int addHash (int 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. 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. 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. More...
 
int getHash ()
 Returns a suitable hash for phash_map. More...
 
int getHash (float threshold)
 Returns a suitable hash for phash_map. 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. More...
 
LVecBase2f normalized ()
 Normalizes the vector and returns the normalized vector as a copy. More...
 
bool operator != (const LVecBase2f other)
 
LVecBase2f operator * (float scalar)
 
LVecBase2f operator *= (float scalar)
 
LVecBase2f operator - ()
 
LVecBase2f operator - (const LVecBase2f other)
 
LVecBase2f operator -= (const LVecBase2f other)
 
 operator [] (int i, float assign_val)
 
float operator [] (int i)
 
 operator new (int size)
 
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)
 
 output (Ostream out)
 
LVecBase2f project (const LVecBase2f onto)
 Returns a new vector representing the projection of this vector onto another one. 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(). 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(). 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(). More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
static const LVector2f unitX ()
 Returns a unit X vector. More...
 
static const LVector2f unitY ()
 Returns a unit Y vector. More...
 
static const LVector2f zero ()
 Returns a zero-length vector. More...
 
- Static Public Member Functions inherited from LVecBase2f
static TypeHandle getClassType ()
 
static int getNumComponents ()
 
static int size ()
 
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...
 

Additional Inherited Members

- Public Types inherited from LVecBase2f
enum  { num_components = 2, is_int = 0 }
 
- Public Attributes inherited from LVecBase2f
float x
 
float y
 

Detailed Description

This is a two-component vector offset.

Member Function Documentation

◆ __getattr__()

object __getattr__ ( str  attr_name)

◆ __init__() [1/5]

__init__ ( )

◆ __init__() [2/5]

__init__ ( const LVecBase2f  copy)

Constructs a new LVector2 from a LVecBase2.

◆ __init__() [3/5]

__init__ ( const  LVector2f)

◆ __init__() [4/5]

__init__ ( float  fill_value)

Constructs a new LVector2 with all components set to the fill value.

◆ __init__() [5/5]

__init__ ( float  x,
float  y 
)

◆ __repr__()

str __repr__ ( )

◆ __setattr__()

int __setattr__ ( str  attr_name,
object  assign 
)

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ normalized()

LVector2f normalized ( )

Normalizes the vector and returns the normalized vector as a copy.

If the vector was a zero-length vector, a zero length vector will be returned.

◆ operator *()

LVector2f operator * ( float  scalar)

◆ operator -() [1/3]

LVector2f operator - ( )

◆ operator -() [2/3]

LVecBase2f operator - ( const LVecBase2f  other)

◆ operator -() [3/3]

LVector2f operator - ( const LVector2f  other)

◆ operator+() [1/2]

LVecBase2f operator+ ( const LVecBase2f  other)

◆ operator+() [2/2]

LVector2f operator+ ( const LVector2f  other)

◆ operator/()

LVector2f operator/ ( float  scalar)

◆ project()

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

◆ signedAngleDeg()

float signedAngleDeg ( const LVector2f  other)

returns the signed angled between two vectors.

normalization is NOT necessary

◆ signedAngleRad()

float signedAngleRad ( const LVector2f  other)

returns the signed angled between two vectors.

normalization is NOT necessary

◆ unitX()

static const LVector2f unitX ( )
static

Returns a unit X vector.

◆ unitY()

static const LVector2f unitY ( )
static

Returns a unit Y vector.

◆ zero()

static const LVector2f zero ( )
static

Returns a zero-length vector.