Archivo:Signed distance2.png

De testwiki
Ir a la navegación Ir a la búsqueda
    Archivo original (1025 × 1856 píxeles; tamaño de archivo: 38 kB; tipo MIME: image/png)

    Este archivo es de Wikimedia Commons y puede usarse en otros proyectos. La descripción en su página de descripción del archivo se muestra debajo.

    Resumen

    Descripción
    English: Signed distance
    Fecha
    Fuente Trabajo propio
    Autor Oleg Alexandrov
    PNG desarrollo
    InfoField
     Este diagrama fue creado con MATLAB

    Licencia

    Public domain Yo, el titular de los derechos de autor de esta obra, lo libero al dominio público. Esto aplica en todo el mundo.
    En algunos países esto puede no ser legalmente factible; si ello ocurriese:
    Concedo a cualquier persona el derecho de usar este trabajo para cualquier propósito, sin ningún tipo de condición al menos que éstas sean requeridas por la ley.

    Source code (MATLAB)

     
    
    function main ()
    
    % init stuff
       M=3;  lw=2.5;
       h=0.1; ii = sqrt(-1);
       XX = (-M):h:M; YY = (-M):h:M;
       [X, Y] = meshgrid (XX, YY);
    
    % the surfce determining the contour
       type = 2; % the contour is a circle for type == 1 and something more complex otherwise
    
       if type == 1
          height = 2;
          Z=height - X.^2-Y.^2;
       else
          height = 0.7;
          Z=height-0.5*(X-1.78).*X.^2.*(X+1.78)-Y.^2;  % Z=f(X, Y) -surface
       end
    
    % find the contour
    %figure(1); subplot(2, 1, 1);
       figure(1); clf;
       [C, H] = contour(X, Y, Z, [0, 0]);
       set(H, 'linewidth', lw, 'EdgeColor', [0;0;156]/256);
    
    % draw the region inside the contour
    %   figure(1); subplot(2, 1, 1);
       figure(1); 
       clf; hold on; axis equal; axis off; 
       
       l=C(2, 1);
       CX=C(1,2:(l+1));  CY=C(2,2:(l+1)); % get x and y of contours
       H=fill(CX, CY, 0.6*[1, 1, 1]); set(H, 'EdgeColor', 'none'); % draw the shap
    
       % a hack to make the box look bigger
       white = 0.99*[1, 1, 1]; scale=1.4;
       plot(-scale*M, -scale*M, '*', 'color', white)
       plot(scale*M, scale*M, '*', 'color', white)
       
    % calc the unsigned distance function
       Dist = 0*Z+1000;
       for i=1:length(XX)
          for j=1:length(YY)
    	 x=X(i, j); y=Y(i, j);
    	 for k=1:length(CX)
    	    x0=CX(k);
    	    y0=CY(k);
    	    Dist(i, j) = min(Dist(i, j), sqrt((x-x0)^2+(y-y0)^2));
    	 end
          end
       end
       
    
    % signed distance
       Dist = sign(Z).*Dist;
       
    % draw the signed distance
    %   figure(1); subplot(2, 1, 2);
       figure(2); clf;
       hold on; axis equal; axis off;
       surf(X, Y, Dist, 'FaceColor','red', 'EdgeColor','none', 'FaceAlpha', 1);
    
    % draw the x-y plane (the intersection of the surface above and this plane is the contour of our set)
       surf(X, Y, zeros(length(XX), length(YY)), 'FaceColor','blue', 'EdgeColor','none', 'FaceAlpha', 0.4)
       
       camlight left;lighting phong; % make nice lightning
       view(42, 22)        % angle of view (polar coordinates)
    
    % save to file
       figure(1);   saveas(gcf, sprintf('Set%d.eps', type), 'psc2');
       figure(2);   saveas(gcf, sprintf('Function%d.eps', type), 'psc2');
    
    % then use the following to convert to png
    %   convert -append Set2.eps Function2.eps signed_distance2.png
    
    Esta imagen debería volverse a crear como imágenes vectoriales SVG. Esto proporciona muchas ventajas, véase Commons:Media for cleanup (en inglés) para más información. Si ya hay una versión SVG de esta imagen disponible, por favor súbala a Commons. Tras subirla, reemplace esta plantilla con la plantilla {{vector version available|nuevo nombre de imagen.svg}} en esta imagen.

    Leyendas

    Añade una explicación corta acerca de lo que representa este archivo

    Elementos representados en este archivo

    representa a

    1856 píxel

    1025 píxel

    cdbf0d9a921d9bb04fe1a9b5fe7ca50592f3ff4d

    Historial del archivo

    Haz clic sobre una fecha y hora para ver el archivo tal como apareció en ese momento.

    Fecha y horaMiniaturaDimensionesUsuarioComentario
    actual00:48 1 may 2007Miniatura de la versión del 00:48 1 may 20071025 × 1856 (38 kB)wikimediacommons>Oleg Alexandrov{{Information |Description= |Source= |Date= |Author= }}

    No hay páginas que enlacen a este archivo.