I want to store data in an array using an 4th degree equation. But i only want points from a certain range.
My range needs to be x=0,2*Q
to x=1,5*Q
, so the loop needs to start at x=0,2*Q
and ends when x=1,5*Q
. Q
is a variable read from a text file, and is for example 9.
I use this data to draw curves in a 3D Cad program called Solid Edge.
The problem is, the data doesn't store how i wnat it. It does start from were i want it but doesnt end at the point i want it. The program stops when y
is that number. But i only want that to happen with x
.
My solid edge version is ST2, and this console application needs to work on ST5. In solid Edge i use the calculated array to make curves with:
Bsplinecurve2d = BsplineCurves2d.AddByPoints(order, ArraySize, dataArray)
I'm using visual basic 2003, and i know using a newer version is better. But i can't. I'm an intern at a engineering office and they only had this copie of visual basic. Here is the part of my code what isn't doing what i want:
dim x as double
dim y as double
dim i as double
Dim listofdata As New ArrayList
For i = 0.2 To 1.5 Step 0.1
x = (i * Q)
y = (((x ^ 4) * A) + ((x ^ 3) * B) + ((x ^ 2) * C) + (x * D) + E)
listofdata.Add(x)
listofdata.Add(y)
Next
Dim dataArray() As Double
dataArray = DirectCast(listofdata.ToArray(GetType(Double)), Double())