Algumas super quadricas

Superquadricas em Octave

Super torus

function supertoroid(epsilon,a)
  n=50;
  d=.1;
  etamax=pi;
  etamin=-pi;
  wmax=pi;
  wmin=-pi;
  deta=(etamax-etamin)/n;
  dw=(wmax-wmin)/n;
  k=0;
  l=0;
  for i=1:n+1
    eta(i)=etamin+(i-1)*deta;
    for j=1:n+1
      w(j)=wmin+(j-1)*dw;
      x(i,j)=a(1)*(a(4)+sign(cos(eta(i)))*abs(cos(eta(i)))^epsilon(1))*sign(cos(w(j)))*abs(cos(w(j)))^epsilon(2);
      y(i,j)=a(2)*(a(4)+sign(cos(eta(i)))*abs(cos(eta(i)))^epsilon(1))*sign(sin(w(j)))*abs(sin(w(j)))^epsilon(2);
      z(i,j)=a(3)*sign(sin(eta(i)))*abs(sin(eta(i)))^epsilon(1);
    endfor;
  endfor;
  surfl(x,y,z)
  colormap(bone);
  axis off square;
endfunction;

Super elipsóides

function retval=superellipse(epsilon,a)
  n=50;
  etamax=pi/2;
  etamin=-pi/2;
  wmax=pi;
  wmin=-pi;
  deta=(etamax-etamin)/n;
  dw=(wmax-wmin)/n;
  k=0;
  l=0;
  for i=1:n+1
    eta(i)=etamin+(i-1)*deta;
    for j=1:n+1
      w(j)=wmin+(j-1)*dw;
      x(i,j)=a(1)*sign(cos(eta(i)))*abs(cos(eta(i)))^epsilon(1)*sign(cos(w(j)))*abs(cos(w(j)))^epsilon(2);
      y(i,j)=a(2)*sign(cos(eta(i)))*abs(cos(eta(i)))^epsilon(1)*sign(sin(w(j)))*abs(sin(w(j)))^epsilon(2);
      z(i,j)=a(3)*sign(sin(eta(i)))*abs(sin(eta(i)))^epsilon(1);
    endfor;
  endfor;
  surfl(x,y,z)
  colormap(bone);
  axis off square;
endfunction;

Os comandos para fazer as figuras são:

k=1;
n=4;
epsilon=linspace(.01,3,n)

for i=1:n
  for j=1:n
    axis off square
    subplot (n,n, k)
    supertoroid([epsilon(i) epsilon(j)], [1 1 1 3])
#    superellipse([epsilon(i) epsilon(j)], [1 1 1])
    k=k+1;
  endfor;
  axis off square
endfor;
Palavras chave/keywords: Octave, superquadrics

Última actualização/Last updated: 2014-02-20 [14:39]


1999-2014 (ç) Tiago Charters de Azevedo

São permitidas cópias textuais parciais/integrais em qualquer meio com/sem alterações desde que se mantenha este aviso.

Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.