-
Notifications
You must be signed in to change notification settings - Fork 2
/
nrbreverse.m
41 lines (34 loc) · 845 Bytes
/
nrbreverse.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function rnrb = nrbreverse(nrb)
%
% Function Name:
%
% nrbreverse - Reverse the evaluation direction of a NURBS curve or surface.
%
% Calling Sequence:
%
% rnrb = nrbreverse(nrb);
%
% Parameters:
%
% nrb : NURBS data structure, see nrbmak.
%
% rnrb : Reversed NURBS.
%
% Description:
%
% Utility function to reverse the evaluation direction of a NURBS
% curve or surface.
% D.M. Spink
% Copyright (c) 2000.
if nargin ~= 1
error('Incorrect number of input arguments');
end
if iscell(nrb.knots)
% reverse a NURBS surface
coefs = nrb.coefs(:,:,end:-1:1);
rnrb = nrbmak(coefs(:,end:-1:1,:), {1.0-fliplr(nrb.knots{1}),...
1.0-fliplr(nrb.knots{2})});
else
% reverse a NURBS curve
rnrb = nrbmak(fliplr(nrb.coefs), 1.0-fliplr(nrb.knots));
end