예제 #1
0
파일: Vec4.cs 프로젝트: kuviman/Q
 public static Vec4 Clamp(Vec4 a, double maxlen)
 {
     if (a.Length <= maxlen)
     {
         return(a);
     }
     else
     {
         return(a.Unit * maxlen);
     }
 }
예제 #2
0
        public static Vec4 operator *(Mat4 a, Vec4 v)
        {
            Vec4 res = new Vec4();

            for (int i = 0; i < 4; i++)
            {
                for (int t = 0; t < 4; t++)
                {
                    res[i] += a[i, t] * v[t];
                }
            }
            return(res);
        }
예제 #3
0
파일: Vec4.cs 프로젝트: kuviman/Q
 public static double Dot(Vec4 a, Vec4 b)
 {
     return(a.X * b.X + a.Y * b.Y + a.Z * b.Z + a.W * b.W);
 }