Ejemplo n.º 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
    );
}
Ejemplo n.º 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 ();
}
Ejemplo n.º 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;
}
Ejemplo n.º 4
0
void cGraphicsMFC::vectorToPixel(cVector position, int &xpix, int &ypix, Real &zbuff)
{
/* I have to use a viewercorrection like in cGraphicsMFC::pixelToVector*/
	int tempx, tempy;
	cVector viewercorrection = _matrix.lastColumn();
	position += viewercorrection;
	_realpixelconverter.realToPixel(position.x(), position.y(), &tempx, &tempy);
	xpix = tempx;
	ypix = tempy;
	zbuff = 0.0;
}
Ejemplo n.º 5
0
float cVector::DotProduct (cVector vector)
{
  return x () * vector.x () + y () * vector.y () + z () * vector.z ();
}
Ejemplo n.º 6
0
 void cParticle::SetAcceleration (cVector vector)
 {
   vec_acc[0] = vector.x ();
   vec_acc[1] = vector.y ();
   vec_acc[2] = vector.z ();
 }
Ejemplo n.º 7
0
 void cParticle::Accelerate (cVector vector)
 {
   vec_speed[0] += vector.x ();
   vec_speed[1] += vector.y ();
   vec_speed[2] += vector.z ();
 }