File:Moment of inertia solid cylinder.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 200 × 223 pixels, file size: 16 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Illustration of the moment of inertia of a solid cylinder.
    Date
    Source SVG rendering of the program used to generate the bitmap image Image:Moment_of_inertia_solid_cylinder.png
    Author
    • Original MetaPost program by en:User:Grendelkhan
    • Program tweaked to avoid negative coordinates in PostScript output and rendered as SVG by Qef
    • Swap x and y axis to give right handed coordinate system by billingd on 2017-05-20
    Other versions Bitmap rendering of almost identical program: Image:Moment_of_inertia_solid_cylinder.png
    SVG development
    InfoField
     The SVG code is valid.
     This vector image was created with MetaPost.
    Source code
    InfoField

    PostScript code

    metapost-source
    prologues := 3;
    
    u=18mm;
    textscale=u/12mm;
    
    def cylinder =
      begingroup;
      save pmax,dmax,persp,persp_nt,arr;
      save harrtop,harrbot,rarrlft,rarrrt;
      save p,d;
      save axisprotrusion;
      save xax,yax,zax;
      pmax = 3; dmax = 0;
      persp_nt = 0.3;
      persp = persp_nt*u;
      arr = 0.2u; % how far to offset the arrows from the diagram
      axisprotrusion = 1u;  % how far do the axes protrude?
      pair harrtop,harrbot,rarrlft,rarrrt; % endpoints for arrows
      path p[],d[]; % original, dotted
      pair xax[],yax[],zax[]; % x,y,z are taken; these are for the axes
      % solid paths
      p0 = (-1u,-1u)--(-1u,1u);
      p1 = (1u,-1u)--(1u,1u);
      p2 = fullcircle scaled u xscaled 2 yscaled (2*persp_nt) shifted (0,1u);
      p3 = halfcircle scaled u xscaled 2 yscaled (2*persp_nt) rotated 180 shifted (0,-1u);
      % dashed paths
      d0 = halfcircle scaled u xscaled 2 yscaled (2*persp_nt) shifted (0,-1u);
      % endpoints of dimension arrows
      harrtop = (-1u-arr,1u);
      harrbot = (-1u-arr,-1u);
      rarrlft = (0,1u);
      rarrrt = (1u,1u);
    
      % actually draw
      pickup pencircle scaled 1pt;
      for i=0 upto pmax:
        draw p[i];
      endfor;
      for i=0 upto dmax:
        draw d[i] dashed evenly;
      endfor;
      drawdblarrow (harrtop..harrbot);
      drawdblarrow (rarrlft..rarrrt);
      label.lft(btex $h$ etex scaled textscale,.5[harrtop,harrbot]);
      label.top(btex $r$ etex scaled textscale,.5[rarrlft,rarrrt]);
      % x axis
      xax0 = (0,0);
      xax1 = point 1.5 of p3 shifted (0,1u);
      xax2 = (1.+axisprotrusion/u)[xax0,xax1];
      drawarrow (xax1..xax2);
      draw xax0..xax1 dashed evenly;
      label.rt(btex $y$ etex scaled textscale,xax2);
      % y axis
      yax0 = (0,0);
      yax1 = (1u,0);
      yax2 = (1u+axisprotrusion*0.5,0);
      drawarrow (yax1..yax2);
      draw yax0..yax1 dashed evenly;
      label.top(btex $x$ etex scaled textscale,yax2);
      % z axis
      zax0 = (0,0);
      zax1 = (0,1u);
      zax2 = (0,1u+axisprotrusion);
      drawarrow (zax1..zax2);
      draw zax0..zax1 dashed evenly;
      label.top(btex $z$ etex scaled textscale,zax2);
      endgroup;
    enddef;
    
    beginfig(1)
      cylinder;
      currentpicture := currentpicture shifted (100,100); % avoid unwanted clipping
    endfig;
    end
    

    Data

    mpost fig.mp
    ps2pdf -dEPSCrop fig.1 fig.pdf
    #pstoedit -page 1 -dt -xscale 2 -yscale 2 -f sk fig.pdf fig.sk
    #inkscape -z --vacuum-defs -f fig.sk -l fig.svg
    pdf2svg fig.pdf fig.svg
    

    Licensing

    Grendelkhan at the English Wikipedia, the copyright holder of this work, hereby publishes it under the following license:
    GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
    Attribution:
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
    This licensing tag was added to this file as part of the GFDL licensing update.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    9 July 2008

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current15:45, 19 May 2017Thumbnail for version as of 15:45, 19 May 2017200 × 223 (16 KB)wikimediacommons>BillingdUpdate metapost code to swap x and y axes to give a right handed coordinate system. Regenerate svg.

    There are no pages that use this file.