?to math guru's how to find pixel distance of this polynominal
i have the following question
i need to find the distance of the polynominal
in order to step thru time correctly so i am ploting
exactly 1 pixel per step of time.
i need to know the distance of the curve before i plot it.
in the following a = time; time steps thru .0 to 1.0 on a value i specify
and b = 1 - time;
A xyz is the starting position and D xyz is the ending position
B and C affect the curve.
i need to figure out exactly how many pixels are moved thru so
i dont under plot and do not plot extra points that are not required.
X = (int)( Ax*(b*b*b) + 3*Bx*(b*b*a) + 3*Cx*b*a*a + Dx*(a*a*a) );
Y = (int)( Ay*(b*b*b) + 3*By*(b*b*a) + 3*Cy*b*a*a + Dy*(a*a*a) );
Z = (int)( Az*(b*b*b) + 3*Bz*(b*b*a) + 3*Cz*b*a*a + Dz*(a*a*a) );
very much thanks for any help even if you dont know the solution
any advise on the terminology that i can look up for what the solution
to this type of problem is called i never even finish algebra in high
school and i am teaching myself as i go along.
however i dont know the correct terminology for the solution i am seeking.
[1282 byte] By [
lightxxxa] at [2007-9-28 13:12:56]

> Am I right in thinking you want to evaluate the line
> integral?
> John
If we were talking about a continuous line, then yes, a line integral gives you the length of the line.. However, I think he wants to calculate the number of pixels that approximate the line, to display it with finite fixed pixels on the screen.
Picture this: A straight horiz. line from (0,0) to (99,0) is 100 units long, and 100 pixels. a 45 degree angle line from (0,0) to (99,99) is 100*sqrt(2) in length (which a line integral would tell you), but still requires 100 pixels to draw, ie (0,0), (1,1), (2,2), ...... (98,98), and (99,99). Expand to 3D space, draw a line from (0,0,0) to (99,99,99), you get even longer of a line, but STILL 100 pixels..
Since we're talking polynomials here, we can be sure that the function is 1 to 1 and continuous.. Since pixels are at a finite spot, we know that (except for a small set of straight lines) the pixels won't be on exact coordinates of the function.
What you'll end up doing is starting at the beginning of your range, and plotting the closest pixel to that point. Now find the pixels next to the one you just plotted that is closest to the line and plot it.
For a 2D polynomial, assuming normal cartesian coordinates, and that you're starting at the lowest x (far left), you could choose any one of 5 pixels (up, up and right, right, down and right, or down). You may have to arbitarily pick one if you get a situation where 2 pixels are equidistant to the function. Plot that point, and repeat until finished.
If you expand method this to 3D space, you'll have to choose the pixel in a 2D plane that (depending on your perspective) makes the pixel LOOK like it's at that 3D point. Ie, a straight line sticking straight towards you could be any length, but appear as one pixel, since they're all kind of on top of each other in your 2D view.The number of pixels now depends on your position, so you'd need that info to determine for 3D.
So, in response to your post, you dont have enough information to solve the problem in 3D space, and for 2D, you have to plot it like I said above, put a counter in there, and you'll know how many pixels when you're finished. I can't think of a way to determine before you plot.