/// <summary> /// Provides perspective projection matrix. /// The parameters describe the dimensions of the view volume. /// </summary> public static M4__x4t__ PerspectiveProjectionTransformRH(V__x2t__ size, __ft__ n, __ft__ f) { __ft__ w = size.X; __ft__ h = size.Y; // Fx 0 0 0 // 0 Fy 0 0 // 0 0 A B // 0 0 -1 0 __ft__ Fx = 2 * n / w; __ft__ Fy = 2 * n / h; __ft__ A = f / (n - f); __ft__ B = n * f / (n - f); M4__x4t__ P = new M4__x4t__( Fx, 0, 0, 0, 0, Fy, 0, 0, 0, 0, A, B, 0, 0, -1, 0); return(P); }
/// <summary> /// Returns the outer product (tensor-product) of v1 * v2^T as a 3x3 Matrix. /// </summary> public static M2__x2t__ OuterProduct(this V__x2t__ v1, V__x2t__ v2) { return(new M2__x2t__( v2.X * v1.X, v2.Y * v1.X, v2.X * v1.Y, v2.Y * v1.Y)); }
/// <summary> /// Multiplacation of a <see cref="Scale__x3t__"/> with a <see cref="V__x2t__"/>. /// </summary> public static V__x2t__ Multiply(Scale__x3t__ scale, V__x2t__ v) { return(new V__x2t__(v.X * scale.X, v.Y * scale.Y)); }