|
x^2+y^2=4の円を描くのに
Dim x As Single, y As Single, xold As Single, yold As Single, xnew As Single, ynew As Single
Picture1.Line (0, Picture1.ScaleHeight / 2)-(Picture1.ScaleWidth, Picture1.ScaleHeight / 2), RGB(0, 0, 0)
Picture1.Line (Picture1.ScaleWidth / 2, 0)-(Picture1.ScaleWidth / 2, Picture1.ScaleHeight), RGB(0, 0, 0)
xold = -2
yold = (4 - xold ^ 2) ^ 0.5 Or -(4 - xold ^ 2) ^ 0.5
xold = xold / 6 * Picture1.ScaleWidth + Picture1.ScaleWidth / 2
yold = -yold / 20 * Picture1.ScaleHeight + Picture1.ScaleHeight / 2
For x = -2 To 2 Step 0.1
y = (4 - x ^ 2) ^ 0.5 Or -(4 - x ^ 2) ^ 0.5
xnew = x / 6 * Picture1.ScaleWidth + Picture1.ScaleWidth / 2
ynew = -y / 20 * Picture1.ScaleHeight + Picture1.ScaleHeight / 2
Picture1.Line (xold, yold)-(xnew, ynew), RGB(255, 0, 0)
xold = xnew
yold = ynew
Next x
としたのですがうまくいきません。どこをどう直したらよいか教えていただけると幸いです。
|
|