2009年1月14日 星期三

tobacco mosaic virus



模擬菸草嵌紋病毒在酸鹼性不同的濃度時,表面蛋白質單元打開壁體,讓病毒RNA捲體進入結合。

嘗試用rhino script撰寫完成。

Option Explicit
'Script written by
'Script copyrighted by
'Script version 2009年01月13日 下午 08:28

Call TMV()
Sub TMV()

Dim z, a
Dim x, y
Dim pi, dblTwistAngle
pi = Rhino.Pi()
dblTwistAngle = 0.0

Call Rhino.EnableRedraw(False)


For z = 0.0 To 12.0 Step 0.5

If (z >= 0 And z < 2) Or (z >= 6 And z < 8) Or (z >= 10 And z < 12) Then

dblTwistAngle = dblTwistAngle + (pi/30)

For a = 0.0 To 2*pi Step (pi/15)
x = 5 * Sin(a + dblTwistAngle)
y = 5 * Cos(a + dblTwistAngle)
Call Rhino.AddSphere(Array(x,y,z), 0.5)
Next

End If

Next


Dim t
For t = 2 To 10 Step 0.05
If (t >= 2 And t < 6) Then

x = 5 * Sin(3*t)
y = 5 * Cos(3*t)
z = t
Call Rhino.AddSphere(Array(x,y,z), 0.5)

End If

If (t >=8 And t < 10) Then

x = 5 * Cos(3*t)
y = 5 * Sin(3*t)
z = t
Call Rhino.AddSphere(Array(x,y,z), 0.5)

End If

Next


Dim u
For t = 0 To 12 Step 0.05

x = 2 * Cos(3*t)
y = 2 * Sin(3*t)
z = t
Call Rhino.AddSphere(Array(x,y,z), 0.5)

Next

Call Rhino.EnableRedraw(True)
End Sub

沒有留言: