Пример #1
0
void cVector::CrossProduct (cVector vector1, cVector vector2)
{
  Set (vector1.y () * vector2.z () - vector1.z () * vector2.y (), // = x
       vector1.z () * vector2.x () - vector1.x () * vector2.z (), // = y
       vector1.x () * vector2.y () - vector1.y () * vector2.x ()  // = z
    );
}
Пример #2
0
void cMatrix::TranslationMatrix (cVector vector)
{
  Identity ();
  m_fields[0][3] = vector.x ();
  m_fields[1][3] = vector.y ();
  m_fields[2][3] = vector.z ();
}
Пример #3
0
cVector cMatrix::ApplyRotation (cVector vector)
{
  cVector vectemp;
  for (int i = 0; i < 3; i++)
    vectemp.setField (i, m_fields[i][0] * vector.x () +
                      m_fields[i][1] * vector.y () +
                      m_fields[i][2] * vector.z ());
  return vectemp;
}
Пример #4
0
float cVector::DotProduct (cVector vector)
{
  return x () * vector.x () + y () * vector.y () + z () * vector.z ();
}
Пример #5
0
 void cParticle::SetAcceleration (cVector vector)
 {
   vec_acc[0] = vector.x ();
   vec_acc[1] = vector.y ();
   vec_acc[2] = vector.z ();
 }
Пример #6
0
 void cParticle::Accelerate (cVector vector)
 {
   vec_speed[0] += vector.x ();
   vec_speed[1] += vector.y ();
   vec_speed[2] += vector.z ();
 }