Solved

# Test if a point within an irregular poligon region

Posted on 2003-03-12
Medium Priority
349 Views
Hi,

I need to test if a point (x, y) is inside an irregular poligon region, if there already any MFC method that accomplish it, or if there any algoritm that is ready to stuff in my code?

TIA
0
Question by:mauling
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 48

Expert Comment

ID: 8118762
What is the way you keep a polygon information?
0

LVL 48

Expert Comment

ID: 8118869
Check out the following functions (available both as API and CRgn class members):

CreatePolygonRgn
CreatePolyPolygonRgn
CombineRgn

(for creating region objects)

and:

PtInRegion

(to test if point is inside a region).
0

LVL 1

Accepted Solution

oferh earned 1000 total points
ID: 8118874
you can use CRgn::CreatePolygonRgn to create a polygon
and then CRgn::PtInRegion to check if a point is in that region.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more â€¦
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationâ€¦
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
###### Suggested Courses
Course of the Month8 days, 3 hours left to enroll