tags:

views:

26

answers:

2

I'm working on a visualisation interface that will display a number of points in a 2D graph, and I'd like a way for the user to be able to select any number of points.

Does anyone know a freehand (lasoo) selection method would be implemented? A square or circular selection is relatively simple, but storing the selection and calculating the points under it seems much harder for arbitrary shapes.

I'm hoping to implement it in Flex, but any examples would be much appreciated.

+2  A: 

Check out Point in Polygon algorithms. You may find something you can use.

Parappa
Thanks! I thought initially about collision detection methods, but I forgot about winding number.
dig412
+2  A: 

It's a lazy solution, but couldn't you just draw a shape for the selection and then perform a hit test for each point against that shape?

Richard M
That makes a lot of sense - tracking the selection seemed to be the larger problem compared to finding what it encompasses.
dig412
The next question would be do you know a way to have user-defined closed shapes?All the examples I've found approximate the shape using lots of small lines, and I'm guessing hit tests wont like that.
dig412