// Filename: lvec2_ops.I // Created by: drose (08Mar00) // //////////////////////////////////////////////////////////////////// #include #include "nearly_zero.h" //////////////////////////////////////////////////////////////////// // Function: scalar * LVecBase2 // Description: //////////////////////////////////////////////////////////////////// template INLINE LVecBase2 operator * (NumType2 scalar, const LVecBase2 &a) { return a * scalar; } //////////////////////////////////////////////////////////////////// // Function: scalar * LPoint2 // Description: //////////////////////////////////////////////////////////////////// template INLINE LPoint2 operator * (NumType2 scalar, const LPoint2 &a) { return a * scalar; } //////////////////////////////////////////////////////////////////// // Function: scalar * LVector2 // Description: //////////////////////////////////////////////////////////////////// template INLINE LVector2 operator * (NumType2 scalar, const LVector2 &a) { return a * scalar; } //////////////////////////////////////////////////////////////////// // Function: dot product of LVecBase2 // Description: //////////////////////////////////////////////////////////////////// template INLINE NumType dot(const LVecBase2 &a, const LVecBase2 &b) { return a.dot(b); } //////////////////////////////////////////////////////////////////// // Function: cross product of LVecBase2 // Description: //////////////////////////////////////////////////////////////////// template INLINE LVecBase2 cross(const LVecBase2 &a, const LVecBase2 &b) { return a.cross(b); } //////////////////////////////////////////////////////////////////// // Function: cross product of LVector2 // Description: //////////////////////////////////////////////////////////////////// template INLINE LVector2 cross(const LVector2 &a, const LVector2 &b) { return LVector2(a.cross(b)); } //////////////////////////////////////////////////////////////////// // Function: length of a vector // Description: //////////////////////////////////////////////////////////////////// template INLINE NumType length(const LVector2 &a) { return a.length(); } //////////////////////////////////////////////////////////////////// // Function: normalize // Description: Returns a normalized vector from the given vector. //////////////////////////////////////////////////////////////////// template INLINE LVector2 normalize(const LVector2 &v) { LVector2 v1 = v; v1.normalize(); return v1; }