首页 > 其他 > 详细

数学图形之圆环

时间:2014-08-09 15:48:38      阅读:437      评论:0      收藏:0      [点我收藏+]
(1)圆环

vertices = D1:72 D2:72 u = from 0 to (2*PI) D1 v = from 0 to (2*PI) D2 r = 3*cos(u) + 7 z = 3*sin(u) y = r*sin(v) x = r*cos(v) y = y + 5

 

 

bubuko.com,布布扣

(2)随机半径的圆环

这里提供了两种写法:

vertices = D1:72 D2:72

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

a = 10.0
b = rand2(0.5, a)

x = (a + b*cos(v))*sin(u)
y = b*sin(v)
z = (a + b*cos(v))*cos(u)
#http://www.mathcurve.com/surfaces/tore/tore.shtml
vertices = D1:100 D2:100

u = from 0 to (PI*2) D1 v = from 0 to (PI*2) D2
a = rand2(1, 10) b = rand2(1, 10)
x = (a + b*cos(v))*cos(u) z = (a + b*cos(v))*sin(u) y = b*sin(v)

bubuko.com,布布扣

(3)Horn Torus

其特点是小圈半径等于大圈的一半

#http://mathworld.wolfram.com/HornTorus.html

vertices = D1:100 D2:100

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

x = (1 + cos(v))*cos(u)
y = sin(v)
z = (1 + cos(v))*sin(u)

a = 10

x = x*a
y = y*a
z = z*a

bubuko.com,布布扣

(4)环桶

vertices = D1:72 D2:72

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

a = 10.0
b = rand2(0.5, a)

x = (a + b*cos(v))*sin(u)
y = b*sin(v) + if(sin(v) > 0, 10, -10)
z = (a + b*cos(v))*cos(u)

bubuko.com,布布扣

(5)轮子

vertices = D1:72 D2:72

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

a = 10.0
b = rand2(0.5, a)

x = (a + b*cos(v))*sin(u)
y = b*sin(2*v)
z = (a + b*cos(v))*cos(u)

bubuko.com,布布扣

(6)tore de klein

#http://www.mathcurve.com/surfaces/klein/toredeklein.shtml

vertices = D1:100 D2:100
u = from 0 to (PI*2) D1
v = from 0 to (PI*2) D2

a = rand2(1, 10)
b = rand2(1, 10)

k = rand_int2(1, 20)
k = k / 2

x = (a+b*cos(v))*cos(u)
z = (a+b*cos(v))*sin(u)
y = b*sin(v)*cos(k*u)

bubuko.com,布布扣

(7)拧着的圆环

#http://www.mathcurve.com/surfaces/tore/tore.shtml
vertices = D1:100 D2:100
u = from 0 to (PI*2) D1
v = from 0 to (PI*2) D2
a = rand2(1, 10)
b = rand2(0.5, a)

t = sqrt(a*a - b*b)
e = rand2(-2,2)

x = t*sin(v)*cos(u) - e*(b + a*cos(v))*sin(u)
z = t*sin(v)*sin(u) + e*(b + a*cos(v))*cos(u)
y = b*sin(v)

bubuko.com,布布扣

(8)多圈的环

vertices = D1:100 D2:100
u = from 0 to (2*PI) D1
v = from 0 to (2*PI) D2

a = sin(u)
b = cos(u)

c = sin(v)
d = cos(v)

r = 3 + c + b
o = 2 * v

x = r*sin(o)
y = a + 2*d
z = r*cos(o)

x = x*5
y = y*5
z = z*5

bubuko.com,布布扣

(9)偏圆环

vertices = D1:100 D2:100
u = from 0 to (2*PI) D1
v = from 0 to (2*PI) D2

a = rand2(5, 10)
c = rand2(1, a/2)
b = sqrt(a*a - c*c)
d = rand2(1, 10)

w = a - c*cos(u)*cos(v)

x = d*(c - a*cos(u)*cos(v)) + b*b*cos(u)
y = b*sin(u)*(a - d*cos(v))
z = b*sin(v)*(c*cos(u) - d)

x = x/w
y = y/w
z = z/w

bubuko.com,布布扣

 

(10)最后再补充下,圆环可以看做是一个圆圈绕一个轴旋转生成的,所以可以有以下脚本代码

vertices = D1:100 D2:100

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

r = 2
m = rand2(r, r*10)

n = r*cos(u) + m
y = r*sin(u)

x = n*cos(v)
z = n*sin(v)

bubuko.com,布布扣

 

 (11)补充一种环曲面:Bohemian

#http://http://www.mathcurve.com/surfaces/boheme/boheme.shtml

vertices = D1:100 D2:100

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

a = rand2(1, 10)
b = rand2(1, 10)

x = a*cos(u)
y = b*cos(v)
z = a*sin(u) + b*sin(v)

bubuko.com,布布扣

数学图形之圆环,布布扣,bubuko.com

数学图形之圆环

原文:http://www.cnblogs.com/iflewless/p/3901132.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!