File:Triaugmented triangular prism (symmetric view).svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 440 × 413 pixels, file size: 650 bytes)

    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: Symmetric view of a triaugmented triangular prism
    Date
    Source Own work
    Author David Eppstein

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
    The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

    Source code

       import numpy, svg3d, pyrr, math
    
       midnum = 1+6**0.5
       midden = 2*3**0.5
       ort = 3**-0.5
       top = [(-1,-ort,1),(0,2*ort,1),(1,-ort,1)]
       mid = [(midnum/2,midnum/midden,0),(0,-2**0.5-ort,0),(-midnum/2,midnum/midden,0)]
       bot = [(-1,-ort,-1),(0,2*ort,-1),(1,-ort,-1)]
    
       def step(i):
           i += 1
           if i % 3 == 0:
               i -= 3
           return i
    
       def rot(a,b,c):
           out=a,b,c
           a,b,c = step(a),step(b),step(c)
           out += a,b,c
           a,b,c = step(a),step(b),step(c)
           out += a,b,c
           return out
    
       def get_faces():
           verts = numpy.float32(top+mid+bot)
           triangles = [[0,1,2],[6,7,8]]+rot(0,1,5)+rot(6,7,5)+rot(0,6,4)+rot(0,6,5)
           return 7.5 * verts[numpy.int32(triangles)]
    
       def generate_svg(filename):
           view = pyrr.matrix44.create_look_at(
               eye=[0,0,60], target=[0, 0, 0], up=[0, -1, 0]
           )
           projection = pyrr.matrix44.create_perspective_projection(
               fovy=30, aspect=1, near=10, far=200
           )
           camera = svg3d.Camera(view, projection)
    
           style = dict(
               fill="#D8F0FF",
               fill_opacity="0.8",
               stroke="black",
               stroke_linejoin="round",
               stroke_width="0.005",
           )
    
           mesh = svg3d.Mesh(get_faces(), style=style)
           view = svg3d.View(camera, svg3d.Scene([mesh]))
           svg3d.Engine([view]).render(filename)
    


       generate_svg("Triaugmented_triangular_prism_(symmetric_view).svg")
    

    Captions

    Symmetric view of a triaugmented triangular prism

    Items portrayed in this file

    depicts

    27 September 2022

    image/svg+xml

    650 byte

    81a3064dcb7e0e3497a38eaa8c3349d0c3a6a10e

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current22:43, 27 September 2022Thumbnail for version as of 22:43, 27 September 2022440 × 413 (650 bytes)wikimediacommons>David EppsteinUploaded own work with UploadWizard

    There are no pages that use this file.