Esempio n. 1
0
 static void MyVecNorm()
 {
     for (var i = 0; i < ArraySize; i++)
     {
         mvY[i] = MyVec.Normalize(mvX[i]);
     }
 }
Esempio n. 2
0
        public static MyVec Normalize(MyVec v)
        {
#if NO_MATHF
            var s = 1.0f / (float)Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z + v.W * v.W);
#else
            var s = 1.0f / MathF.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z + v.W * v.W);
#endif
            return(new MyVec
            {
                X = v.X * s,
                Y = v.Y * s,
                Z = v.Z * s,
                W = v.W * s,
            });
        }