tags:

views:

225

answers:

1

I am creating a game where I want to determine the intersection of a single line. For example if I create a circle on the screen I want to determine when I have closed the circle and figure out the points that exist within the area.

Edit: Ok to clarify I am attempting to create a lasso in a game and I am attempting to figure out how I can tell if the lasso's loop is closed. Is there any nice algorithm for doing this? I heard that there is one but I have not found any references searching on my own.

Edit: Adding more detail

I am working with an array of points. These points happen to wrap around and close. I am trying to figure out a good way of testing for this.

Thanks for the help.

Thoughts?

+2  A: 

Your question has been addressed many times in the game development literature. It falls under the broad category of "collision detection." If you are interested in understanding the underlying algorithms, the field of computational geometry is what you want.

Game development books will also describe collision detection algorithms. One book of this sort is Game Physics by Eberly.