potential angle improvement for vector to vector checks)

This commit is contained in:
Zachary Pavlov 2007-10-04 04:38:49 +00:00
parent 1b389acabc
commit a181b41465
2 changed files with 29 additions and 0 deletions

View File

@ -199,6 +199,31 @@ angle_rad(const FLOATNAME(LVector3) &other) const {
}
}
////////////////////////////////////////////////////////////////////
// Function: LVector::relative_angle_rad
// Access: Published
// Description: returns the signed angled between two vectors.
// normalization is NOT necessary
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector3)::
relative_angle_rad(const FLOATNAME(LVector3) &other) const {
//okay, we'll
return atan2((other._v.v._0*_v.v._1)-(other._v.v._1*_v.v._0), dot(other));
}
////////////////////////////////////////////////////////////////////
// Function: LVector::relative_angle_deg
// Access: Published
// Description: returns the signed angled between two vectors.
// normalization is NOT necessary
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector3)::
relative_angle_deg(const FLOATNAME(LVector3) &other) const {
//okay, we'll
return relative_angle_rad(other)*180/3.1415926535;
}
////////////////////////////////////////////////////////////////////
// Function: LVector::angle_deg
// Access: Published

View File

@ -52,6 +52,10 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE angle_rad(const FLOATNAME(LVector3) &other) const;
INLINE_LINMATH FLOATTYPE angle_deg(const FLOATNAME(LVector3) &other) const;
INLINE_LINMATH FLOATTYPE relative_angle_rad(const FLOATNAME(LVector3) &other) const;
INLINE_LINMATH FLOATTYPE relative_angle_deg(const FLOATNAME(LVector3) &other) const;
INLINE_LINMATH FLOATNAME(LVector3) operator * (FLOATTYPE scalar) const;
INLINE_LINMATH FLOATNAME(LVector3) operator / (FLOATTYPE scalar) const;