%? Rotsurf (curve, dirct, orgin, alpha, fun) is used to draw revolving surfaces.
%? Curve =;
What if? Narkin & lt2
Direct =;
What if? Narkin & lt iv
direct=[0,0, 1];
end
end
end
end
X = extrusion (x);
Assert(ismatrix(X),' the format of parameter 1 is wrong! Please ask for help! );
Y = extrusion (y);
Assert(ismatrix(Y),' parameter 2 is in wrong format! Please ask for help! );
Z = extrusion (z);
Assert(ismatrix(Z),' parameter 3 is in wrong format! Please ask for help! );
assert(all(size(X)= = size(Y)& amp; Size(X)==size(Z)),' Parameter 1/2/3 must be equal in size! Please ask for help! );
Direct = extrusion (direct);
What if? Isempty (direct)
direct=[0,0, 1];
end
assert(numel(direct)==2? ||? Numel (direct) ==3,' Parameter 4 is in wrong format! Please ask for help! );
What if? Numel (direct) ==2
direct =[cos(direct(2))* cos(direct( 1))、cos(direct(2))* sin(direct( 1))、sin(direct(2))];
end
Direct=direct/norm (direct);
Point = squeeze (point);
What if? Isempty (point)
point=[0? 0? 0];
end
Assert(numel(point)==3,' parameter 5 is not in the correct format! Please ask for help! );
θ = extrusion (θ);
What if? isempty(θ)
theta=linspace(0,2*pi,37);
end
Assert (length (θ)= = numel(θ)? The format of parameter 6 is wrong! Please see help! ' );
F = extrusion (f);
What if? isempty(f)
f = @ mesh
end
What if? ischar(f)
Assert(length(f)==numel(f),' Parameter 7 is in wrong format! Please ask for help! );
f = str 2 func(f);
end
assert(numel(f)== 1? & amp& amp? Isa(f,' function_handle'),' parameter 7 is in wrong format! Please ask for help! );
X0 = point (1);
Y0 = point (2);
Z0 = point (3);
NX = direct( 1);
ny = direct(2);
NZ = direct(3);
Sint = sin(θ( 1));
Cost = cos (θ (1));
XX=(X-x0)。 *(nx^2*( 1-cost)+cost)+(y-y0).*(NX * ny *( 1-cost)-NZ * Sint)+(Z-z0)。 *(NX * NZ *( 1-cost)+ny * Sint)+x0;
YY=(X-x0)。 *(ny * NX *( 1-cost)+NZ * Sint)+(Y-y0)。 *(ny^2*( 1-cost)+cost)+(z-z0).*(ny * NZ *( 1-cost)-NX * Sint)+y0;
ZZ=(X-x0)。 *(NZ * NX *( 1-cost)-ny * Sint)+(Y-y0)。 *(NZ * ny *( 1- cost) +nx*sint)+(Z-z0). *(nz^2*( 1-cost)+cost)+z0;
hh=f(XX,YY,ZZ);
Keep? Open;
Sint = sin(θ(end));
Cost = cos (θ (end));
XX=(X-x0)。 *(nx^2*( 1-cost)+cost)+(y-y0).*(NX * ny *( 1-cost)-NZ * Sint)+(Z-z0)。 *(NX * NZ *( 1-cost)+ny * Sint)+x0;
YY=(X-x0)。 *(ny * NX *( 1-cost)+NZ * Sint)+(Y-y0)。 *(ny^2*( 1-cost)+cost)+(z-z0).*(ny * NZ *( 1-cost)-NX * Sint)+y0;
ZZ=(X-x0)。 *(NZ * NX *( 1-cost)-ny * Sint)+(Y-y0)。 *(NZ * ny *( 1- cost) +nx*sint)+(Z-z0). *(nz^2*( 1-cost)+cost)+z0;
g=f(XX,YY,ZZ);
hh=[hh,g];
g=rotsurf([X(:, 1),Y(:, 1),Z(:, 1)],direct,point,theta,f);
hh=[hh,g];
g=rotsurf([X(:,end),Y(:,end),Z(:,end)],direct,point,theta,f);
hh=[hh,g];
g=rotsurf([X( 1,); Y( 1,); Z( 1,:)、direct、point、theta、f);
hh=[hh,g];
g=rotsurf([X(end,); Y(end,); Z(end,:)、direct、point、theta、f);
hh=[hh,g];
What if? nargout== 1
h = hh
Endclear chroma control center
x=[0.03? 0.05];
z=linspace(0,3, 10);
[x,z]=meshgrid(x,z);
Rotating grid (x, x-x, z)