第五课有一个作业,画抛物线y=0.5*x*x+3 x[-50,50]。我写了一个程序如下,监测显示参数都没问题,可在autocad中画出来的图形不对,能看看问题出在哪儿吗?
+ C) |7 k8 q7 K6 ^2 XSub PaoWuXian()
% A" e; f9 j! G" x$ X* p0 j: \Dim p(0 To 101) As Double
& [0 @3 e; K# NDim a As Integer% b1 k6 P5 w; j( K/ k) u: x
Dim i, j As Integer
! ^. l6 t. E. e K/ f' C9 v/ d! A2 K" ~/ |$ T! }
For j = 1 To 100 Step 1
! I/ g# v/ q0 I) k a = -50 + j
# C* a/ q6 y7 [) J p(j) = a
5 c* f! @ F% J/ W9 n2 A p(j + 1) = 0.5 * a * a + 3% W. {% B/ q1 W/ U4 A: Q- |
Next j
- W2 i& j8 t5 K( q5 n5 Q. p+ u( x
3 F+ i0 L' V5 w3 p- RThisDrawing.ModelSpace.AddLightWeightPolyline (p)" l" G# j8 R. t, f
ZoomExtents& O; q8 ~7 r( |& j
* [- w- b1 y. m+ [7 u5 ]End Sub |