File:Triaugmented triangular prism (symmetric view).svg
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:
| 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")
Category:Triaugmented triangular prism