open_toontown_panda3d/panda/src/linmath/lvec4_ops.I

72 lines
2.1 KiB
Plaintext

// Filename: lvec4_ops.I
// Created by: drose (08Mar00)
//
////////////////////////////////////////////////////////////////////
#include <math.h>
#include "nearly_zero.h"
////////////////////////////////////////////////////////////////////
// Function: scalar * LVecBase4
// Description:
////////////////////////////////////////////////////////////////////
template<class NumType, class NumType2>
INLINE LVecBase4<NumType>
operator * (NumType2 scalar, const LVecBase4<NumType> &a) {
return a * scalar;
}
////////////////////////////////////////////////////////////////////
// Function: scalar * LPoint4
// Description:
////////////////////////////////////////////////////////////////////
template<class NumType, class NumType2>
INLINE LPoint4<NumType>
operator * (NumType2 scalar, const LPoint4<NumType> &a) {
return a * scalar;
}
////////////////////////////////////////////////////////////////////
// Function: scalar * LVector4
// Description:
////////////////////////////////////////////////////////////////////
template<class NumType, class NumType2>
INLINE LVector4<NumType>
operator * (NumType2 scalar, const LVector4<NumType> &a) {
return a * scalar;
}
////////////////////////////////////////////////////////////////////
// Function: dot product of LVecBase4
// Description:
////////////////////////////////////////////////////////////////////
template<class NumType>
INLINE NumType
dot(const LVecBase4<NumType> &a, const LVecBase4<NumType> &b) {
return a.dot(b);
}
////////////////////////////////////////////////////////////////////
// Function: length of a vector
// Description:
////////////////////////////////////////////////////////////////////
template<class NumType>
INLINE NumType
length(const LVector4<NumType> &a) {
return a.length();
}
////////////////////////////////////////////////////////////////////
// Function: normalize
// Description: Returns a normalized vector from the given vector.
////////////////////////////////////////////////////////////////////
template<class NumType>
INLINE LVector4<NumType>
normalize(const LVector4<NumType> &v) {
LVector4<NumType> v1 = v;
v1.normalize();
return v1;
}