I need to implement an algorithm for filling complex polygons.I've used so many algorithms but all the algorithms are doing only if the polygon doesn't overlap.but my application need is to fill the polygons that may be completely inside other polygons. so i need a algorithm which fills the polygons with Xor mode. accuracy is much more important(ie double precision). user should not be able to see any cracks within the filled polygons. we can implement that using the following win32 APIS
CRgn Target;
Target.CreatePolyPolygonRgn( m_p2DPointBuffer, 1, iCount, ALTERNATE );
//fill the resultant region
HBRUSH hbr, holdbr;
int iOldROP = 0;
hbr=CreateSolidBrush(RGB(0,0,0));
holdbr=(HBRUSH)SelectObject(m_hDC, hbr);
If any of u have the polygon algorithm to give the output same as the above code or if u have any other links for this algorithm please do tell me.
Best regards
Jothi
Thank you for your suggestion. The problem is accuracy. i've implented an algorithm for filling polygons in XOR Mode. but due to round off of minute floating values i am experiencing some cracks within filled polygons.I've tried so many algorithms but nothing helps. so i am searching for an algorithm which effectively fills complex polygons without cracks.
Yes u are right the cracks are not there if the user zooms the view. but the cracks are there in the normal view. i've attached a crack.bmp contains filled font. here each letter is the complex polygons.
i will explain u in detail about the problem.
Input to my algorithm is the array of Points(line segments) with double precision. i am filling the polygons using these line segments. code is as follows. Please give any suggestions for not getting the crack in the normal view too.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.