| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 Reworld，下班在家制作游戏，1500万奖金等你拿 以码会友 以友辅仁

已结贴   问题点数：20  回复次数：11

Dim a, b, c, xo, yo, xa, ya, xb, yb, xsa, ysa, X, Y, n1, n2 As Double

Dim t1, t2
Dim m1, m2 As Single

Const pi = 3.1415926535
'????arctan2?????????????
Private Function arctan2(Y As Single, X As Single) As Single
m = Atn(Y / X)
If X < 0 Then
m = m + ??
ElseIf Y < 0 And X > 0 Then
m = m + 2 * ??
Else
m = Atn(Y / X)
End If
arctan2 = m
End Function

Private Sub Command1_Click()

Timer1.Interval = 1
Timer1.Enabled = True

End Sub

t1 = 0 * pi / 180
a = 112
b = 336
c = -b * b / a

End Sub

Private Sub Command2_Click()

Timer1.Interval = 1

Timer1.Enabled = False

End Sub

Private Sub Form_Activate()

m = Picture1.Width / Picture1.Height
Picture1.Scale (-800 * m, 900)-(1000 * m, -900)

xo = 0
yo = 0
xa = xo + a * Cos(t1)
ya = yo + a * Sin(t1)
xb = xa + b * Cos(t2)
yb = yo
xsa = xa - c * Cos(pi + t2)
ysa = ya - c * Sin(pi + t2)

t2 = arctan2((a * Sin(t1)), (-Sqr(b * b - a * a * Sin(t1) * Sin(t1))))

Line1.X1 = xa
Line1.Y1 = ya
Line1.X2 = xb
Line1.Y2 = yb
Line4.X1 = xa
Line4.Y1 = ya
Line4.X2 = xsa
Line4.Y2 = ysa
Line5.X1 = xo
Line5.Y1 = yo
Line5.X2 = xa
Line5.Y2 = ya
Line2.X1 = -1400

Line2.Y1 = 0
Line2.X2 = 1400
Line2.Y2 = 0
Line3.X1 = 0
Line3.Y1 = -800
Line3.X2 = 0
Line3.Y2 = 800

Line6.X1 = 130
Line6.Y1 = -18
Line6.X2 = 550
Line6.Y2 = -18
Line7.X1 = -40
Line7.Y1 = -65
Line7.X2 = 40
Line7.Y2 = -65
Line8.X1 = 0
Line8.Y1 = 0
Line8.X2 = -40
Line8.X2 = -65
Line9.X1 = 0
Line9.Y1 = 0
Line9.X2 = 40
Line9.Y2 = -65
Shape5.Left = 340 - Shape5.Width / 2
Shape5.Top = -24
Shape1.Left = -Shape1.Width / 2
Shape1.Top = Shape1.Width / 2
Shape2.Left = xa - Shape2.Width / 2
Shape2.Top = ya + Shape2.Width / 2
Shape3.Left = xb - Shape3.Width / 2
Shape3.Top = Shape3.Width / 2
Shape4.Left = xb - Shape4.Width / 2
Shape4.Top = yb + Shape4.Height / 2
Shape6.Left = -Shape6.Width / 2
Shape6.Top = -65

X = xa - c * Cos(pi - t2)

Y = -(ya - c * Sin(t2))

If Option1.Value = True Then
Picture1.PSet (X, m * Y), vbRed
End If

End Sub

Private Sub Timer1_Timer()
Timer1.Interval = 1
If m1 < 360 Then
m2 = 360 - m1
m1 = m1 + 1

Else
m1 = 0
End If
t1 = m2 * pi / 180

Call Form_Activate
End Sub

请问大佬，X,Y点的轨迹怎么画出来

X = xa - c * Cos(pi - t2)

Y = -(ya - c * Sin(t2))

得分:0

得分:0

得分:0

得分:0

得分:0

得分:0

得分:0

得分:0

得分:0

• 12
• 1/2页
• 1
• 2