Browse Source

raise assertions for undefined operations

David Rose 21 years ago
parent
commit
4a66fa2a1b

+ 4 - 3
panda/src/linmath/lorientation_src.I

@@ -89,7 +89,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &m) {
 //               Applies an rotation to an orientation.
 ////////////////////////////////////////////////////////////////////
 INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
-operator *(const FLOATNAME(LQuaternion)& other) const {
+operator *(const FLOATNAME(LRotation)& other) const {
   return multiply(other);
 }
 
@@ -101,6 +101,7 @@ operator *(const FLOATNAME(LQuaternion)& other) const {
 //               simply return the rhs.
 ////////////////////////////////////////////////////////////////////
 INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
-operator *(const FLOATNAME(LOrientation)& other) const {
-  return other;
+operator *(const FLOATNAME(LQuaternion)& other) const {
+  nassert_raise("LOrientation * LQuaternion is undefined; use LOrientation * LRotation or LQuaternion * LQuaternion");
+  return multiply(other);
 }

+ 2 - 2
panda/src/linmath/lorientation_src.h

@@ -30,10 +30,10 @@ PUBLISHED:
   INLINE_LINMATH FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &);
 
   INLINE_LINMATH FLOATNAME(LOrientation)
-  operator *(const FLOATNAME(LQuaternion)& other) const;
+  operator *(const FLOATNAME(LRotation)& other) const;
 
   INLINE_LINMATH FLOATNAME(LOrientation)
-  operator *(const FLOATNAME(LOrientation)& other) const;
+  operator *(const FLOATNAME(LQuaternion)& other) const;
 
 public:
   static TypeHandle get_class_type() {

+ 3 - 3
panda/src/linmath/lrotation_src.I

@@ -107,12 +107,12 @@ operator*(const FLOATNAME(LRotation)& other) const {
 //       Access: public
 //  Description: Rotation * Orientation = Orientation
 //               This is another meaningless operation, attempting
-//               to apply an orientation to a rotation.  It simply
-//               returns the rhs.
+//               to apply an orientation to a rotation.
 ////////////////////////////////////////////////////////////////////
 INLINE_LINMATH FLOATNAME(LQuaternion) FLOATNAME(LRotation)::
 operator*(const FLOATNAME(LQuaternion)& other) const {
-  return other;
+  nassert_raise("LRotation * LQuaternion is undefined; use LRotation * LRotation or LQuaternion * LQuaternion");
+  return multiply(other);
 }