Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Algorithm to determine if a point is in an arbitrary rotated square purely with maths. — Gideros Forum

Algorithm to determine if a point is in an arbitrary rotated square purely with maths.

techdojotechdojo Guru
edited March 2012 in Code snippets
I recently came across a very interesting post by the Italian programmer Emanuele Feronato where he describes a useful algorithm to test if a point is inside an arbitrary square.

Although the code is written in AS3 it's easy enough to understand and should easily port to Lua.

http://www.emanueleferonato.com/2012/03/09/algorithm-to-determine-if-a-point-is-inside-a-square-with-mathematics-no-hit-test-involved/

Hopefully this might prove useful to someone.

Jon...

WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Sign In or Register to comment.