Original Post
Hi
I''ve been thinking of changeing my (velocity) code.
First lets say we want to move from (13,16) to (40,21), first I pass those values to a function that calculates the incx and incy to move towards that location.
results
P.vX: 1
P.vY: 0.185185
The fact is that I only need values between -1.0 and +1.0 in inc iny.
So i was thinking of converting it to a short to save sending time.
Im thinking of doing it this way:
Is there any negative effect with this?
What is the precision on float? 5 or 6
sVPoint P; short x,y; P = fVelo(13,16,40,21); cout << "P.vX: " << P.vX << endl; cout << "P.vY: " << P.vY << endl; x = (short)(100000.0*P.vX); y = (short)(100000.0*P.vY); cout << "x: " << x << endl; cout << "y: " << y << endl; P.vX = (float)(x/100000.0); P.vY = (float)(y/100000.0); cout << "P.vX: " << P.vX << endl; cout << "P.vY: " << P.vY << endl;