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

数学图形(1.10) 双曲线

时间:2014-07-06 23:09:54      阅读:520      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   2014   

双曲线有点麻烦,因为它是两条线,而我的程序逻辑中对于渲染只是处理一条线,所以在图形中会有多余的线出现,这不太漂亮,容我以后解决.而且双曲线上的顶点容易过大,造成无效的浮点数,这也要特殊处理.

 

双曲线(东西开口)

vertices = 12000

t = from 0 to (2*PI)
a = rand2(0.1, 10)
b = rand2(0.1, 10)

x = a*sec(t)
y = b*tan(t)

x = limit(x, -50, 50)
y = limit(y, -50, 50)

bubuko.com,布布扣

双曲线(南北开口)

vertices = 12000

t = from 0 to (2*PI)
a = rand2(0.1, 10)
b = rand2(0.1, 10)

x = a*tan(t)
y = b*sec(t)

x = limit(x, -50, 50)
y = limit(y, -50, 50)

bubuko.com,布布扣

双曲线2(东西开口)

vertices = 12000
t = from (-2*PI) to (2*PI)
a = rand2(0.1, 10)
b = rand2(0.1, 10)
x = a*cosh(t)
y = b*sinh(t)
x = limit(x, -50, 50)
y = limit(y, -50, 50)

bubuko.com,布布扣

双曲线2(南北开口)

vertices = 12000

t = from (-2*PI) to (2*PI)
a = rand2(0.1, 10)
b = rand2(0.1, 10)

x = a*sinh(t)
y = b*cosh(t)

x = limit(x, -50, 50)
y = limit(y, -50, 50)

bubuko.com,布布扣

圆锥双曲线

vertices = 12000

t = from 0 to (2*PI)
e = rand2(1, 8)
p = rand2(0, 10)
r = e*p / (1 - e*cos(t))

x = r*sin(t)
y = r*cos(t)

x = limit(x, -25, 25)
y = limit(y, -25, 25)

bubuko.com,布布扣

直角双曲线

vertices = 2000

x = from -20 to 20

y = 1/x

y = limit(y, -20, 20)

bubuko.com,布布扣

 

数学图形(1.10) 双曲线,布布扣,bubuko.com

数学图形(1.10) 双曲线

标签:style   blog   http   color   os   2014   

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

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