public static Vec4 Clamp(Vec4 a, double maxlen) { if (a.Length <= maxlen) { return(a); } else { return(a.Unit * maxlen); } }
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); }
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); }