Does the PtInRegion work with a Complex Region?

This is a discussion on Does the PtInRegion work with a Complex Region? within the C Programming forums, part of the General Programming Boards category; I am using the PtInRegion function in a program and can't seem to get it to work with a complex ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Does the PtInRegion work with a Complex Region?

    I am using the PtInRegion function in a program and can't seem to get it to work with a complex region I created using the function CombineRgn. The complex region is made up of multiple retangles, that may not touch each other. My question is whether someone knows if the PtInRegion will work with a complex region such as multiple rectangles either not touching each other or touching each other. I have had success getting the PtInRegion function to work with one rectangle, however, not yet with multiple rectangles.

  2. #2
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    Yes, thanks. I wasn't thinking of checking each rectangle in the region, but that would work. If the PtInRegion does not work on a complex region, I will need to use the GetRegionData function and loop through each rectangle doing a hit test on each one using the PtInRect function. If you find out that PtInRegion will work on a complex region (multiple rectangles in a region), let me know? The Microsoft documentation (on MSDN) doesn't really say. I just assumed it worked on any type of region, however, I have not been able to get it to work yet for the complex regions I have been using.
    Last edited by jpbihn; 06-24-2009 at 03:25 PM.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    3
    I made some more changes to my program, and found out that I was the one in error not the PtInRegion function. The PtInRegion function is working with complex regions that have multiple rectangles. Microsoft would not need to mention it works with any particular region on MSDN because it seems to work with any type of region from what I have seen. So the answer to my original question, "Does the PtInRegion work with a Complex Region?", is Yes it does. It has been very useful for me in doing hit testing in a Christian game I am creating (a Christian version of the game breakout).

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    *Mass Deletion of Posts*

    edit: jpbihn, since you don't have enough posts to receive PMs, I'll have to tell you here - be careful bringing up religion - it generally erupts into flamewars (or at the very leat, endless off-topic threads... hence mass deletions before it really gets going). Not that the mods condone it, we just don't deny the inevitable.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I guess you missed the hint about splitting the post over to the general forum?


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I didn't miss the hint - it's been a while since we saw much civility from either side of such threads in GD. Since it seems everyone missed the hints about playing nice in GD, I didn't see any reason this one should continue.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  2. Problems in getting OpenGL to work
    By zonf in forum C Programming
    Replies: 5
    Last Post: 02-13-2006, 03:48 AM
  3. The simpler version of two programs doesn't work......
    By w00tw00tkab00t in forum C++ Programming
    Replies: 1
    Last Post: 02-06-2006, 06:07 PM
  4. Why won't my OpenGL work?
    By Raigne in forum C++ Programming
    Replies: 7
    Last Post: 11-26-2005, 10:53 AM
  5. Help with some complex decision making
    By mlupo in forum C Programming
    Replies: 3
    Last Post: 11-17-2001, 12:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21