/// <summary> /// Sets the parameter's value. /// </summary> /// <param name="pValue">A pointer to the buffer that contains the value to set.</param> /// <param name="count">The number of elements in the array to set.</param> public void SetValue(Mat3x2 *pValue, Int32 count) { SetMatrixArrayValueInternal <Mat3x2>((IntPtr)pValue, count, (ptr, index) => Mat3x2.Transpose(ref ((Mat3x2 *)ptr)[index], out ((Mat2x3 *)ptr)[index]), (ptr, index) => Mat2x3.Transpose(ref ((Mat2x3 *)ptr)[index], out ((Mat3x2 *)ptr)[index]), (l, c, t, v) => gl.UniformMatrix3x2fv(l, c, t, (Single *)v)); }
public static void Multiply(ref Mat2x3 matrix1, ref Mat3x2 matrix2, out Mat2 result) { result.x.x = (matrix1.x.x * matrix2.x.x) + (matrix1.x.y * matrix2.y.x) + (matrix1.x.z * matrix2.z.x); result.x.y = (matrix1.x.x * matrix2.x.y) + (matrix1.x.y * matrix2.y.y) + (matrix1.x.z * matrix2.z.y); result.y.x = (matrix1.y.x * matrix2.x.x) + (matrix1.y.y * matrix2.y.x) + (matrix1.y.z * matrix2.z.x); result.y.y = (matrix1.y.x * matrix2.x.y) + (matrix1.y.y * matrix2.y.y) + (matrix1.y.z * matrix2.z.y); }
public static void Transpose(Mat2x3 matrix, out Mat3x2 result) { result.x.x = matrix.x.x; result.x.y = matrix.y.x; result.y.x = matrix.x.y; result.y.y = matrix.y.y; result.z.x = matrix.x.z; result.z.y = matrix.y.z; }
/// <summary> /// Solves the 2nd degree system of linear equations given in the following form: /// ax + by = c /// and /// wx + uy = v /// </summary> /// <returns>The solution [x,y] as a tuple, or null if no solution exists.</returns> public static Tuple <double, double> LinSolve(double a, double b, double c, double w, double u, double v) { var echelonMatrix = new Mat3x2(a, b, c, w, u, v); // try row swap if first pivot is zero if (IsZero(echelonMatrix[0, 0])) { echelonMatrix.RowSwap(); } // perform standard row operations if first pivot is not zero if (!IsZero(echelonMatrix[0, 0])) { echelonMatrix.RowMultiply(0, 1 / echelonMatrix[0, 0]); echelonMatrix.RowAdd(0, 1, -echelonMatrix[1, 0]); } // check for inconsistency on second row if (echelonMatrix.IsRowInconsistent(1)) { return(null); } // normalize second row if and only if the second pivot is non-zero if (!IsZero(echelonMatrix[1, 1])) { echelonMatrix.RowMultiply(1, 1 / echelonMatrix[1, 1]); } // perform last row operation to zero out (0, 1) echelonMatrix.RowAdd(1, 0, -echelonMatrix[0, 1]); // check for inconsistency on first row if (echelonMatrix.IsRowInconsistent(0)) { return(null); } // check first for infinite solutions if rows are all zero, otherwise return solution var s1 = double.PositiveInfinity; var s2 = double.PositiveInfinity; if (!echelonMatrix.IsRowUniform(0)) { s1 = echelonMatrix[0, 2]; } if (!echelonMatrix.IsRowUniform(1)) { s2 = echelonMatrix[1, 2]; } return(new Tuple <double, double>(s1, s2)); }
public Mat2x3 transpose(Mat3x2 matrix) { Mat2x3 result; result.x.x = matrix.x.x; result.x.y = matrix.y.x; result.x.z = matrix.z.x; result.y.x = matrix.x.y; result.y.y = matrix.y.y; result.y.z = matrix.z.y; return(result); }
/// <summary> /// Sets the parameter's value. /// </summary> /// <param name="value">The value to set.</param> public void SetValue(Mat3x2 value) { var transpose = gl.IsMatrixTranspositionAvailable; if (transpose) { gl.UniformMatrix3x2fv(location, 1, true, (Single *)&value); gl.ThrowIfError(); } else { Mat3x2.Transpose(ref value, out var valueTransposed); gl.UniformMatrix3x2fv(location, 1, false, (Single *)&valueTransposed); gl.ThrowIfError(); } }
public override void Update(Mat3x2 matrix, ShaderVariableMapping variable) { throw new NotImplementedException(); }
public override void Update(Mat3x2 matrix, int offset) { throw new NotImplementedException(); }
public abstract void Update(Mat3x2 matrix, ShaderVariableMapping variable);
public abstract void Update(Mat3x2 matrix, int offset);
public override unsafe void Update(Mat3x2 matrix, ShaderVariableMapping variable) { Orbital_Video_D3D12_ConstantBuffer_Update(handle, &matrix, (uint)Marshal.SizeOf <Mat3x2>(), (uint)variable.offset, activeNodeIndex); }
public override unsafe void Update(Mat3x2 matrix, int offset) { Orbital_Video_D3D12_ConstantBuffer_Update(handle, &matrix, (uint)Marshal.SizeOf <Mat3x2>(), (uint)offset, activeNodeIndex); }