数学图形之海螺与贝壳

      上一节讲的是螺旋管,海螺亦是螺旋管的一种.同样,贝壳也是有螺旋度的.那么这一节将为大家提供几种海螺与贝壳的生成算法.提到海螺,让我想起我的大学是在海边,出了东校门就是大海,甚至学校宿舍都是海景房.我也很喜欢海螺和贝壳,毕竟它们的肉都很好吃.

相关软件参见:数学图形可视化工具,使用自己定义语法的脚本代码生成数学图形.

(1)海螺(conchoid)

vertices = dimension1:160 dimension2:160

u = from 0 to (6*PI) dimension1
v = from 0 to (2*PI) dimension2
k = 1.2
a = 1.5
w = (k^u) * (1+cos(v))
x = w*cos(u)
y = w*sin(u)
z = (k^u)*sin(v) - (k^u)*a

(2)Sea-shell

vertices = dimension1:1000 dimension2:72

u = from 0 to (20*PI) dimension1
v = from 0 to (2*PI) dimension2

m = -0.09
k = 3

a = 1
b = 1

e = pow(E, m*u)
w = (a + b*cos(v))*e

x = w*cos(u)
z = w*sin(u)
y = (k*a + b*sin(v))*e

(3)Sea-shell (随机)

在脚本中使用了随机数

vertices = dimension1:1000 dimension2:72

u = from 0 to (32*PI) dimension1
v = from 0 to (2*PI) dimension2


m = -1/(rand_int2(2, 100))
k = rand2(1, 100)

a = 1
b = rand2(0.5, 2)

e = pow(E, m*u)
w = (a + b*cos(v))*e

x = w*cos(u)
z = w*sin(u)
y = (k*a + b*sin(v))*e

(4)角螺

这是我自己测试时随意写的脚本,角螺的名子也是我随意取的.

vertices = dimension1:36 dimension2:72
a = from 0 to (2*PI) dimension1
b = from (-PI*0.5) to (PI*0.5) dimension2
r = 10.0
x = r*cos(b)*sin(a)
y = r*sin(b)*sqrt(a)
z = r*cos(b)*cos(a)

u = a
v = b*2

(5)鹦鹉螺

vertices = D1:720 D2:72
p = from 0 to (3*PI) D1
q = from 0 to PI D2

r = 1.2^p * sin(q) * 5

x = r * sin(q) * sin(p)
y = r * sin(q) * cos(p)
z = r * cos(q)

u = p
v = q*3

(6)贝壳1

vertices = dimension1:100 dimension2:100

u = from 0 to (2*PI) dimension1
v = from 0 to (PI) dimension2

r = sin(v)*pow(E, -u)

x = r*sin(v)*sin(u)
y = r*cos(v)
z = r*sin(v)*cos(u)

(7)贝壳2

vertices = dimension1:100 dimension2:100

u = from 0 to (PI*2) dimension1
v = from 0 to (PI) dimension2

r = sin(v)*sin(v)*pow(E, -u)

x = r*sin(v)*sin(u)
y = r*cos(v)
z = r*sin(v)*cos(u)

 

posted on 2014-08-01 09:07  叶飞影  阅读(6732)  评论(6编辑  收藏  举报