From ab24fd6db3d071d64b532541740e53d4d43423b0 Mon Sep 17 00:00:00 2001 From: Juan Carlos Farah Date: Thu, 29 Jul 2021 12:19:37 +0200 Subject: [PATCH] feat: add invert transformation matrix operation --- .../operations/InvertTransformationMatrix.m | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/matlab/operations/InvertTransformationMatrix.m diff --git a/src/matlab/operations/InvertTransformationMatrix.m b/src/matlab/operations/InvertTransformationMatrix.m new file mode 100644 index 0000000..04c2777 --- /dev/null +++ b/src/matlab/operations/InvertTransformationMatrix.m @@ -0,0 +1,30 @@ +function [status, result] = InvertTransformationMatrix(pathToWorkspace, ... + params, ... + config) +%INVERTTRANSFORMATIONMATRIX Invert a transformation matrix. +% Uses `convert_xfm` with `inverse` to invert a transformation matrix. +% +% Input: +% - pathToWorkspace: Path to the workspace. +% - params: Parameters to be used in the operation. +% - config: Configuration to be used in the operation. +% +% Output: +% - status: Status returned by system call. +% - result: Result returned by system call. + +arguments + pathToWorkspace char = '.' + params.inputMatrix char = '' + params.outputMatrix char = '' + config.verbose logical = false +end + +fullInputMatrix = fullfile(pathToWorkspace, params.inputMatrix); +fullOutputMatrix = fullfile(pathToWorkspace, params.outputMatrix); + +command = 'convert_xfm -inverse %s -omat %s'; +sentence = sprintf(command, fullInputMatrix, fullOutputMatrix); +[status, result] = CallSystem(sentence, config.verbose); + +end