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

This is a three-component vector distance (as opposed to a three-component point, which represents a particular point in space). More...

Inheritance diagram for LVector3f:
LVecBase3f

Public Member Functions

object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2f copy, float z)
 
 __init__ (const LVecBase3f copy)
 
 __init__ (const LVector3f)
 
 __init__ (float fill_value)
 
 __init__ (float x, float y, float z)
 
str __repr__ ()
 
int __setattr__ (str attr_name, object assign)
 
float angleDeg (const LVector3f other)
 Returns the angle between this vector and the other one, expressed in degrees. More...
 
float angleRad (const LVector3f other)
 Returns the unsigned angle between this vector and the other one, expressed in radians. More...
 
LVector3f cross (const LVecBase3f other)
 
LVector2f getXy ()
 Returns a 2-component vector that shares just the first two components of this vector. More...
 
LVector2f getXz ()
 Returns a 2-component vector that shares just the first and last components of this vector. More...
 
LVector2f getYz ()
 Returns a 2-component vector that shares just the last two components of this vector. More...
 
LVector3f normalized ()
 Normalizes the vector and returns the normalized vector as a copy. More...
 
LVector3f operator * (float scalar)
 
LVector3f operator - ()
 
LVecBase3f operator - (const LVecBase3f other)
 
LVector3f operator - (const LVector3f other)
 
LVecBase3f operator+ (const LVecBase3f other)
 
LVector3f operator+ (const LVector3f other)
 
LVector3f operator/ (float scalar)
 
LVector3f project (const LVecBase3f onto)
 Returns a new vector representing the projection of this vector onto another one. More...
 
float relativeAngleDeg (const LVector3f other)
 This method is deprecated. More...
 
float relativeAngleRad (const LVector3f other)
 This method is deprecated. More...
 
float signedAngleDeg (const LVector3f other, const LVector3f ref)
 Returns the signed angle between two vectors. More...
 
float signedAngleRad (const LVector3f other, const LVector3f ref)
 returns the signed angle between two vectors. More...
 
- Public Member Functions inherited from LVecBase3f
object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2f copy, float z)
 
 __init__ (const LVecBase3f)
 
 __init__ (float fill_value)
 
 __init__ (float x, float y, float z)
 
object __ipow__ (float exponent)
 
LVecBase3f __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)
 
 addZ (float value)
 
bool almostEqual (const LVecBase3f other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. More...
 
bool almostEqual (const LVecBase3f other, float threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance. More...
 
int compareTo (const LVecBase3f other)
 This flavor of compare_to uses a default threshold value based on the numeric type. More...
 
int compareTo (const LVecBase3f other, float threshold)
 Sorts vectors lexicographically, componentwise. More...
 
 componentwiseMult (const LVecBase3f other)
 
LVecBase3f cross (const LVecBase3f other)
 
 crossInto (const LVecBase3f other)
 
float dot (const LVecBase3f other)
 
 fill (float fill_value)
 Sets each element of the vector to the indicated fill_value. More...
 
LVecBase3f fmax (const LVecBase3f other)
 
LVecBase3f fmin (const LVecBase3f 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 three 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...
 
LVecBase3f getStandardizedHpr ()
 Try to un-spin the hpr to a standard form. More...
 
float getX ()
 
LVecBase2f getXy ()
 Returns a 2-component vector that shares just the first two components of this vector. More...
 
LVecBase2f getXz ()
 Returns a 2-component vector that shares just the first and last components of this vector. More...
 
float getY ()
 
LVecBase2f getYz ()
 Returns a 2-component vector that shares just the last two components of this vector. More...
 
float getZ ()
 
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...
 
LVecBase3f normalized ()
 Normalizes the vector and returns the normalized vector as a copy. More...
 
bool operator != (const LVecBase3f other)
 
LVecBase3f operator * (float scalar)
 
LVecBase3f operator *= (float scalar)
 
LVecBase3f operator - ()
 
LVecBase3f operator - (const LVecBase3f other)
 
LVecBase3f operator -= (const LVecBase3f other)
 
 operator [] (int i, float assign_val)
 
float operator [] (int i)
 
 operator new (int size)
 
LVecBase3f operator+ (const LVecBase3f other)
 
LVecBase3f operator+= (const LVecBase3f other)
 
LVecBase3f operator/ (float scalar)
 
LVecBase3f operator/= (float scalar)
 
bool operator< (const LVecBase3f other)
 
LVecBase3f operator= (const LVecBase3f copy)
 
LVecBase3f operator= (float fill_value)
 
bool operator== (const LVecBase3f other)
 
 output (Ostream out)
 
LVecBase3f project (const LVecBase3f 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, float z)
 
 setCell (int i, float value)
 
 setX (float value)
 
 setY (float value)
 
 setZ (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 LVector3f back (CoordinateSystem cs)
 Returns the back vector for the given coordinate system. More...
 
static LVector3f down (CoordinateSystem cs)
 Returns the down vector for the given coordinate system. More...
 
static LVector3f forward (CoordinateSystem cs)
 Returns the forward vector for the given coordinate system. More...
 
static TypeHandle getClassType ()
 
static LVector3f left (CoordinateSystem cs)
 Returns the left vector for the given coordinate system. More...
 
static LVector3f rfu (float right, float fwd, float up, CoordinateSystem cs)
 Returns a vector that is described by its right, forward, and up components, in whatever way the coordinate system represents that vector. More...
 
static LVector3f right (CoordinateSystem cs)
 Returns the right vector for the given coordinate system. More...
 
static const LVector3f unitX ()
 Returns a unit X vector. More...
 
static const LVector3f unitY ()
 Returns a unit Y vector. More...
 
static const LVector3f unitZ ()
 Returns a unit Z vector. More...
 
static LVector3f up (CoordinateSystem cs)
 Returns the up vector for the given coordinate system. More...
 
static const LVector3f zero ()
 Returns a zero-length vector. More...
 
- Static Public Member Functions inherited from LVecBase3f
static TypeHandle getClassType ()
 
static int getNumComponents ()
 
static int size ()
 
static const LVecBase3f unitX ()
 Returns a unit X vector. More...
 
static const LVecBase3f unitY ()
 Returns a unit Y vector. More...
 
static const LVecBase3f unitZ ()
 Returns a unit Z vector. More...
 
static const LVecBase3f zero ()
 Returns a zero-length vector. More...
 

Public Attributes

LVector2f xy
 Returns a 2-component vector that shares just the first two components of this vector. More...
 
LVector2f xz
 Returns a 2-component vector that shares just the first and last components of this vector. More...
 
LVector2f yz
 Returns a 2-component vector that shares just the last two components of this vector. More...
 
- Public Attributes inherited from LVecBase3f
float x
 
LVecBase2f xy
 Returns a 2-component vector that shares just the first two components of this vector. More...
 
LVecBase2f xz
 Returns a 2-component vector that shares just the first and last components of this vector. More...
 
float y
 
LVecBase2f yz
 Returns a 2-component vector that shares just the last two components of this vector. More...
 
float z
 

Additional Inherited Members

- Public Types inherited from LVecBase3f
enum  { num_components = 3, is_int = 0 }
 

Detailed Description

This is a three-component vector distance (as opposed to a three-component point, which represents a particular point in space).

Some of the methods are slightly different between LPoint3 and LVector3; in particular, subtraction of two points yields a vector, while addition of a vector and a point yields a point.

Member Function Documentation

◆ __getattr__()

object __getattr__ ( str  attr_name)

◆ __init__() [1/6]

__init__ ( )

◆ __init__() [2/6]

__init__ ( const LVecBase2f  copy,
float  z 
)

◆ __init__() [3/6]

__init__ ( const LVecBase3f  copy)

◆ __init__() [4/6]

__init__ ( const  LVector3f)

◆ __init__() [5/6]

__init__ ( float  fill_value)

◆ __init__() [6/6]

__init__ ( float  x,
float  y,
float  z 
)

◆ __repr__()

str __repr__ ( )

◆ __setattr__()

int __setattr__ ( str  attr_name,
object  assign 
)

◆ angleDeg()

float angleDeg ( const LVector3f  other)

Returns the angle between this vector and the other one, expressed in degrees.

Both vectors should be initially normalized.

◆ angleRad()

float angleRad ( const LVector3f  other)

Returns the unsigned angle between this vector and the other one, expressed in radians.

Both vectors should be initially normalized.

◆ back()

static LVector3f back ( CoordinateSystem  cs)
static

Returns the back vector for the given coordinate system.

◆ cross()

LVector3f cross ( const LVecBase3f  other)

◆ down()

static LVector3f down ( CoordinateSystem  cs)
static

Returns the down vector for the given coordinate system.

◆ forward()

static LVector3f forward ( CoordinateSystem  cs)
static

Returns the forward vector for the given coordinate system.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getXy()

LVector2f getXy ( )

Returns a 2-component vector that shares just the first two components of this vector.

◆ getXz()

LVector2f getXz ( )

Returns a 2-component vector that shares just the first and last components of this vector.

◆ getYz()

LVector2f getYz ( )

Returns a 2-component vector that shares just the last two components of this vector.

◆ left()

static LVector3f left ( CoordinateSystem  cs)
static

Returns the left vector for the given coordinate system.

◆ normalized()

LVector3f 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 *()

LVector3f operator * ( float  scalar)

◆ operator -() [1/3]

LVector3f operator - ( )

◆ operator -() [2/3]

LVecBase3f operator - ( const LVecBase3f  other)

◆ operator -() [3/3]

LVector3f operator - ( const LVector3f  other)

◆ operator+() [1/2]

LVecBase3f operator+ ( const LVecBase3f  other)

◆ operator+() [2/2]

LVector3f operator+ ( const LVector3f  other)

◆ operator/()

LVector3f operator/ ( float  scalar)

◆ project()

LVector3f project ( const LVecBase3f  onto)

Returns a new vector representing the projection of this vector onto another one.

The resulting vector will be a scalar multiple of onto.

◆ relativeAngleDeg()

float relativeAngleDeg ( const LVector3f  other)

This method is deprecated.

Do not use.

◆ relativeAngleRad()

float relativeAngleRad ( const LVector3f  other)

This method is deprecated.

Do not use.

◆ rfu()

static LVector3f rfu ( float  right,
float  fwd,
float  up,
CoordinateSystem  cs 
)
static

Returns a vector that is described by its right, forward, and up components, in whatever way the coordinate system represents that vector.

◆ right()

static LVector3f right ( CoordinateSystem  cs)
static

Returns the right vector for the given coordinate system.

◆ signedAngleDeg()

float signedAngleDeg ( const LVector3f  other,
const LVector3f  ref 
)

Returns the signed angle between two vectors.

The angle is positive if the rotation from this vector to other is clockwise when looking in the direction of the ref vector.

Vectors (except the ref vector) should be initially normalized.

◆ signedAngleRad()

float signedAngleRad ( const LVector3f  other,
const LVector3f  ref 
)

returns the signed angle between two vectors.

The angle is positive if the rotation from this vector to other is clockwise when looking in the direction of the ref vector.

Vectors (except the ref vector) should be initially normalized.

◆ unitX()

static const LVector3f unitX ( )
static

Returns a unit X vector.

◆ unitY()

static const LVector3f unitY ( )
static

Returns a unit Y vector.

◆ unitZ()

static const LVector3f unitZ ( )
static

Returns a unit Z vector.

◆ up()

static LVector3f up ( CoordinateSystem  cs)
static

Returns the up vector for the given coordinate system.

◆ zero()

static const LVector3f zero ( )
static

Returns a zero-length vector.

Member Data Documentation

◆ xy

Returns a 2-component vector that shares just the first two components of this vector.

◆ xz

Returns a 2-component vector that shares just the first and last components of this vector.

◆ yz

Returns a 2-component vector that shares just the last two components of this vector.