首页 > 代码库 > 数学图形之海螺与贝壳

数学图形之海螺与贝壳

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

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

(1)海螺(conchoid)

vertices = dimension1:160 dimension2:160u = from 0 to (6*PI) dimension1v = from 0 to (2*PI) dimension2k = 1.2a = 1.5w = (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:72u = from 0 to (20*PI) dimension1v = from 0 to (2*PI) dimension2m = -0.09k = 3a = 1b = 1e = pow(E, m*u)w = (a + b*cos(v))*ex = w*cos(u)z = w*sin(u)y = (k*a + b*sin(v))*e

(3)Sea-shell (随机)

在脚本中使用了随机数

vertices = dimension1:1000 dimension2:72u = from 0 to (32*PI) dimension1v = from 0 to (2*PI) dimension2m = -1/(rand_int2(2, 100))k = rand2(1, 100)a = 1b = rand2(0.5, 2)e = pow(E, m*u)w = (a + b*cos(v))*ex = w*cos(u)z = w*sin(u)y = (k*a + b*sin(v))*e

(4)角螺

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

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

(5)鹦鹉螺

vertices = D1:720 D2:72p = from 0 to (3*PI) D1q = from 0 to PI D2r = 1.2^p * sin(q) * 5x = r * sin(q) * sin(p)y = r * sin(q) * cos(p)z = r * cos(q)u = pv = q*3

(6)贝壳1

vertices = dimension1:100 dimension2:100u = from 0 to (2*PI) dimension1v = from 0 to (PI) dimension2r = 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:100u = from 0 to (PI*2) dimension1v = from 0 to (PI) dimension2r = sin(v)*sin(v)*pow(E, -u)x = r*sin(v)*sin(u)y = r*cos(v)z = r*sin(v)*cos(u)