One smart optimisation ( from the old days): Divide the XY area in 8 octants( or hexants,or whatever is the decomposition of N in prime factors). Compute the vertices for one and flip/mirror for th others. This will solve partially the problem of rounding and also speed up a lot the code.
I want to draw "N" rectangle and lines in my GDI and for each rectangle I need to gave a name and save all properties (X1,Y1,X2,Y2) in text file.
Each line must be resizable and tracking(I don't know haw to track a line).
Each rectangle must be resizable and tracking(I already do this with one rectangle).
Each rectangle must be able to receive a text(I already do this with one rectangle).
The properties of each text in rectangle must be interactive changed by user and also saved in text file(I already do this using LbuttonDblclick + fontdialog).
It is posible to decide that I have i.e 10 elements. In this case I must initalize all of them and drawing one to one.
But in this case user will not have any flexibility to add new rectangle any time when he want.
Could any one gave me some good algoritm for that?
I think that it may have been useful to post the fact that you wish to draw n-sided <i>regular</i> polygons, as surely there are scanline rendering algorithsm for drawing polygons already. Also, it may have been useful to post an algorithm for scanlining solid polygons, as they are more useful imho.
I left out the details of setting pen/brush colors, and I
glossed over the actual drawing stuff, but the idea is to
create the function and call it from inside the OnMouseMove
code. That way, your code is much cleaner, and you can
create n sided poly's from anywhere without having to
copy/paste all over the place.
Remember, C and C++ allow us to create functions which
should be as reusable as possible. Less code means easier
debugging and usually more efficient operation.
PS: Editing code in this browser window sucks. :-)
i think mayank malik is one of the most talented programmers i've met and this is only a sample of what he can do....i've known him for the last 4 yrs and he's as good a person as he is a programmer!! if anybody out there is looking for a dedicated, talented and brilliant software programmer..look no further for he's ur man :)
ensoi and keep the faith