mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
add LQuaternionf::get_forward(), fix angle_rad()
This commit is contained in:
parent
7506a18646
commit
52a0c84fce
@ -107,21 +107,23 @@ operator - (const FLOATNAME(LQuaternion) &other) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LVector::angle_rad
|
// Function: LQuaternion::angle_rad
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns the angle between this quat and the other
|
// Description: Returns the angle between the orientation represented
|
||||||
// one, expressed in radians.
|
// by this quaternion and the other one, expressed in
|
||||||
|
// radians.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
||||||
angle_rad(const FLOATNAME(LQuaternion) &other) const {
|
angle_rad(const FLOATNAME(LQuaternion) &other) const {
|
||||||
return get_axis().angle_rad(other.get_axis());
|
return get_forward().angle_rad(other.get_forward());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LVector::angle_deg
|
// Function: LQuaternion::angle_deg
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns the angle between this vector and the other
|
// Description: Returns the angle between the orientation represented
|
||||||
// one, expressed in degrees.
|
// by this quaternion and the other one, expressed in
|
||||||
|
// degrees.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
||||||
angle_deg(const FLOATNAME(LQuaternion) &other) const {
|
angle_deg(const FLOATNAME(LQuaternion) &other) const {
|
||||||
@ -299,6 +301,39 @@ get_angle() const {
|
|||||||
return rad_2_deg(acos(_v.data[0]) * 2.0);
|
return rad_2_deg(acos(_v.data[0]) * 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LQuaternion::get_up
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the orientation represented by this
|
||||||
|
// quaternion, expressed as an up vector.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LQuaternion)::
|
||||||
|
get_up(CoordinateSystem cs) const {
|
||||||
|
return xform(FLOATNAME(LVector3)::up(cs));
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LQuaternion::get_right
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the orientation represented by this
|
||||||
|
// quaternion, expressed as a right vector.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LQuaternion)::
|
||||||
|
get_right(CoordinateSystem cs) const {
|
||||||
|
return xform(FLOATNAME(LVector3)::right(cs));
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: LQuaternion::get_forward
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the orientation represented by this
|
||||||
|
// quaternion, expressed as a forward vector.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LQuaternion)::
|
||||||
|
get_forward(CoordinateSystem cs) const {
|
||||||
|
return xform(FLOATNAME(LVector3)::forward(cs));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: LQuaternion::get_r
|
// Function: LQuaternion::get_r
|
||||||
|
@ -73,6 +73,10 @@ PUBLISHED:
|
|||||||
INLINE_LINMATH FLOATNAME(LVector3) get_axis() const;
|
INLINE_LINMATH FLOATNAME(LVector3) get_axis() const;
|
||||||
INLINE_LINMATH FLOATTYPE get_angle() const;
|
INLINE_LINMATH FLOATTYPE get_angle() const;
|
||||||
|
|
||||||
|
INLINE_LINMATH FLOATNAME(LVector3) get_up(CoordinateSystem cs = CS_default) const;
|
||||||
|
INLINE_LINMATH FLOATNAME(LVector3) get_right(CoordinateSystem cs = CS_default) const;
|
||||||
|
INLINE_LINMATH FLOATNAME(LVector3) get_forward(CoordinateSystem cs = CS_default) const;
|
||||||
|
|
||||||
INLINE_LINMATH FLOATTYPE get_r() const;
|
INLINE_LINMATH FLOATTYPE get_r() const;
|
||||||
INLINE_LINMATH FLOATTYPE get_i() const;
|
INLINE_LINMATH FLOATTYPE get_i() const;
|
||||||
INLINE_LINMATH FLOATTYPE get_j() const;
|
INLINE_LINMATH FLOATTYPE get_j() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user