예제 #1
0
 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()));
 }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
        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);
        }
예제 #5
0
 public Vector4f Add(Vector4f r)
 {
     return(new Vector4f(x + r.GetX(), y + r.GetY(), z + r.GetZ(), w + r.GetW()));
 }
예제 #6
0
 public float Dot(Vector4f r)
 {
     return(x * r.GetX() + y * r.GetY() + z * r.GetZ() + w * r.GetW());
 }
예제 #7
0
 public bool equals(Vector4f r)
 {
     return(x == r.GetX() && y == r.GetY() && z == r.GetZ() && w == r.GetW());
 }
예제 #8
0
 public Vector4f Div(Vector4f r)
 {
     return(new Vector4f(x / r.GetX(), y / r.GetY(), z / r.GetZ(), w / r.GetW()));
 }
예제 #9
0
 public bool equals(Vector4f r)
 {
     return x == r.GetX() && y == r.GetY() && z == r.GetZ() && w == r.GetW();
 }
예제 #10
0
 public Vector4f Div(Vector4f r)
 {
     return new Vector4f(x / r.GetX(), y / r.GetY(), z / r.GetZ(), w / r.GetW());
 }
예제 #11
0
 public Vector4f Add(Vector4f r)
 {
     return new Vector4f(x + r.GetX(), y + r.GetY(), z + r.GetZ(), w + r.GetW());
 }
예제 #12
0
 public Vector4f Sub(Vector4f r)
 {
     return new Vector4f(x - r.GetX(), y - r.GetY(), z - r.GetZ(), w - r.GetW());
 }
예제 #13
0
 public Vector4f Mul(Vector4f r)
 {
     return new Vector4f(x * r.GetX(), y * r.GetY(), z * r.GetZ(), w * r.GetW());
 }
예제 #14
0
 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());
 }
예제 #15
0
 public Vertex PerspectiveDivide()
 {
     return(new Vertex(new Vector4f(m_pos.GetX() / m_pos.GetW(), m_pos.GetY() / m_pos.GetW(),
                                    m_pos.GetZ() / m_pos.GetW(), m_pos.GetW())));
 }
예제 #16
0
 public Vector4f Sub(Vector4f r)
 {
     return(new Vector4f(x - r.GetX(), y - r.GetY(), z - r.GetZ(), w - r.GetW()));
 }
예제 #17
0
 public Vector4f Mul(Vector4f r)
 {
     return(new Vector4f(x * r.GetX(), y * r.GetY(), z * r.GetZ(), w * r.GetW()));
 }
예제 #18
0
 public float Dot(Vector4f r)
 {
     return x * r.GetX() + y * r.GetY() + z * r.GetZ() + w * r.GetW();
 }