Finding whether a point lies inside a rectangle or not

Posted by avd on Stack Overflow See other posts from Stack Overflow or by avd
Published on 2010-05-02T07:08:15Z Indexed on 2010/05/02 7:17 UTC
Read the original article Hit count: 147

Filed under:
|

The rectangle can be oriented in any way...need not be axis aligned. Now I want to find whether a point lies inside the rectangle or not.

One method I could think of was to rotate the rectangle and point coordinates to make the rectangle axis aligned and then by simply testing the coordinates of point whether they lies within that of rectangle's or not.

The above method requires rotation and hence floating point operations. Is there any other efficient way to do this??

© Stack Overflow or respective owner

Related posts about geometry

Related posts about algorithm