Compare commits
2 commits
9c4a219f9b
...
7ced0fb8ba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ced0fb8ba | ||
|
|
bb8a438cb1 |
1 changed files with 14 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#! /usr/bin/python3
|
||||
|
||||
from sys import argv, stdout, stderr
|
||||
from math import pi as π
|
||||
from math import pi as π, floor
|
||||
from math import atan, atan2
|
||||
import numpy
|
||||
from numpy import sqrt, sin, cos, tan, array, arange, empty, cross, newaxis
|
||||
|
|
@ -270,12 +270,23 @@ def box(x=1.0, y=1.0, z=1.0):
|
|||
plane(vector(y= y), vector(x=1), vector(z=1)),
|
||||
])
|
||||
|
||||
def prism(n=6, a=1.0, z=1.0, φ=0.0):
|
||||
def prism(n=6, a=1.0, z=1.0, φ=0.0, n1=0, n2=None):
|
||||
p = [
|
||||
plane(vector(z=-z), vector(x=1), vector(y=1)),
|
||||
plane(vector(z= z), vector(y=1), vector(x=1)),
|
||||
]
|
||||
φ = 2*π * arange(int(n))/n + φ
|
||||
if n2 is None:
|
||||
n2 = n
|
||||
else:
|
||||
c = cos(2*π/n * n1)
|
||||
s = sin(2*π/n * n1)
|
||||
p.append(plane(vector(), vector(c,s), vector(z=-1)))
|
||||
c = cos(2*π/n * n2)
|
||||
s = sin(2*π/n * n2)
|
||||
p.append(plane(vector(), vector(c,s), vector(z= 1)))
|
||||
|
||||
φ += 2*π/n * arange(int(floor(n1+0.4999)),
|
||||
int(floor(n2+1.5001)) )
|
||||
p.extend([
|
||||
plane(
|
||||
vector(a*c, a*s),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue