소개글
공학자에 필요한 CAD 기초지식
목차
1.Matlab Code for the Bezier Surface
2.Examples
3.Catia`s Surface
본문내용
B. In matlab, implement a program to compute and display the resulting Bezier surface
patches.
clear;
u=linspace(0,1,11);
v=linspace(0,1,11);
H=13,L=200;
%patch1
x(:,:,1,1)=[0 100/3 200/3 100; 0 100/3 200/3 100; 0 100/3 200/3 100; 0 100/3 200/3 100];
x(:,:,2,1)=[45 45 42 39; (45-H)*2/3+H (45-H)*2/3+H (90+H)/6+13 26;(45-H)/3+H (45-H)/3+H
(45+2*H)/6+6.5 13;H H H/2 0];
x(:,:,3,1)=[32 32 16 0;(L-32)/3+32 (L-32)/3+32 (L-16)/3+16 L/3;(L-32)*2/3+32 (L-32)*2/3+32 (L-
16)*2/3+16 2*L/3; L L L L];
%patch2
x(:,:,1,2)=[0 -100/3 -200/3 -100; 0 -100/3 -200/3 -100; 0 -100/3 -200/3 -100; 0 -100/3 -200/3 -100];
x(:,:,2,2)=x(:,:,2,1);
x(:,:,3,2)=x(:,:,3,1);
N=2;
t=cputime;
for m=1:N
for i=1:11
for j=1:11
b=u(i); a=1-b;
M1=[a^3 3*a^2*b 3*a*b^2 b^3];
d=v(j); c=1-d;
M2=[c^3 3*c^2*d 3*c*d^2 d^3]`;
for k=1:3
p(i,j,k,m)=M1*x(:,:,k,m)*M2;
end
end
end
end
% section for display
figure(1)
hold on
grid on
axis equal
for i=1:N
for j=1:4
plot3(x(j,:,1,i),x(j,:,2,i),x(j,:,3,i))
plot3(x(:,j,1,i),x(:,j,2,i),x(:,j,3,i))
end
i=1;j=1;
end
for i=1:N
for j=1:11
plot3(p(j,:,1,i),p(j,:,2,i),p(j,:,3,i),`R`)
참고 자료
없음