public TRSRTransformation getUVLockTransform(EnumFacing originalSide) { EnumFacing newSide = rotate(originalSide); try { return blockCenterToCorner(vanillaUvTransformGlobalToLocal.get(originalSide).compose(blockCornerToCenter(this.inverse())).compose(vanillaUvTransformLocalToGlobal.get(newSide))); } catch(SingularMatrixException e) { return new TRSRTransformation(null, null, new Vector3f(0, 0, 0), null); } }
/** * 連立一次方程式mat*x=bを解きます. * * 行列matの中身は保持されないことに注意してください. * * @param mat * @param b * @param x * @throws SingularMatrixException */ public static void solve(GfMatrix mat, GfVector b, GfVector x) throws SingularMatrixException { // LU分解その1 GfVector perm = new GfVector(mat.getNumRow()); mat.LUD(mat, perm); x.LUDBackSolve(mat, b, perm); // 逆行列(中身はLU分解) // jacobi.invert(); // x.mul(mat, b); }
/** * 連立一次方程式mat*x=bを解きます. その2. */ public static int solve2(GfMatrix mat, GfVector b, GfVector x) throws SingularMatrixException { int rows = mat.getNumRow(); int cols = mat.getNumCol(); GfMatrix u = new GfMatrix(rows, rows); GfMatrix w = new GfMatrix(rows, cols); GfMatrix v = new GfMatrix(cols, cols); int rank = mat.SVD(u, w, v); x.SVDBackSolve(u, w, v, b); return rank; }