I am developing a Mac OS X application which, as part of it's UI, will display many visual elements in it's main view which can be selected. These elements can be positioned really anywhere within the view. The UI will support various ways of selecting the elements: rectangular marquee selection, elliptical marquee selection, and 'free' lasso selection.
I already have rectangular and elliptical marquee selection working. The algorithm is pretty simple; an element is deemed 'selected' if the element's area intersects with the area of the rectangle/ellipse.
The lasso selection will work just as it does in modern image manipulation applications like Photoshop; the user can click-and-drag a path which will close itself, and the elements contained within the path drawn will be selected.
This algorithm will likely be much more complex than the rectangular/elliptical selection, since the form of the selection is unrestricted. I am wondering if anyone has experience writing something like this, or if you can point me in the right direction as to what kind of programming techniques are necessary, and what is the most efficient way this algorithm can work.
Thanks in advance.