public Vector4f Cross(Vector4f r)
        {
            float x_ = y * r.GetZ() - z * r.GetY();
             		    float y_ = z * r.GetX() - x * r.GetZ();
             		    float z_ = x * r.GetY() - y * r.GetX();

             		    return new Vector4f(x_, y_, z_, 0);
        }
 public bool equals(Vector4f r)
 {
     return x == r.GetX() && y == r.GetY() && z == r.GetZ() && w == r.GetW();
 }
 public float Dot(Vector4f r)
 {
     return x * r.GetX() + y * r.GetY() + z * r.GetZ() + w * r.GetW();
 }
 public Vector4f Div(Vector4f r)
 {
     return new Vector4f(x / r.GetX(), y / r.GetY(), z / r.GetZ(), w / r.GetW());
 }
 public Vector4f Add(Vector4f r)
 {
     return new Vector4f(x + r.GetX(), y + r.GetY(), z + r.GetZ(), w + r.GetW());
 }
        public Vector4f Rotate(Vector4f axis, float angle)
        {
            float sinAngle = (float)Math.Sin(-angle);
            float cosAngle = (float)Math.Cos(-angle);

             		    return this.Cross(axis.Mul(sinAngle)).Add(           //Rotation on local X
             				    (this.Mul(cosAngle)).Add(                     //Rotation on local Z
                            axis.Mul(this.Dot(axis.Mul(1 - cosAngle))))); //Rotation on local Y
        }
 public Vector4f Sub(Vector4f r)
 {
     return new Vector4f(x - r.GetX(), y - r.GetY(), z - r.GetZ(), w - r.GetW());
 }
 public Vector4f Lerp(Vector4f dest, float lerpFactor)
 {
     return dest.Sub(this).Mul(lerpFactor).Add(this);
 }
 public Vector4f Mul(Vector4f r)
 {
     return new Vector4f(x * r.GetX(), y * r.GetY(), z * r.GetZ(), w * r.GetW());
 }
 public Vector4f Transform(Vector4f r)
 {
     return new Vector4f(m[0, 0] * r.GetX() + m[0, 1] * r.GetY() + m[0, 2] * r.GetZ() + m[0, 3] * r.GetW(),
      		                        m[1, 0] * r.GetX() + m[1, 1] * r.GetY() + m[1, 2] * r.GetZ() + m[1, 3] * r.GetW(),
      		                        m[2, 0] * r.GetX() + m[2, 1] * r.GetY() + m[2, 2] * r.GetZ() + m[2, 3] * r.GetW(),
      							    m[3, 0] * r.GetX() + m[3, 1] * r.GetY() + m[3, 2] * r.GetZ() + m[3, 3] * r.GetW());
 }
        public Matrix4f InitRotation(Vector4f forward, Vector4f up, Vector4f right)
        {
            Vector4f f = forward;
             		    Vector4f r = right;
             		    Vector4f u = up;

             		    m[0, 0] = r.GetX();	m[0, 1] = r.GetY();	m[0, 2] = r.GetZ();	m[0, 3] = 0;
             		    m[1, 0] = u.GetX();	m[1, 1] = u.GetY();	m[1, 2] = u.GetZ();	m[1, 3] = 0;
             		    m[2, 0] = f.GetX();	m[2, 1] = f.GetY();	m[2, 2] = f.GetZ();	m[2, 3] = 0;
             		    m[3, 0] = 0;		m[3, 1] = 0;		m[3, 2] = 0;		m[3, 3] = 1;

             		    return this;
        }
        public Matrix4f InitRotation(Vector4f forward, Vector4f up)
        {
            Vector4f f = forward.Normalized();

             		    Vector4f r = up.Normalized();
             		    r = r.Cross(f);

             		    Vector4f u = f.Cross(r);

             		    return InitRotation(f, u, r);
        }
 public Vertex(Vector4f pos)
 {
     m_pos = pos;
 }
 public Vertex(float x, float y, float z)
 {
     m_pos = new Vector4f(x, y, z, 1);
 }