getPointAlognPath with a trasformed Path


#1

Hi all…
I’m trying to calculate the middle point of a Path object.
All works fine if I call the method getPointAlongPath, but i have some strange results while trying to
perform the same operation on a modified Path.

Here’s the code:

Path p;
p.lineTo(100,0); /*should draw a straight line from 0,0 to 100,0*/

Point<float> coord = p.getPointAlongPath(50);  /* coord (50,0) -- i found the right value*/

Point <float> coord2 = p.getPointAlongPath(50, (AffineTransform::translation(20,20))); /* if i understood this method should calculate the position alogn the path after the translation -- i found the right value : coord2 (70,20)*/

Point <float> coord3 = p.getPointAlongPath(50, (AffineTransform::scale(2,2)));  /* here some problem - coord3(50,0) expected (100,0) becuase the width is double (2 * 100)*/
       

Does the method getPointAlongPath (called with a AffineTransform as second parameter) calculate the position along the path of the given point after having transformed the path?

If it is like said before, why doesn’t work with AffineTransform::scale? Am I misunderstanding something about Path operations in general?

thanks


#2

No, there’s nothing wrong with that…

If you’ve got a horizontal line from 0, 0, then it doesn’t matter how long the line is or what scale you use, the point that is 50 pixels along it will always be at (50, 0), right?


#3

yes of course…
sorry for the stupid question (maybe i wrote too lines of code these days)