Hi all,
I'm relatively new to C# and very new to C# graphics and am trying to produce a graphical output for some optimisation routines I'm experimenting with (I'm a bit more experienced in mathematics). Trying to work this out with Google has been frustrating - have had little success and am not even sure it's doable (but surely it is).
My problem is around automatically rendering objects designed in one dimension onto an object with a set scale and transformation.
Essentially I want to do the following:
- I will be working and making calculations purely in 2D on a (0,0) to (a,b) space and wish to keep the origin (0,0) at the bottom left for argument's sake. When I output anything, it has to be scaled and transformed onto the graphics object (say a panel) on my Windows form (which as far as I can see has (0,0) at the top left and arbitrary dimensions related to its actual size).
- generate and display some random shapes (ellipses and rectangles). I can do this (not too hard) but can't get my head around generating them in my working dimensions and displaying them on my graphics surface automatically without having to scale/transform them before rendering.
As an example:
- say I'm working/calculating on a x/y space from (0,0) to (100,100) with (0,0) at the bottom left.
- the object for display (say a panel) on my windows form has dimensions (0,0) top left down to (200,300) bottom right.
- I create a circle in my working space to have centre at (50,50) and radius 10 (right in the middle of my working space).
- Now I want to display this in the middle of the panel as if it had my working space dimensions, with C# automatically doing the transformations such that it will appear to scale and with the origin at the bottom.
I hope this makes sense. Any help will be very gratefully received.
Many regards,
David (Sydney)