📄 torsade.m
字号:
function out = torsade(nbr,angle,loops,width)
% The function:
%
% out = torsade(nbr,angle,loops,width)
%
% generates a 3-dimensional database with <nbr> elements.
% These elements draw a circular twisted ribbon (with
% diameter = 2.0);
% The optional parameter <angle> gives the number of
% revolution; for example, 0.5 gives an half circle
% ribbon; default value is 1.0.
% The optional parameter <loops> gives the number of
% ribbon "twists" for <angle> revolutions;
% default value is 0.5.
% The optional parameter <width> gives the width of the
% ribbon; default value is 0.5.
% The call by default:
%
% torsade(nbr)
%
% generates a moebius ribbon.
if nargin<2, angle = 1.0; end;
if nargin<3, loops = 0.5; end;
if nargin<4, width = 0.5; end;
a1 = 2*pi*angle*rand([nbr,1]);
a2 = loops/angle*a1;
w1 = width*(0.5-rand([nbr,1]));
out = zeros([nbr,3]);
out(:,1) = (1+w1.*cos(a2)) .* cos(a1);
out(:,2) = (1+w1.*cos(a2)) .* sin(a1);
out(:,3) = w1.*sin(a2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -