码迷,mamicode.com
首页 > 其他好文 > 详细

数学图形之海螺与贝壳

时间:2014-08-01 10:37:11      阅读:493      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   os   io   2014   

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

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

(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

bubuko.com,布布扣

(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

bubuko.com,布布扣

(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

bubuko.com,布布扣

(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

bubuko.com,布布扣

(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

bubuko.com,布布扣

(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)

bubuko.com,布布扣

(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)

bubuko.com,布布扣

 

数学图形之海螺与贝壳,布布扣,bubuko.com

数学图形之海螺与贝壳

标签:style   blog   http   color   使用   os   io   2014   

原文地址:http://www.cnblogs.com/WhyEngine/p/3884155.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!