Compare commits

...

2 commits

Author SHA1 Message Date
Stephan I. Böttcher
7ced0fb8ba Merge branch 'master' of forge.bexus.org:Stephan/geometryfactor 2023-11-28 21:32:30 +01:00
Stephan I. Böttcher
bb8a438cb1 incomplete prisms 2023-11-28 21:30:22 +01:00

View file

@ -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),