Loading
  • 21 Aug, 2019

  • By, Wikipedia

File:Triaugmented Triangular Prism (symmetric View).svg

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

File history

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

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

Metadata