API Reference: LQuaternionf

LQuaternionf

    from pandac.PandaModules import LQuaternionf
    Filename: lquaternion_src.h Created by: frang (06Jun00)
    PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. All rights reserved.
    All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."
    Class : FLOATNAME(LQuaternion)
    Description : This is the base quaternion class

Inheritance:

Methods of LQuaternionf:

Methods of LVecBase4f:

LQuaternionf
LQuaternionf::LQuaternionf(void);

Filename: lquaternion_src.I Created by: frang (06Jun00)
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. All rights reserved.
All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."
Description:

almostEqual
bool LQuaternionf::almost_equal(LQuaternionf const &other) const;

Description: Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.
Description: Returns true if two quaternions are memberwise equal within a specified tolerance.

almostSameDirection
bool LQuaternionf::almost_same_direction(LQuaternionf const &other, float threshold) const;

Description: Returns true if two quaternions represent the same rotation within a specified tolerance.

angleDeg
float LQuaternionf::angle_deg(LQuaternionf const &other) const;

Description: Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.

angleRad
float LQuaternionf::angle_rad(LQuaternionf const &other) const;

Description: Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.

conjugate
LQuaternionf LQuaternionf::conjugate(void) const;

Description: Returns the complex conjugate of this quat.

conjugateFrom
bool LQuaternionf::conjugate_from(LQuaternionf const &other);

Description: Computes the conjugate of the other quat, and stores the result in this quat. This is a fully general operation and makes no assumptions about the type of transform represented by the quat.
The other quat must be a different object than this quat. However, if you need to get a conjugate of a quat in place, see conjugate_in_place.
The return value is true if the quat was successfully inverted, false if there was a singularity.

conjugateInPlace
bool LQuaternionf::conjugate_in_place(void);

Description: Sets this to be the conjugate of the current quat. Returns true if the successful, false if the quat was singular.

extractToMatrix
void LQuaternionf::extract_to_matrix(LMatrix3f &m) const;

Description: Based on the quat lib from VRPN.

getAngle
float LQuaternionf::get_angle(void) const;

Description: This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the angle, in degrees counterclockwise about the axis.
It is necessary to ensure the quaternion has been normalized (for instance, with a call to normalize()) before calling this method.

getAngleRad
float LQuaternionf::get_angle_rad(void) const;

Description: This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the angle, in radians counterclockwise about the axis.
It is necessary to ensure the quaternion has been normalized (for instance, with a call to normalize()) before calling this method.

getAxis
LVector3f LQuaternionf::get_axis(void) const;

Description: This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the axis; it is not normalized.

getAxisNormalized
LVector3f LQuaternionf::get_axis_normalized(void) const;

Description: This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the normalized axis.

getClassType
static TypeHandle LQuaternionf::get_class_type(void);

Undocumented function.

getForward
LVector3f LQuaternionf::get_forward(CoordinateSystem cs = (CS_default)) const;

Description: Returns the orientation represented by this quaternion, expressed as a forward vector.

getHpr
LVecBase3f LQuaternionf::get_hpr(CoordinateSystem cs = (CS_default)) const;

Description: Extracts the equivalent Euler angles from the unit quaternion.

getI
float LQuaternionf::get_i(void) const;

Description:

getJ
float LQuaternionf::get_j(void) const;

Description:

getK
float LQuaternionf::get_k(void) const;

Description:

getR
float LQuaternionf::get_r(void) const;

Description:

getRight
LVector3f LQuaternionf::get_right(CoordinateSystem cs = (CS_default)) const;

Description: Returns the orientation represented by this quaternion, expressed as a right vector.

getUp
LVector3f LQuaternionf::get_up(CoordinateSystem cs = (CS_default)) const;

Description: Returns the orientation represented by this quaternion, expressed as an up vector.

identQuat
static LQuaternionf const &LQuaternionf::ident_quat(void);

Description: Returns an identity quaternion.

invertFrom
bool LQuaternionf::invert_from(LQuaternionf const &other);

Description: Computes the inverse of the other quat, and stores the result in this quat. This is a fully general operation and makes no assumptions about the type of transform represented by the quat.
The other quat must be a different object than this quat. However, if you need to invert a quat in place, see invert_in_place.
The return value is true if the quat was successfully inverted, false if there was a singularity.

invertInPlace
bool LQuaternionf::invert_in_place(void);

Description: Inverts the current quat. Returns true if the inverse is successful, false if the quat was singular.

isAlmostIdentity
bool LQuaternionf::is_almost_identity(float tolerance) const;

Description: Returns true if this quaternion represents the identity transformation within a given tolerance.

isIdentity
bool LQuaternionf::is_identity(void) const;

Description: Returns true if this quaternion represents the identity transformation: no rotation.

isSameDirection
bool LQuaternionf::is_same_direction(LQuaternionf const &other) const;

Description: Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.

multiply
LQuaternionf LQuaternionf::multiply(LQuaternionf const &rhs) const;

Description: actual multiply call (non virtual)

normalize
bool LQuaternionf::normalize(void);

Description:

operator *
LQuaternionf LQuaternionf::operator *(float scalar) const;

Description:
Description: Quat * Matrix = matrix

operator *=
LQuaternionf &LQuaternionf::operator *=(LQuaternionf const &);

Description:

operator +
LQuaternionf LQuaternionf::operator +(LQuaternionf const &other) const;

Description:

operator -
LQuaternionf LQuaternionf::operator -(LQuaternionf const &other) const;

Description:

operator -
LQuaternionf LQuaternionf::operator -(LQuaternionf const &other) const;

Description:

operator /
LQuaternionf LQuaternionf::operator /(float scalar) const;

Description:

output
void LQuaternionf::output(ostream &) const;

Description:

pureImaginary
static LQuaternionf LQuaternionf::pure_imaginary(LVector3f const &);

Description:

setFromAxisAngle
void LQuaternionf::set_from_axis_angle(float angle_deg, LVector3f const &axis);

Description: angle_deg is the angle about the axis in degrees. axis must be normalized.

setFromAxisAngleRad
void LQuaternionf::set_from_axis_angle_rad(float angle_rad, LVector3f const &axis);

Description: angle_rad is the angle about the axis in radians. axis must be normalized.

setFromMatrix
void LQuaternionf::set_from_matrix(LMatrix3f const &m);

Description:
Description: Sets the quaternion according to the rotation represented by the matrix. Originally we tried an algorithm presented by Do-While Jones, but that turned out to be broken. This is based on the quat lib from UNC.

setHpr
void LQuaternionf::set_hpr(LVecBase3f const &hpr, CoordinateSystem cs = (CS_default));

Description: Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. (from Real-time Rendering, p.49)

setI
void LQuaternionf::set_i(float i);

Description:

setJ
void LQuaternionf::set_j(float j);

Description:

setK
void LQuaternionf::set_k(float k);

Description:

setR
void LQuaternionf::set_r(float r);

Description:

xform
LVecBase3f LQuaternionf::xform(LVecBase3f const &v) const;

Description: Transforms a 3-d vector by the indicated rotation
Description: Transforms a 4-d vector by the indicated rotation

LVecBase4f
LVecBase4f::LVecBase4f(void);

Filename: lvecBase4_src.I Created by: drose (08Mar00)
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. All rights reserved.
All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."
Description:

addHash
unsigned int LVecBase4f::add_hash(unsigned int hash) const;

Description: Adds the vector into the running hash.

addToCell
void LVecBase4f::add_to_cell(int i, float value);

These next functions add to an existing value. i.e. foo.set_x(foo.get_x() + value) These are useful to reduce overhead in scripting languages:
Description:

addW
void LVecBase4f::add_w(float value);

Description:

addX
void LVecBase4f::add_x(float value);

These next functions add to an existing value. i.e. foo.set_x(foo.get_x() + value) These are useful to reduce overhead in scripting languages:
Description:

addY
void LVecBase4f::add_y(float value);

Description:

addZ
void LVecBase4f::add_z(float value);

Description:

almostEqual
bool LVecBase4f::almost_equal(LVecBase4f const &other, float threshold) const;

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

compareTo
int LVecBase4f::compare_to(LVecBase4f const &other) const;

Description: This flavor of compare_to uses a default threshold value based on the numeric type.
Description: 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).

dot
float LVecBase4f::dot(LVecBase4f const &other) const;

Description:

fill
void LVecBase4f::fill(float fill_value);

Description: Sets each element of the vector to the indicated fill_value. This is particularly useful for initializing to zero.

fmax
LVecBase4f LVecBase4f::fmax(LVecBase4f const &other);

Description:

fmin
LVecBase4f LVecBase4f::fmin(LVecBase4f const &other);

Description:

getCell
float LVecBase4f::get_cell(int i) const;

Description:

getClassType
static TypeHandle LVecBase4f::get_class_type(void);

Undocumented function.

getData
float const *LVecBase4f::get_data(void) const;

Description: Returns the address of the first of the four data elements in the vector. The remaining elements occupy the next positions consecutively in memory.

getHash
unsigned int LVecBase4f::get_hash(void) const;

Description: Returns a suitable hash for phash_map.

getNumComponents
int LVecBase4f::get_num_components(void) const;

Description: Returns the number of elements in the vector, four.

getW
float LVecBase4f::get_w(void) const;

Description:

getX
float LVecBase4f::get_x(void) const;

Description:

getY
float LVecBase4f::get_y(void) const;

Description:

getZ
float LVecBase4f::get_z(void) const;

Description:

isNan
bool LVecBase4f::is_nan(void) const;

Description: Returns true if any component of the vector is not-a-number, false otherwise.

length
float LVecBase4f::length(void) const;

Description: Returns the length of the vector, by the Pythagorean theorem.

lengthSquared
float LVecBase4f::length_squared(void) const;

Description: Returns the square of the vector's length, cheap and easy.

normalize
bool LVecBase4f::normalize(void);

Description: Normalizes the vector in place. Returns true if the vector was normalized, false if it was a zero-length vector.

operator !=
bool LVecBase4f::operator !=(LVecBase4f const &other) const;

Description:

operator *
LVecBase4f LVecBase4f::operator *(float scalar) const;

Description:

operator *=
void LVecBase4f::operator *=(float scalar);

Description:

operator +
LVecBase4f LVecBase4f::operator +(LVecBase4f const &other) const;

Description:

operator +=
void LVecBase4f::operator +=(LVecBase4f const &other);

Description:

operator -
LVecBase4f LVecBase4f::operator -(LVecBase4f const &other) const;

Description:

operator -
LVecBase4f LVecBase4f::operator -(LVecBase4f const &other) const;

Description:

operator -=
void LVecBase4f::operator -=(LVecBase4f const &other);

Description:

operator /
LVecBase4f LVecBase4f::operator /(float scalar) const;

Description:

operator /=
void LVecBase4f::operator /=(float scalar);

Description:

operator <
bool LVecBase4f::operator <(LVecBase4f const &other) const;

Description: 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().

operator =
LVecBase4f &LVecBase4f::operator =(LVecBase4f const &copy);

Description:

operator ==
bool LVecBase4f::operator ==(LVecBase4f const &other) const;

Description:

operator []
float LVecBase4f::operator [](int i) const;

Description:

operator delete
void LVecBase4f::operator delete(void *ptr);

Undocumented function.

operator new
void *LVecBase4f::operator new(unsigned int size);

Undocumented function.

output
void LVecBase4f::output(ostream &out) const;

Description:

project
LVecBase4f LVecBase4f::project(LVecBase4f const &onto) const;

Description: Returns a new vector representing the projection of this vector onto another one. The resulting vector will be a scalar multiple of onto.

pythonRepr
void LVecBase4f::python_repr(ostream &out, string const &class_name) const;

Description:

set
void LVecBase4f::set(float x, float y, float z, float w);

Description:

setCell
void LVecBase4f::set_cell(int i, float value);

Description:

Setitem
void LVecBase4f::__setitem__(int i, float v);

Description:

setW
void LVecBase4f::set_w(float value);

Description:

setX
void LVecBase4f::set_x(float value);

Description:

setY
void LVecBase4f::set_y(float value);

Description:

setZ
void LVecBase4f::set_z(float value);

Description:

size
static int LVecBase4f::size(void);

HAVE_PYTHON
Description: Returns 4: the number of components of a LVecBase4.

unitW
static LVecBase4f const &LVecBase4f::unit_w(void);

Description: Returns a unit W vector.

unitX
static LVecBase4f const &LVecBase4f::unit_x(void);

Description: Returns a unit X vector.

unitY
static LVecBase4f const &LVecBase4f::unit_y(void);

Description: Returns a unit Y vector.

unitZ
static LVecBase4f const &LVecBase4f::unit_z(void);

Description: Returns a unit Z vector.

validatePtr
static bool LVecBase4f::validate_ptr(void const *ptr);

Undocumented function.

zero
static LVecBase4f const &LVecBase4f::zero(void);

Description: Returns a zero-length vector.