arumugajothi
March 3rd, 2003, 05:30 AM
Hi All,
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);
iOldROP = SetROP2(m_hDC, R2_NOTXORPEN);
FillRgn(m_hDC, HRGN(Target),hbr);
SetROP2(m_pDwgFile->m_hDC, iOldROP);
hbr=(HBRUSH)SelectObject(m_hDC, holdbr);
DeleteObject(hbr);
Target.DeleteObject())
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
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);
iOldROP = SetROP2(m_hDC, R2_NOTXORPEN);
FillRgn(m_hDC, HRGN(Target),hbr);
SetROP2(m_pDwgFile->m_hDC, iOldROP);
hbr=(HBRUSH)SelectObject(m_hDC, holdbr);
DeleteObject(hbr);
Target.DeleteObject())
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