close
Jump to content

File:Hyperbolic rotation.gif

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia
    Original file (512 × 512 pixels, file size: 24 KB, MIME type: image/gif, looped, 18 frames, 4.0 s)

    Summary

    Description Hyperbolic sectors of equal area are permuted by hyperbolic rotation to 10 positions. This animated GIF was requested at http://en.wikipedia.org/w/index.php?title=Wikipedia:Graphics_Lab/Illustration_workshop&diff=prev&oldid=1299170533 .
    Source Own work
    Author Cmglee

    Python source code

    #!/usr/bin/env python
    PATH_INKSCAPE = r'C:\APP\inkscape122\bin\inkscape.exe'
    DIR_OUT       = r'F:\gif'
    WIDTH_OUT     = 512
    SCALE         = 100
    N_FRAME       = 10
    FORMAT_SVG    = '''\
    <?xml version="1.0"?>
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-10 -290 300 300">
     <circle r="999" fill="#fff"/>
     <g fill="none" stroke="#000">
      <path id="axis" d="M -9,0 H 288 m -7,-4 l 7,4 l -7,4"/>
      <use xlink:href="#axis" transform="matrix(0,-1 1,0 0,0)"/>
      <path d="{out_d}" fill="#fc0"/>
      <path d="M 5,-2000 Q 0,-360 50,-200 C 70,-114 114,-70 200,-50 Q 360,0 2000,-5" fill="#fff"/>
     </g>
    </svg>
    '''
    import re, math, subprocess
    def system(command, cwd='./', is_verbose=False):
     if is_verbose: print('%s %s' % (cwd, command))
     return subprocess.Popen(command, stdout=subprocess.PIPE, cwd=cwd,
                             shell=True).communicate()[0].decode('utf-8')
    def fmt(string): ## string.format(**vars()) using tags {expression!format} by CMG Lee
     def f(tag): i_sep = tag.rfind('!'); return (re.sub('\.0$', '', str(eval(tag[1:-1])))
      if (i_sep < 0) else ('{:%s}' % tag[i_sep + 1:-1]).format(eval(tag[1:i_sep])))
     return (re.sub(r'(?<!{){[^{}]+}', lambda m:f(m.group()), string)
             .replace('{{', '{').replace('}}', '}'))
    
    path_prefix = r'%s\%s' % (DIR_OUT, os.path.basename(os.path.splitext(__file__)[0]))
    for n in range(N_FRAME):
     a        = math.exp(n / 5.0 - 1)
     b        = math.exp(n / 5.0 - 0.8)
     out_d    = 'M %.0f,%.0f L 0,0 L %.0f,%.0f' % (SCALE * a, -SCALE / a,
                                                   SCALE * b, -SCALE / b)
     path_svg = '%s%02d.svg' % (path_prefix, n)
     path_png = '%s%02d.png' % (path_prefix, n)
     with open(path_svg, 'w') as f: f.write(fmt(FORMAT_SVG))
     system('%s -o %s -w %d %s' % (PATH_INKSCAPE, path_png, WIDTH_OUT, path_svg), is_verbose=True)
    for n in range(1, N_FRAME - 1):
     path_svg = '%s%02d.svg' % (path_prefix, n)
     path_png = '%s%02d.png' % (path_prefix, N_FRAME * 2 - 2 - n)
     system('%s -o %s -w %d %s' % (PATH_INKSCAPE, path_png, WIDTH_OUT, path_svg), is_verbose=True)
    ## Then drag PNGs into http://ezgif.com/maker and then Optimize at Compression
    ##  level: 200, Eliminate local color tables, Reduce the number of colors to 4
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following licenses:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    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.
    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.
    You may select the license of your choice.

    Captions

    Hyperbolic sectors of equal area are permuted by hyperbolic rotation to 10 positions.

    Items portrayed in this file

    depicts

    24,189 byte

    512 pixel

    512 pixel

    image/gif

    3ad6c4011c067ca64552035d08f3c366f5dc4333

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current16:04, 19 July 2025Thumbnail for version as of 16:04, 19 July 2025512 × 512 (24 KB)CmgleeLinger on end stops
    15:43, 19 July 2025Thumbnail for version as of 15:43, 19 July 2025512 × 512 (24 KB)Cmglee{{Information |Description=GIF animation requested at http://en.wikipedia.org/w/index.php?title=Wikipedia:Graphics_Lab/Illustration_workshop&diff=prev&oldid=1299170533 |Source={{own}} |Date= |Author= Cmglee |Permission= |other_versions= }} Category:Animated GIF files Category:Hyperbola (rational function)

    Global file usage

    The following other wikis use this file:

    Metadata