首页 > 代码库 > 数学图形之锥体

数学图形之锥体

(1)圆锥面

vertices = dimension1:72 dimension2:72u = from 0 to (2*PI) dimension1v = from (-5) to (5) dimension2x = v*cos(u)y = vz = v*sin(u)

(2)椭圆锥面

#http://www.mathcurve.com/surfaces/coneelliptique/coneelliptique.shtmlvertices = D1:100 D2:100v = from 0 to (2*PI) D1u = from (-1) to (1) D2a = rand2(1, 10)b = rand2(1, 10)h = rand2(0.5, 10)x = a*u*cos(v)z = b*u*sin(v)y = h*u

(3)二维直线绕X轴旋转生成圆锥面

vertices = D1:360 D2:100u = from -10 to 10 D1v = from 0 to (2*PI) D2a = rand2(-5, 5)b = rand2(-5, 5)c = rand2(-2, 2)x = un = c*(x + a) + by = n*cos(v)z = n*sin(v)

(4)二维直线绕Y轴旋转生成圆锥面

vertices = D1:360 D2:100u = from -10 to 10 D1v = from 0 to (2*PI) D2a = rand2(-5, 5)b = rand2(-5, 5)c = rand2(-2, 2)y = c*(u + a) + bx = u*cos(v)z = u*sin(v)

(5)金字塔

vertices = dimension1:5 dimension2:20u = from 0 to (2*PI) dimension1v = from 0 to (1) dimension2r = if (v<0.99, 10, 0)x = r*v*cos(u)z = r*v*sin(u)y = 8*(1-v)

(6)五星

vertices = dimension1:11 dimension2:4u = from 0 to (2*PI) dimension1v = from 0 to (1) dimension2k = from 0 to 10 D1m = mod(k, 2)t = 10.0 - m*GOLD*10r = if(v < 0.99, t, 0)x = r*v*cos(u)z = r*v*sin(u)y = 2*(1-v)

(7)N角星

vertices = dimension1:360 dimension2:4u = from 0 to (2*PI) dimension1v = from 0 to (1) dimension2n = rand_int2(4, 32)*2k = from 0 to (n) D1m = abs(mod(k, 2) - 1)t = 10.0 - m*GOLD*10r = if(v < 0.99, t, 0)x = r*v*cos(u)z = r*v*sin(u)y = 2*(1-v)

(8)风车

vertices = dimension1:72 dimension2:4u = from 0 to (2*PI) dimension1v = from 0 to (1) dimension2k = from 0 to 8 D1m = mod(k, 2)t = 10.0 - m*GOLD*10r = if(v < 0.99, t, 0)x = r*v*cos(u)z = r*v*sin(u)y = 2*(1-v)

(9)冰淇淋

vertices = dimension1:72 dimension2:72u = from 0 to (2*PI) dimension1v = from 0 to (PI) dimension2r = 10.0x = r*sin(v)*sin(u)y = r*cos(v)z = r*sin(v)*cos(u)a = rand2(PI/2, PI*0.8)d = -r*4t = r*cos(a)e = (v - a)/(PI - a)w = r*sin(a)*(1 - e)h = t + e*(d - t)i = w*sin(u)j = w*cos(u)x = if(e < 0.0, x, i)y = if(e < 0.0, y, h)z = if(e < 0.0, z, j)

 

(10)曲线绕Y轴旋转生成圆锥面

#http://www.mathcurve.com/surfaces/conederevolution/conederevolution.shtmlvertices = D1:100 D2:100v = from (-PI) to (PI) D1u = from (-PI) to (PI) D2a = rand2(0, PI*0.45)x = a*(cos(v) + cos(u))z = a*(sin(u) + sin(v))y = 2*a*cot(a)*cos((u-v)/2)

 

(11)任意朝向的圆锥

vertices = D1:72 D2:72u = from 0 to (2) D2v = from 0 to (2*PI) D1a = rand2(0, 2*PI)b = rand2(0, 2*PI)c = sin(v)d = cos(v)e = sin(b)f = cos(b)g = sin(a)h = cos(a)x = f*h*d - f*g*3 + e*cy = g*d + h*3z = -e*h*d + e*g*3 + f*cx = x*uy = y*uz = z*ux = x*5y = y*5z = z*5

 

(12)正劈锥体

#http://www.mathcurve.com/surfaces/coinconic/coinconic.shtmlvertices = D1:100 D2:100v = from 0 to (2*PI) D1u = from -10 to 10 D2a = rand2(1, 10)b = rand2(1, 10)k = b/ax = uz = k*u*cos(v)y = k*a*sin(v)