From 0168fec001c184256b49314a606a9113e14c819c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 09:01:06 +0000 Subject: [PATCH 1/2] Initial plan From 688dee116f394d577ef7741178855b8c76d08f58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 09:06:44 +0000 Subject: [PATCH 2/2] Implement makehgtform and improve camproj for Octave compatibility Co-authored-by: moyner <454871+moyner@users.noreply.github.com> --- core/utils/octave_only/builtin/camproj.m | 29 +++++- core/utils/octave_only/builtin/makehgtform.m | 101 ++++++++++++++++++- 2 files changed, 124 insertions(+), 6 deletions(-) diff --git a/core/utils/octave_only/builtin/camproj.m b/core/utils/octave_only/builtin/camproj.m index 55d7f1284..da0689fce 100644 --- a/core/utils/octave_only/builtin/camproj.m +++ b/core/utils/octave_only/builtin/camproj.m @@ -1,5 +1,21 @@ -function camproj() -%Undocumented Utility Function +function varargout = camproj(varargin) +%Set or get camera projection mode (Octave stub) +% +% SYNOPSIS: +% camproj('perspective') +% camproj('orthographic') +% mode = camproj() +% +% DESCRIPTION: +% Octave-compatible stub for camproj. This function provides basic +% compatibility but does not actually change the camera projection in +% Octave, as this feature is not fully supported. The function silently +% accepts the commands without error to allow scripts to run. +% +% NOTE: +% In Octave, perspective vs orthographic projection may not be fully +% supported or may behave differently than in MATLAB. This stub allows +% code to run without errors, but visual output may differ. %{ Copyright 2009-2024 SINTEF Digital, Mathematics & Cybernetics. @@ -20,5 +36,12 @@ This file is part of The MATLAB Reservoir Simulation Toolbox (MRST). along with MRST. If not, see . %} - warning("camproj not implemented in octave") + % Silently accept the command + % In Octave, camera projection mode is not fully implemented + % This stub allows scripts to run without errors + + if nargout > 0 + % If output is requested, return 'orthographic' as default + varargout{1} = 'orthographic'; + end end diff --git a/core/utils/octave_only/builtin/makehgtform.m b/core/utils/octave_only/builtin/makehgtform.m index b8580ebf6..99a539de3 100644 --- a/core/utils/octave_only/builtin/makehgtform.m +++ b/core/utils/octave_only/builtin/makehgtform.m @@ -1,5 +1,22 @@ -function makehgtform() -%Undocumented Utility Function +function T = makehgtform(varargin) +%Create 4x4 transformation matrix for graphics +% +% SYNOPSIS: +% T = makehgtform('xrotate', angle) +% T = makehgtform('yrotate', angle) +% T = makehgtform('zrotate', angle) +% +% DESCRIPTION: +% Octave-compatible implementation of makehgtform for basic rotations. +% Creates a 4x4 homogeneous transformation matrix for graphics objects. +% +% PARAMETERS: +% 'xrotate', angle - Rotation around X-axis by angle (in radians) +% 'yrotate', angle - Rotation around Y-axis by angle (in radians) +% 'zrotate', angle - Rotation around Z-axis by angle (in radians) +% +% RETURNS: +% T - 4x4 homogeneous transformation matrix %{ Copyright 2009-2024 SINTEF Digital, Mathematics & Cybernetics. @@ -20,5 +37,83 @@ This file is part of The MATLAB Reservoir Simulation Toolbox (MRST). along with MRST. If not, see . %} - error('toimplement') + % Initialize as identity matrix + T = eye(4); + + % Process arguments + i = 1; + while i <= length(varargin) + arg = varargin{i}; + + if ischar(arg) + switch lower(arg) + case 'xrotate' + if i+1 <= length(varargin) + angle = varargin{i+1}; + T = T * xrotation_matrix(angle); + i = i + 2; + else + error('makehgtform:MissingAngle', ... + 'xrotate requires an angle argument'); + end + + case 'yrotate' + if i+1 <= length(varargin) + angle = varargin{i+1}; + T = T * yrotation_matrix(angle); + i = i + 2; + else + error('makehgtform:MissingAngle', ... + 'yrotate requires an angle argument'); + end + + case 'zrotate' + if i+1 <= length(varargin) + angle = varargin{i+1}; + T = T * zrotation_matrix(angle); + i = i + 2; + else + error('makehgtform:MissingAngle', ... + 'zrotate requires an angle argument'); + end + + otherwise + error('makehgtform:UnsupportedTransform', ... + 'Transformation ''%s'' not implemented in Octave version', arg); + end + else + error('makehgtform:InvalidArgument', ... + 'Expected string transformation type'); + end + end +end + +function T = xrotation_matrix(angle) + % Rotation around X-axis + c = cos(angle); + s = sin(angle); + T = [1, 0, 0, 0; + 0, c, -s, 0; + 0, s, c, 0; + 0, 0, 0, 1]; +end + +function T = yrotation_matrix(angle) + % Rotation around Y-axis + c = cos(angle); + s = sin(angle); + T = [ c, 0, s, 0; + 0, 1, 0, 0; + -s, 0, c, 0; + 0, 0, 0, 1]; +end + +function T = zrotation_matrix(angle) + % Rotation around Z-axis + c = cos(angle); + s = sin(angle); + T = [c, -s, 0, 0; + s, c, 0, 0; + 0, 0, 1, 0; + 0, 0, 0, 1]; end