potential angle improvement for vector to vector checks)
This commit is contained in:
parent
1b389acabc
commit
a181b41465
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue