2 Replies - 285 Views - Last Post: 28 November 2013 - 11:55 PM Rate Topic: -----

#1 marklr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 21-July 13

how to know a point lies inside a rectangle or not?

Posted 28 November 2013 - 11:02 PM

suppose i have a Point coordinates and a rectangle(or polygon),how to know whether a point lies inside a rectangle or not?
Is This A Good Question/Topic? 0
  • +

Replies To: how to know a point lies inside a rectangle or not?

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10183
  • View blog
  • Posts: 37,596
  • Joined: 27-December 08

Re: how to know a point lies inside a rectangle or not?

Posted 28 November 2013 - 11:24 PM

You check based on the boundary x and y points for the rectangle. If x_{0} <= x_{i} <= x_{n} and y_{0} <= y_{i} <= y_{n}, then your point (x_{i}, y_{i}) is in the rectangle.
Was This Post Helpful? 1
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3168
  • View blog
  • Posts: 9,578
  • Joined: 05-May 12

Re: how to know a point lies inside a rectangle or not?

Posted 28 November 2013 - 11:55 PM

And if you are using the .NET Rectangle class, you can use the Contains() method: http://msdn.microsof...(v=vs.110).aspx
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1