예제 #1
0
 /// multiply operator
 Vector3T<T> operator*(const Vector3T<T>& v) const throw()
 {
    return Vector3T<T>(
       m_d[0][0] * v.X() + m_d[1][0] * v.Y() + m_d[2][0] * v.Z() + m_d[3][0],
       m_d[0][1] * v.X() + m_d[1][1] * v.Y() + m_d[2][1] * v.Z() + m_d[3][1],
       m_d[0][2] * v.X() + m_d[1][2] * v.Y() + m_d[2][2] * v.Z() + m_d[3][2]
    );
 }
예제 #2
0
   /// builds a rotation matrix from axis and angle
   static Matrix4T<T> Rotate(Vector3T<T> vAxis, T dAngleRot)
   {
      vAxis.Normalize();

      T cs = std::cos(-dAngleRot);
      T sn = std::sin(-dAngleRot);
      T t = T(1.0) - cs;

      Matrix4T<T> matRotate;
      matRotate.Row(0, Vector3T<T>(t * vAxis.X() * vAxis.X() + cs, t * vAxis.X() * vAxis.Y() - sn * vAxis.Z(), t * vAxis.X() * vAxis.Z() + sn * vAxis.Y()));
      matRotate.Row(1, Vector3T<T>(t * vAxis.X() * vAxis.Y() + sn * vAxis.Z(), t * vAxis.Y() * vAxis.Y() + cs, t * vAxis.Y() * vAxis.Z() - sn * vAxis.X()));
      matRotate.Row(2, Vector3T<T>(t * vAxis.X() * vAxis.Z() - sn * vAxis.Y(), t * vAxis.Y() * vAxis.Z() + sn * vAxis.X(), t * vAxis.Z() * vAxis.Z() + cs));
      matRotate[3][3] = 1.0;
      return matRotate;
   }
예제 #3
0
 /// sets row with vector components
 void Row(unsigned int uiRow, const Vector3T<T>& vRow) throw()
 {
    ATLASSERT(uiRow < 4);
    m_d[0][uiRow] = vRow.X();
    m_d[1][uiRow] = vRow.Y();
    m_d[2][uiRow] = vRow.Z();
 }
예제 #4
0
 /// sets column with vector components
 void Column(unsigned int uiColumn, const Vector3T<T>& vColumn) throw()
 {
    ATLASSERT(uiColumn < 4);
    m_d[uiColumn][0] = vColumn.X();
    m_d[uiColumn][1] = vColumn.Y();
    m_d[uiColumn][2] = vColumn.Z();
 }
예제 #5
0
inline Vector3T<T> operator/(const Vector3T<T>& vec, const T d)
{
   return Vector3T<T>(vec.X()/d, vec.Y()/d, vec.Z()/d);
}
예제 #6
0
inline Vector3T<T> operator-(const Vector3T<T>& v1, const Vector3T<T>& v2) throw()
{
   return Vector3T<T>(v1.X() - v2.X(), v1.Y() - v2.Y(), v1.Z() - v2.Z());
}
예제 #7
0
inline Vector3T<T> operator-(const Vector3T<T>& vec) throw()
{
   return Vector3T<T>(-vec.X(), -vec.Y(), -vec.Z());
};