Convert Cartesian coordinate to image coordinates with C #

The question I have is more math! I have a couple of values ​​that repeat the points of a curve that I want to draw in Photoshop using fromImage (Bitmap). The size of my window is 500x500. I also know that the upper left corner has a point (0,0), and the lower right corner has points (500 500). Obviously, the origin should be (250,250). Now I am wondering how can I convert my own values ​​to this format?

Examples I have:

Voltage: -0.175         Current: -9.930625E-06
Voltage: -0.171875      Current: -9.53375E-06
Voltage: -0.16875       Current: -9.136875E-06
Voltage: -0.16875       Current: -8.74E-06
Voltage: -0.165625      Current: -8.343125E-06
Voltage: -0.1625        Current: -7.94625E-06
Voltage: -0.1625        Current: -7.549375E-06
Voltage: -0.159375      Current: -7.152188E-06
Voltage: -0.15625       Current: -6.755312E-06

You see, there are voltage values ​​that should be on the X-axis and Current on the Y-axis. I know that in order to make them a little better, I have to multiply them by a larger number, and possibly also multiply by inversion or something else. but I still can’t figure out how to represent them in my picture. These points usually begin with the third quadrant and end in the first quadrant. Please, help!

Just add that my X axis min and max is -2V and + 2V, and for the Y axis it’s from -10uA to + 10uA (i.e. 10 * 10 ^ -6)

EDIT

What I'm trying to do is such a curve, so the points that I have are used in Graphics.DrawCurve:

enter image description here

UPDATE Here's what my code looks like:

            g.DrawLine(penAxis, 250, 0, 250, 500); // Y AXIS 
        g.DrawLine(penAxis, 0, 250, 500, 250); // X AXIS          

        PointF[] p = new PointF[pinData.GetLength(0)];   //pinData is AboutBoxForm double[,] array

        for (int i = 0; i < pinData.GetLength(0); i++)
        {
            p[i] = new PointF(250 * ((1 + (float)pinData[i, 0]) / 2), 250 * ((1 + (float)pinData[i, 1] )/ 10));  
        }

        Pen pengraph = new Pen(pinColor, 2.0F);
        g.DrawCurve(pengraph, p);

PROGRESS UPDATE

ok now, using the code below, my curve looks like this:

            g.DrawLine(penAxis, 250, 0, 250, 500); // Y AXIS 
        g.DrawLine(penAxis, 0, 250, 500, 250); // X AXIS          

        PointF[] p = new PointF[pinData.GetLength(0)];   //pinData is AboutBoxForm double[,] array

        for (int i = 0; i < pinData.GetLength(0); i++)
        {
            p[i] = new PointF(250 * (1 - ((float)pinData[i, 1] *100000) / 10), 250 * (1 + (((float)pinData[i, 0]))/ 2));  
        }

        Pen pengraph = new Pen(pinColor, 2.0F);
        g.DrawCurve(pengraph, p);

enter image description here

, . SOLVED 10 ^ 6, 5, !!! .

+3
2

, (V,C) = (0, 0) , :

X = 250 * (1 + Voltage/2)
Y = 250 * (1 - Current/10)

, Y. , (1 + Current/10) .

+1

, , 50.

third quadrant; (0, 0) negative x-axis , .. y-axis.

, .

+1

All Articles