|
|
@@ -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
|