At truly at my wits end!.. how to create and maniupulate a Region using Intersect?

B

Brian

Hello all.

Hope you're all enjoying your Christmas / New Years etc.

I know i've asked this before but i am truly at my wit's end, so any
help right now would be much appreciated!

How do i create and manipulate an overlapping Region?

I have a Rectangle and a Region.. i need to intersect them both and
check if the resultant region is empty.

Basically, how do i create the intersecting Region between the
Rectangle and Region? (for example, Region rgn and Rectangle rect)

But the Region.Intersect return type is void - any suggestions on how
i might approach this?

Many thanks.
 
C

carl.manaster

Region.Intersect() will make the referred-to region the intersection
with the parameter. So you probably want to make a copy so as not to
mess up your region:

[untested code]
Region intersection = new Region(rgn);
intersection.Intersect(rect);
bool emptyIntersection = intersection.IsEmpty(g);

HTH,
--Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top