File:Torus illustration.png

Original file (900 × 594 pixels, file size: 147 KB, MIME type: image/png)

Summary

Description Illustration of torus
Date (UTC)
Source Own work
Author Oleg Alexandrov
Other versions Derivative works of this file:  Infobox torus.png
PNG development
InfoField
 This diagram was created with MATLAB.

Licensing

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

Source code

% illustration of a torus, obtained as an isosurface
function main()

   % big and small radii of the torus
   R = 3; r = 1; 

   Kb = R+r;
  
   h = 0.1; % h is the grid size. Smaller h means prettier picture.
   
   X = (-Kb-h):h:(Kb+h);   m = length(X);
   Y = (-Kb-h):h:(Kb+h);   n = length(Y);
   Z = (-r-h):h:(r+h);     k = length(Z);
 
   W = zeros(m, n, k); % the zero level set of this function will be the desired shape
 
   for i=1:m
      for j=1:n
         x = X(i);
         y = Y(j); 
         W(i, j, :) = (sqrt(x^2+y^2)-R)^2 + Z.^2-r^2; % torus eqn, vectorize in Z
      end
   end

   figure(4); clf; hold on; axis equal; axis off;

   H = patch(isosurface(W, 0));
   isonormals(W, H);
      
   light_green=[184, 224, 98]/256;

   % set some propeties
   set(H, 'FaceColor', light_green, 'EdgeColor','none', 'FaceAlpha', 1);
   set(H, 'SpecularColorReflectance', 0.1, 'DiffuseStrength', 0.8);
   set(H, 'FaceLighting', 'phong', 'AmbientStrength', 0.3);
   set(H, 'SpecularExponent', 108);

   daspect([1 1 1]);
   axis tight;
   colormap(prism(28))
      
  % viewing angle
   view(-146, 32);

  % add in a source of light
   camlight (-10, 54); lighting phong;

  %save as png
  print('-dpng', '-r400', sprintf('Torus_illustration.png'));

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

torus

color: green

creator

some value

author name string: Oleg Alexandrov
Wikimedia username: Oleg Alexandrov

copyright status

copyrighted, dedicated to the public domain by copyright holder

copyrighted

copyright license

released into the public domain by the copyright holder

inception

13 July 2008

media type

image/png

data size

150,645 byte

height

594 pixel

width

900 pixel

checksum

40b8981eb5d3c98f12109b57b0f281e7a0f6dbc0

determination method or standard: SHA-1

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current01:12, 13 July 2008Thumbnail for version as of 01:12, 13 July 2008900 × 594 (147 KB)Oleg Alexandrov{{Information |Description=Illustration of torus |Source=self-made, with MATLAB |Date=~~~~~ |Author= Oleg Alexandrov }} {{PD-self}} ==Source code== <source lang="matlab"> % illustration of a torus, o

Global file usage

The following other wikis use this file:

View more global usage of this file.