Пример #1
0
        public static Vec4f operator *(Mat4 a, Vec4f b)
        {
            if (a == null)
            {
                return(null);
            }
            if (b == null)
            {
                return(null);
            }

            Vec4f newVec = new Vec4f();

            newVec.Data[0] = (float)(a.mData[0][0] * b.Data[0] +
                                     a.mData[0][1] * b.Data[1] +
                                     a.mData[0][2] * b.Data[2] +
                                     a.mData[0][3] * b.Data[3]);

            newVec.Data[1] = (float)(a.mData[1][0] * b.Data[0] +
                                     a.mData[1][1] * b.Data[1] +
                                     a.mData[1][2] * b.Data[2] +
                                     a.mData[1][3] * b.Data[3]);

            newVec.Data[2] = (float)(a.mData[2][0] * b.Data[0] +
                                     a.mData[2][1] * b.Data[1] +
                                     a.mData[2][2] * b.Data[2] +
                                     a.mData[2][3] * b.Data[3]);

            newVec.Data[3] = (float)(a.mData[3][0] * b.Data[0] +
                                     a.mData[3][1] * b.Data[1] +
                                     a.mData[3][2] * b.Data[2] +
                                     a.mData[3][3] * b.Data[3]);

            return(newVec);
        }
Пример #2
0
        public void set(Vec4f vec)
        {
            if (vec == null)
            {
                throw new ArgumentNullException("Paramter vec can't be null!");
            }

            set(vec.X, vec.Y, vec.Z, vec.W);
        }
Пример #3
0
        public bool Equal(Vec4f b)
        {
            if (this == b)
            {
                return(true);
            }

            if ((this - b).isNull())
            {
                return(true);
            }

            return(false);
        }
Пример #4
0
 public float getDistance(Vec4f value)
 {
     return((this - value).Length);
 }
Пример #5
0
 public Vec4f(Vec4f data)
     : this()
 {
     this.set(data);
 }