Jump to content

File:Translucent Jessen icosahedron.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 512 × 512 pixels, file size: 910 bytes)

Summary

Description
English: Translucent Jessen icosahedron
Date
Source Own work
Author David Eppstein

Source code

   import numpy, svg3d, pyrr, math
   def rot(a,b,c):
       return [(a,b,c),(b,c,a),(c,a,b)]
   def orthants(V):
       return [[i for i in range(len(V)) if V[i][0]*x >= 0 and V[i][1]*y >= 0 and V[i][2]*z >= 0] for x in [-1,1] for y in [-1,1] for z in [-1,1]]
   def wide(V):
       def isbase(i,j):
           for k in [0,1,2]:
               if V[i][k] in [1,-1]:
                   if V[j][k] != 0:
                       return False
               elif V[i][k] == 0:
                   if V[j][k] not in [2,-2]:
                       return False
               else:
                   if V[i][k]*V[j][k] < 0:
                       return False
           return True
       return [[i]+[j for j in range(len(V)) if isbase(i,j)] for i in range(len(V))]
   def get_faces():
       f = math.sqrt(2.0) / 2.0
       verts = numpy.float32(rot(2,1,0)+rot(2,-1,0)+rot(-2,-1,0)+rot(-2,1,0))
       triangles = numpy.int32(orthants(verts)+wide(verts))
       return 7.5 * verts[triangles]
   def generate_svg(filename):
       view = pyrr.matrix44.create_look_at(
           eye=[66, 36, 108], target=[0, 0, 0], up=[0, 1, 0]
       )
       projection = pyrr.matrix44.create_perspective_projection(
           fovy=15, 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("jessen.svg")

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.

Captions

Translucent Jessen icosahedron

Items portrayed in this file

depicts

File history

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

Date/TimeThumbnailDimensionsUserComment
current07:15, 7 October 2021Thumbnail for version as of 07:15, 7 October 2021512 × 512 (910 bytes)David EppsteinUploaded own work with UploadWizard

Global file usage

The following other wikis use this file:

Metadata