PDA

View Full Version : how to shift the Coordinate system


Olyalyu
05-02-2006, 04:28 PM
I was wondering if there any special tricks how to shift the Coordinate System 0-point to the middle of the stage. I would like to draw some math graphs and have problems with calculation of its positioning.

For example if I want to draw y=x^2 in the middle of the stage (500;500) I try

var x;
var y;
_root.lineStyle(1, 0x0000FF, 100);
_root.moveTo(250,250);

for (x=-10; x<10; x=x+1){
y=-x*x;
_root.lineTo(x+250, y+250);
}

But it is still not centered.

My other problem that the graph doesn't look good. Is there any way to improve it by magnifying the dimentions? When I try to multiply the output by 10 for example, it doesn't look smooth any more.

I would really apreciate any help or tips.
May be someone knows where I can find a tutorial on that matter.

Sunny13
05-02-2006, 05:29 PM
You have right idea but a small change is required ... the y coordinate here increases downward and not upward as it should be.... hope this will help you...:)