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

数学图形之花儿

时间:2014-07-30 23:12:55      阅读:441      评论:0      收藏:0      [点我收藏+]

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

前几天,我曾经发布过关于如何生成花形曲线的文章,参见

数学图形(1.11) 玫瑰线

数学图形(1.27) 花

这一节中,会将二维的花形曲线变成三维的花形曲面,其样子会漂亮很多.

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

 

(1)玫瑰线

vertices = D1:4000 D2:6

n = 8

u = from 0 to (n*PI) D1
v = from 0 to 1 D2

a = rand_int2(2, 16)
r = 10*sin(a*u)*v
k = u/n/2

x = r*cos(u)*cos(k)
z = r*sin(u)*cos(k)
y = GOLD* abs(r)*sin(k)

bubuko.com,布布扣

(2)双层玫瑰

vertices = D1:4000 D2:6

n = rand_int2(3, 16)

u = from 0 to (n*PI) D1
v = from 0 to 1 D2

r = 10*(1 + 3*sin(n*u))*v
k = u/n/2

x = r*cos(u)*cos(k)
z = r*sin(u)*cos(k)
y = GOLD* abs(r)*sin(k)

bubuko.com,布布扣

(3)超级玫瑰

#http://www.2dcurves.com/roulette/rouletters.html

vertices = D1:8000 D2:6

n = 16

u = from 0 to (n*PI) D1
v = from 0 to 1 D2

a = rand_int2(1, 100) / 8
b = rand_int2(1, 100) / 8
c = rand_int2(-10, 100) / 8
d = rand_int2(1, 100) / 8
f = rand_int2(1, 100) / 8

w = pow(abs(cos(d*u)), a) + pow(abs(sin(d*u)), b)
r = 10*v*sin(f*u)*pow(w, c)
w = u/n/2

x = r*sin(u)*cos(w)
z = r*cos(u)*cos(w)
y = GOLD*abs(r)*sin(w)

bubuko.com,布布扣

(4)N叶草

#http://www.mathcurve.com/courbes2d/biquartic/biquartic.shtml

vertices = D1:4000 D2:6

m = 8

u = from (-PI) to (m*PI) D1
v = from 0 to 1 D2

n = rand_int2(3, 10)
p = (1 + cos(n*u) + sin(n*u)^2) * v
k = u/m/2

x = p*cos(u)*cos(k)
z = p*sin(u)*cos(k)
y = abs(p)*sin(k)

bubuko.com,布布扣

(5)folioide

vertices = D1:6 D2:4000

m = 32

u = from (-PI/2) to (m*PI) D2
v = from 0 to 1 D1

e = rand2(0.1, 10)
a = 10 / e
i = rand_int2(2, 10)
j = rand_int2(1, 10)
n = i/j

p = a*(e*cos(n*u) + sign(u)*e*sqrt(1 - pow(cos(n*u), 2)))*v
w = u/m/2

x = p*cos(u)*cos(w)
z = p*sin(u)*cos(w)
y = GOLD * abs(p)*sin(w)

bubuko.com,布布扣

bubuko.com,布布扣

(6)botanic

#http://www.2dcurves.com/roulette/rouletteb.html

vertices = D1:8000 D2:6


n = 32

u = from 0 to (n*PI) D1
v = from 0 to 1 D2

r = 10*v

c = rand2(0.1, 10)
d = rand2(1, 10)

p = r*(1 + d*sin(c*u))
w = u/n/2

x = p*cos(u)*cos(w)
z = p*sin(u)*cos(w)
y = 0.6*abs(p)*sin(w)

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

 

数学图形之花儿,布布扣,bubuko.com

数学图形之花儿

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

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

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