示例#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);
 }