首页 > 代码库 > 数学图形之花儿

数学图形之花儿

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

数学图形(1.11) 玫瑰线

数学图形(1.27) 花

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

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

 

(1)玫瑰线

vertices = D1:4000 D2:6n = 8u = from 0 to (n*PI) D1v = from 0 to 1 D2a = rand_int2(2, 16)r = 10*sin(a*u)*vk = u/n/2x = r*cos(u)*cos(k)z = r*sin(u)*cos(k)y = GOLD* abs(r)*sin(k)

(2)双层玫瑰

vertices = D1:4000 D2:6n = rand_int2(3, 16)u = from 0 to (n*PI) D1v = from 0 to 1 D2r = 10*(1 + 3*sin(n*u))*vk = u/n/2x = r*cos(u)*cos(k)z = r*sin(u)*cos(k)y = GOLD* abs(r)*sin(k)

(3)超级玫瑰

#http://www.2dcurves.com/roulette/rouletters.htmlvertices = D1:8000 D2:6n = 16u = from 0 to (n*PI) D1v = from 0 to 1 D2a = rand_int2(1, 100) / 8b = rand_int2(1, 100) / 8c = rand_int2(-10, 100) / 8d = rand_int2(1, 100) / 8f = rand_int2(1, 100) / 8w = pow(abs(cos(d*u)), a) + pow(abs(sin(d*u)), b)r = 10*v*sin(f*u)*pow(w, c)w = u/n/2x = r*sin(u)*cos(w)z = r*cos(u)*cos(w)y = GOLD*abs(r)*sin(w)

(4)N叶草

#http://www.mathcurve.com/courbes2d/biquartic/biquartic.shtmlvertices = D1:4000 D2:6m = 8u = from (-PI) to (m*PI) D1v = from 0 to 1 D2n = rand_int2(3, 10)p = (1 + cos(n*u) + sin(n*u)^2) * vk = u/m/2x = p*cos(u)*cos(k)z = p*sin(u)*cos(k)y = abs(p)*sin(k)

(5)folioide

vertices = D1:6 D2:4000m = 32u = from (-PI/2) to (m*PI) D2v = from 0 to 1 D1e = rand2(0.1, 10)a = 10 / ei = rand_int2(2, 10)j = rand_int2(1, 10)n = i/jp = a*(e*cos(n*u) + sign(u)*e*sqrt(1 - pow(cos(n*u), 2)))*vw = u/m/2x = p*cos(u)*cos(w)z = p*sin(u)*cos(w)y = GOLD * abs(p)*sin(w)

(6)botanic

#http://www.2dcurves.com/roulette/rouletteb.htmlvertices = D1:8000 D2:6n = 32u = from 0 to (n*PI) D1v = from 0 to 1 D2r = 10*vc = rand2(0.1, 10)d = rand2(1, 10)p = r*(1 + d*sin(c*u))w = u/n/2x = p*cos(u)*cos(w)z = p*sin(u)*cos(w)y = 0.6*abs(p)*sin(w)