第五课有一个作业,画抛物线y=0.5*x*x+3 x[-50,50]。我写了一个程序如下,监测显示参数都没问题,可在autocad中画出来的图形不对,能看看问题出在哪儿吗?
3 \+ M% f8 W: R( |Sub PaoWuXian()
& b' e) L3 X5 ~& P R5 B2 R" cDim p(0 To 101) As Double5 I7 i# i/ i6 h- O0 C! B4 G
Dim a As Integer' y3 V8 g0 u6 e3 a; p# E! K, t
Dim i, j As Integer& a$ B3 ^, w. b
" K) K# ]9 Y# @
For j = 1 To 100 Step 18 f& N' i) r+ K; a9 y& f. A9 Y
a = -50 + j
Q( Y& y3 p# P# l0 e p(j) = a5 v1 H' b- N, x& R
p(j + 1) = 0.5 * a * a + 3
& K+ J1 \ A1 G" r Next j( @. W! L5 h: p. E% a- k$ b
; H2 H3 Q8 T( ^
ThisDrawing.ModelSpace.AddLightWeightPolyline (p); K7 W! r0 U& Y* q: t9 K4 O
ZoomExtents
1 H" f9 D9 m, K5 v" L' f0 M, W) X3 y9 Z. l! |) o9 ]0 |
End Sub |