# 学文老师需要的时间胎大概是这个样子的吧？

u = 6.28
For u = 0 To 6.28 Step du
For v = 0 To 6.28 Step dv
xx = (100# + r * Cos(u)) * Cos(v)
yy = (100# + r * Cos(u)) * Sin(v)
zz = 100# + r * Sin(u)
x1 = xx * Cos(cy) + zz * Sin(cy) + 200
y1 = xx * Sin(cy) * Sin(cx) + yy * Cos(cx) _
- zz * Cos(cy) * Sin(cx) + 200
z1 = -xx * Sin(cy) * Cos(cx) + yy * Sin(cx) _
+ zz * Cos(cy) * Cos(cx)

xx = (100# + r * Cos(u)) * Cos(v + dv)
yy = (100# + r * Cos(u)) * Sin(v + dv)
zz = 100# + r * Sin(u)
x2 = xx * Cos(cy) + zz * Sin(cy) + 200
y2 = xx * Sin(cy) * Sin(cx) + yy * Cos(cx) - _
zz * Cos(cy) * Sin(cx) + 200
z2 = -xx * Sin(cy) * Cos(cx) + yy * Sin(cx) + _
zz * Cos(cy) * Cos(cx)

xx = (100# + r * Cos(u + du)) * Cos(v + dv)
yy = (100# + r * Cos(u + du)) * Sin(v + dv)
zz = 100# + r * Sin(u + du)
x3 = xx * Cos(cy) + zz * Sin(cy) + 200
y3 = xx * Sin(cy) * Sin(cx) + yy * Cos(cx) - _
zz * Cos(cy) * Sin(cx) + 200
z3 = -xx * Sin(cy) * Cos(cx) + yy * Sin(cx) + _
zz * Cos(cy) * Cos(cx)

xx = (100# + r * Cos(u + du)) * Cos(v)
yy = (100# + r * Cos(u + du)) * Sin(v)
zz = 100# + r * Sin(u + du)
x4 = xx * Cos(cy) + zz * Sin(cy) + 200
y4 = xx * Sin(cy) * Sin(cx) + yy * Cos(cx) - _
zz * Cos(cy) * Sin(cx) + 200
z4 = -xx * Sin(cy) * Cos(cx) + yy * Sin(cx) + _
zz * Cos(cy) * Cos(cx)
xx1 = x2 - x1: xx2 = x3 - x1
yy1 = y2 - y1: yy2 = y3 - y1
zz1 = z2 - z1: zz2 = z3 - z1
x = yy1 * zz2 - yy2 * zz1
y = zz1 * xx2 - zz2 * xx1
z = xx1 * yy2 - xx2 * yy1
If (z > 0) Then
xd(0) = x1: yd(0) = y1
xd(1) = x2: yd(1) = y2
xd(2) = x3: yd(2) = y3
xd(3) = x4: yd(3) = y4
dd = -(x * x1 + y * y1 + z * z1)
Call tc(4, 100)   //不要管这句，这句是调用光照渲染算法的。
End If
Next
Next
End Sub

https://wap.sciencenet.cn/blog-33982-562711.html

## 相关博文

GMT+8, 2021-8-5 05:17