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

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

Inheritance diagram for LVector3d:
LVecBase3d

Public Member Functions

object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2d copy, double z)
 
 __init__ (const LVecBase3d copy)
 
 __init__ (double fill_value)
 
 __init__ (double x, double y, double z)
 
str __repr__ ()
 
int __setattr__ (str attr_name, object assign)
 
double angleDeg (const LVector3d other)
 Returns the angle between this vector and the other one, expressed in degrees. Both vectors should be initially normalized. More...
 
double angleRad (const LVector3d other)
 Returns the unsigned angle between this vector and the other one, expressed in radians. Both vectors should be initially normalized. More...
 
LVector3d cross (const LVecBase3d other)
 
LVector2d getXy ()
 Returns a 2-component vector that shares just the first two components of this vector. More...
 
LVector2d getXz ()
 Returns a 2-component vector that shares just the first and last components of this vector. More...
 
LVector2d getYz ()
 Returns a 2-component vector that shares just the last two components of this vector. More...
 
LVector3d 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. More...
 
LVector3d operator* (double scalar)
 
LVecBase3d operator+ (const LVecBase3d other)
 
LVector3d operator+ (const LVector3d other)
 
LVector3d operator- ()
 
LVecBase3d operator- (const LVecBase3d other)
 
LVector3d operator- (const LVector3d other)
 
LVector3d operator/ (double scalar)
 
LVector3d operator= (const LVecBase3d copy)
 
LVector3d operator= (double fill_value)
 
LVector3d project (const LVecBase3d 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...
 
double relativeAngleDeg (const LVector3d other)
 This method is deprecated. Do not use. More...
 
double relativeAngleRad (const LVector3d other)
 This method is deprecated. Do not use. More...
 
double signedAngleDeg (const LVector3d other, const LVector3d 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. More...
 
double signedAngleRad (const LVector3d other, const LVector3d 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. More...
 
- Public Member Functions inherited from LVecBase3d
object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LVecBase2d copy, double z)
 
 __init__ (const LVecBase3d copy)
 
 __init__ (double fill_value)
 
 __init__ (double x, double y, double z)
 
object __ipow__ (double exponent)
 
LVecBase3d __pow__ (double 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, double threshold)
 Adds the vector into the running hash. More...
 
 addToCell (int i, double value)
 
 addX (double value)
 
 addY (double value)
 
 addZ (double value)
 
bool almostEqual (const LVecBase3d other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. More...
 
bool almostEqual (const LVecBase3d other, double threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance. More...
 
int compareTo (const LVecBase3d other)
 This flavor of compare_to uses a default threshold value based on the numeric type. More...
 
int compareTo (const LVecBase3d other, double 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 LVecBase3d other)
 
LVecBase3d cross (const LVecBase3d other)
 
 crossInto (const LVecBase3d other)
 
double dot (const LVecBase3d other)
 
 fill (double fill_value)
 Sets each element of the vector to the indicated fill_value. This is particularly useful for initializing to zero. More...
 
LVecBase3d fmax (const LVecBase3d other)
 
LVecBase3d fmin (const LVecBase3d other)
 
 generateHash (ChecksumHashGenerator hashgen)
 Adds the vector to the indicated hash generator. More...
 
 generateHash (ChecksumHashGenerator hashgen, double threshold)
 Adds the vector to the indicated hash generator. More...
 
double getCell (int i)
 
 getData ()
 Returns the address of the first of the three data elements in the vector. The remaining elements occupy the next positions consecutively in memory. More...
 
size_t getHash ()
 Returns a suitable hash for phash_map. More...
 
size_t getHash (double threshold)
 Returns a suitable hash for phash_map. More...
 
int getNumComponents ()
 Returns the number of elements in the vector, three. More...
 
LVecBase3d getStandardizedHpr ()
 Try to un-spin the hpr to a standard form. Like all standards, someone decides between many arbitrary possible standards. This function assumes that 0 and 360 are the same, as is 720 and -360. Also 180 and -180 are the same. Another example is -90 and 270. Each element will be in the range -180.0 to 179.99999. The original usage of this function is for human readable output. More...
 
double getX ()
 
LVecBase2d getXy ()
 Returns a 2-component vector that shares just the first two components of this vector. More...
 
LVecBase2d getXz ()
 Returns a 2-component vector that shares just the first and last components of this vector. More...
 
double getY ()
 
LVecBase2d getYz ()
 Returns a 2-component vector that shares just the last two components of this vector. More...
 
double getZ ()
 
bool isNan ()
 Returns true if any component of the vector is not-a-number, false otherwise. More...
 
double length ()
 Returns the length of the vector, by the Pythagorean theorem. More...
 
double 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...
 
LVecBase3d 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. More...
 
 operator new (size_t size)
 
bool operator!= (const LVecBase3d other)
 
LVecBase3d operator* (double scalar)
 
LVecBase3d operator*= (double scalar)
 
LVecBase3d operator+ (const LVecBase3d other)
 
LVecBase3d operator+= (const LVecBase3d other)
 
LVecBase3d operator- ()
 
LVecBase3d operator- (const LVecBase3d other)
 
LVecBase3d operator-= (const LVecBase3d other)
 
LVecBase3d operator/ (double scalar)
 
LVecBase3d operator/= (double scalar)
 
bool operator< (const LVecBase3d other)
 
LVecBase3d operator= (const LVecBase3d copy)
 
LVecBase3d operator= (double fill_value)
 
bool operator== (const LVecBase3d other)
 
 operator[] (int i, double assign_val)
 
double operator[] (int i)
 
 output (Ostream out)
 
LVecBase3d project (const LVecBase3d 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 (double x, double y, double z)
 
 setCell (int i, double value)
 
 setX (double value)
 
 setY (double value)
 
 setZ (double 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 LVector3d back (CoordinateSystem cs)
 Returns the back vector for the given coordinate system. More...
 
static LVector3d down (CoordinateSystem cs)
 Returns the down vector for the given coordinate system. More...
 
static LVector3d forward (CoordinateSystem cs)
 Returns the forward vector for the given coordinate system. More...
 
static TypeHandle getClassType ()
 
static LVector3d left (CoordinateSystem cs)
 Returns the left vector for the given coordinate system. More...
 
static LVector3d rfu (double right, double fwd, double 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. INLINE_LINMATH FLOATNAME(LVector3) &FLOATNAME(LVector3):: More...
 
static LVector3d right (CoordinateSystem cs)
 Returns the right vector for the given coordinate system. More...
 
static const LVector3d unitX ()
 Returns a unit X vector. More...
 
static const LVector3d unitY ()
 Returns a unit Y vector. More...
 
static const LVector3d unitZ ()
 Returns a unit Z vector. More...
 
static LVector3d up (CoordinateSystem cs)
 Returns the up vector for the given coordinate system. More...
 
static const LVector3d zero ()
 Returns a zero-length vector. More...
 
- Static Public Member Functions inherited from LVecBase3d
static TypeHandle getClassType ()
 
static int size ()
 Returns 3: the number of components of a LVecBase3. More...
 
static const LVecBase3d unitX ()
 Returns a unit X vector. More...
 
static const LVecBase3d unitY ()
 Returns a unit Y vector. More...
 
static const LVecBase3d unitZ ()
 Returns a unit Z vector. More...
 
static const LVecBase3d zero ()
 Returns a zero-length vector. More...
 

Additional Inherited Members

- Public Types inherited from LVecBase3d
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/5]

__init__ ( )

◆ __init__() [2/5]

__init__ ( const LVecBase2d  copy,
double  z 
)

◆ __init__() [3/5]

__init__ ( const LVecBase3d  copy)

◆ __init__() [4/5]

__init__ ( double  fill_value)

◆ __init__() [5/5]

__init__ ( double  x,
double  y,
double  z 
)

◆ __repr__()

str __repr__ ( )

◆ __setattr__()

int __setattr__ ( str  attr_name,
object  assign 
)

◆ angleDeg()

double angleDeg ( const LVector3d  other)

Returns the angle between this vector and the other one, expressed in degrees. Both vectors should be initially normalized.

◆ angleRad()

double angleRad ( const LVector3d  other)

Returns the unsigned angle between this vector and the other one, expressed in radians. Both vectors should be initially normalized.

◆ back()

static LVector3d back ( CoordinateSystem  cs)
static

Returns the back vector for the given coordinate system.

◆ cross()

LVector3d cross ( const LVecBase3d  other)

◆ down()

static LVector3d down ( CoordinateSystem  cs)
static

Returns the down vector for the given coordinate system.

◆ forward()

static LVector3d forward ( CoordinateSystem  cs)
static

Returns the forward vector for the given coordinate system.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getXy()

LVector2d getXy ( )

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

◆ getXz()

LVector2d getXz ( )

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

◆ getYz()

LVector2d getYz ( )

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

◆ left()

static LVector3d left ( CoordinateSystem  cs)
static

Returns the left vector for the given coordinate system.

◆ normalized()

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

LVector3d operator* ( double  scalar)

◆ operator+() [1/2]

LVecBase3d operator+ ( const LVecBase3d  other)

◆ operator+() [2/2]

LVector3d operator+ ( const LVector3d  other)

◆ operator-() [1/3]

LVector3d operator- ( )

◆ operator-() [2/3]

LVecBase3d operator- ( const LVecBase3d  other)

◆ operator-() [3/3]

LVector3d operator- ( const LVector3d  other)

◆ operator/()

LVector3d operator/ ( double  scalar)

◆ operator=() [1/2]

LVector3d operator= ( const LVecBase3d  copy)

◆ operator=() [2/2]

LVector3d operator= ( double  fill_value)

◆ project()

LVector3d project ( const LVecBase3d  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()

double relativeAngleDeg ( const LVector3d  other)

This method is deprecated. Do not use.

◆ relativeAngleRad()

double relativeAngleRad ( const LVector3d  other)

This method is deprecated. Do not use.

◆ rfu()

static LVector3d rfu ( double  right,
double  fwd,
double  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. INLINE_LINMATH FLOATNAME(LVector3) &FLOATNAME(LVector3)::

◆ right()

static LVector3d right ( CoordinateSystem  cs)
static

Returns the right vector for the given coordinate system.

◆ signedAngleDeg()

double signedAngleDeg ( const LVector3d  other,
const LVector3d  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()

double signedAngleRad ( const LVector3d  other,
const LVector3d  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 LVector3d unitX ( )
static

Returns a unit X vector.

◆ unitY()

static const LVector3d unitY ( )
static

Returns a unit Y vector.

◆ unitZ()

static const LVector3d unitZ ( )
static

Returns a unit Z vector.

◆ up()

static LVector3d up ( CoordinateSystem  cs)
static

Returns the up vector for the given coordinate system.

◆ zero()

static const LVector3d zero ( )
static

Returns a zero-length vector.