From 4a66fa2a1b83b870975dc4643b9a4897dc0fe679 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 6 Aug 2004 02:47:37 +0000 Subject: [PATCH] raise assertions for undefined operations --- panda/src/linmath/lorientation_src.I | 7 ++++--- panda/src/linmath/lorientation_src.h | 4 ++-- panda/src/linmath/lrotation_src.I | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/panda/src/linmath/lorientation_src.I b/panda/src/linmath/lorientation_src.I index 5a123f2fe2..5e68556a90 100644 --- a/panda/src/linmath/lorientation_src.I +++ b/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); } diff --git a/panda/src/linmath/lorientation_src.h b/panda/src/linmath/lorientation_src.h index aa01a65745..28f94ea820 100644 --- a/panda/src/linmath/lorientation_src.h +++ b/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() { diff --git a/panda/src/linmath/lrotation_src.I b/panda/src/linmath/lrotation_src.I index 360c59319f..31f62837f9 100644 --- a/panda/src/linmath/lrotation_src.I +++ b/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); }