⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 srf_transform.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function hfile = srf_Transform(hfile, mat44)
% SRF::Transform  - apply 4x4 transformation matrix to coordinates/normals
%
% FORMAT:       [srf] = srf.Transform(mat44)
%
% Input fields:
%
%       mat44       4x4 affine transformation matrix
%
% Output fields:
%
%       srf         altered object

% Version:  v0.7b
% Build:    7090215
% Date:     Sep-15 2007, 3:33 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 2 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'srf') || ...
   ~isa(mat44, 'double') || ...
    numel(size(mat44)) ~= 2 || ...
    any(size(mat44) ~= 4) || ...
    any(isinf(mat44(:)) | isnan(mat44(:)))
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end
bc = bvqxfile_getcont(hfile.L);

% apply transformations
v = bc.VertexCoordinate;
v = v - repmat(bc.MeshCenter, [size(v, 1), 1]);
v(:, 4) = 1;
n = bc.VertexNormal;
v = (mat44 * v')';
n = (mat44(1:3, 1:3) * n')';

% put back in hfile
bc.VertexCoordinate = v(:, 1:3) + repmat(bc.MeshCenter, [size(v, 1), 1]);
bc.VertexNormal = n;
bvqxfile_setcont(hfile.L, bc);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -