program no_c; { Constroi um "no' de cilindros" } uses PointOp,ListOp; var OldP: tPoint; f: text; {$F+ } procedure WrCylinder(P: tPoint); var Q: tPoint; begin Q.NewPoint(0,0,0); if OldP.next <> nil then begin PMedio(OldP,P,Q); with OldP do begin write(f,'cylinder{'); WrPoint(f); write(f,','); end; with Q do begin WrPoint(f);writeln(f,', 0.7 open }') end end; OldP:=P; OldP.next:=@P; end; procedure WrCylinders(L:tPointPtr); begin OldP.NewPoint(0,0,0); NPassos(L,30,WrCylinder,f); end; procedure WrCyls(L:tPointPtr); var L1,L2,Laux: tPointPtr; begin writeln(f,'#declare no3 = union {'); writeln(f,'// ****** Lista dos cilindros '); WrCylinders(L); lXRotate(L,90); lZRotate(L,90); WrCylinders(L); lXRotate(L,90); lZRotate(L,90); WrCylinders(L); (* writeln(' finish { phong 1 }'); *) writeln(f,'// ***********************'); writeln(f,'}'); end; (***********************************************************) procedure FazNo; const a:real=1.0; { largura do cubo } k: real=8; { distancia para os pontos de controle } n: integer = 128; var L1,L2: tPointPtr; begin assign(f,'no_c.inx'); rewrite(f); L1:=nil; { insere em L1 os 4 pontos de controle, criados a partir de um cubo } lInsertNewPoint(L1,-a,a,0); lInsertNewPoint(L1,-a,a,k); lInsertNewPoint(L1,a,-k,-a); lInsertNewPoint(L1,a, 0,-a); { lWrList(L1); readln; } L2:=Bezier(L1, n); { lWrList(L2); readln; } WrCyls(L2); close(f) end; begin { main } FazNo; end.