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

📄 nrbtform.m

📁 非均匀有理B样条的matlab程序
💻 M
字号:
function nurbs = nrbtform(nurbs,tmat)
% 
% Function Name:
% 
%   nrbtform - Apply transformation matrix to the NURBS.
% 
% Calling Sequence:
% 
%   tnurbs = nrbtform(nurbs,tmatrix);
% 
% Parameters:
% 
%   nurbs	: NURBS data structure (see nrbmak for details).
% 
%   tmatrix     : Transformation matrix, a matrix of size (4,4) defining
%                 a single or multiple transformations.
% 
%   tnurbs	: The return transformed NURBS data structure.
% 
% Description:
% 
%   The NURBS is transform as defined a transformation matrix of size (4,4),
%   such as a rotation, translation or change in scale. The transformation
%   matrix can define a single transformation or multiple series of
%   transformations. The matrix can be simple constructed by the functions
%   vecscale, vectrans, vecrotx, vecroty, and vecrotz.
%     
% Examples:
% 
%   Rotate a square by 45 degrees about the z axis.
%
%   rsqr = nrbtform(nrbrect(), vecrotz(deg2rad(45)));
%   nrbplot(rsqr, 10);
% 
% See:
% 
%   vecscale, vectrans, vecrotx, vecroty, vecrotz

%  D.M. Spink
%  Copyright (c) 2000

if nargin < 2
  error('Not enough input arguments!');
end;

if iscell(nurbs.knots)
  % NURBS is a surface
  [dim,nu,nv] = size(nurbs.coefs);
  nurbs.coefs = reshape(tmat*reshape(nurbs.coefs,dim,nu*nv),[dim nu nv]);
else
  % NURBS is a curve
  nurbs.coefs = tmat*nurbs.coefs;
end

⌨️ 快捷键说明

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