6

« **on:** July 22, 2012, 07:46:09 AM »
Im wanting to attempt something of a large equation and in axis formulas and wondering if anyone has tried something like this.

this is what it looks like in code with variables, it would get a bit longer (lol) without the variables due to repetition. Am I barking out the wrong tree?

for iy in 1 to 10 do

(

for ix in 1 to 10 do

(

y=iy

x=ix

Ymax = 10

Xmax = 10

Tx = x/Xmax

Ty = y/Ymax

X_1a= 0.0

X_1b= 5.0

X_1c= 0.0

X_3a= 20.0

X_3b= 500.0

X_3c= 10.0

X_5a= 5.0

X_5b= 200

X_5c= 10.0

X_2a= X_3a*0.1+X_1a

X_4a= X_3a*0.1+X_5a

X_2b= X_3b*0.1+X_1b

X_4b= X_3b*0.1+X_5b

X_2c= X_3c*0.1+X_1c

X_4c= X_3c*0.1+X_5c

Y_1= (1.0-Tx)^4.0*X_1a+4.0*(1.0-Tx)^3*Tx*X_2a+4*(1.0-Tx)^2*Tx^2*X_3a+4.0*(1.0-Tx)*Tx^3*X_4a+Tx^4*X_5a

Y_3 =(1.0-Tx)^4.0*X_1b+4.0*(1.0-Tx)^3*Tx*X_2b+4*(1.0-Tx)^2*Tx^2*X_3b+4.0*(1.0-Tx)*Tx^3*X_4b+Tx^4*X_5b

Y_5 =(1.0-Tx)^4.0*X_1c+4.0*(1.0-Tx)^3*Tx*X_2c+4*(1.0-Tx)^2*Tx^2*X_3c+4.0*(1.0-Tx)*Tx^3*X_4c+Tx^4*X_5c

Y_2 = Y_3*0.01+Y_1

Y_4 = Y_3*0.01+Y_5

zPos =(1.0-Ty)^4.0*Y_1+4.0*(1.0-Ty)^3*Ty*Y_2+4*(1.0-Ty)^2*Ty^2*Y_3+4.0*(1.0-Ty)*Ty^3*Y_4+Ty^4*Y_5

Point pos:[ix*10,iy*10,zPos] size:1

)

)

this code makes an array of points using a modified bezier equation in 3DSmax. Im also thinking of ways to shorten it but keep on wishing for arbitrary variables.

Is is possible to do this with VB, I've not tried my hand with that so I don't really know how difficult it would be.