# CollisionDetection

### From Gnash Project Wiki

Collision detection is the algorithm used to find out which characters in the movie are touched by the mouse point or by another character. Current implementation is not deeply tested and is known to be bogus for checking bounds of curved edges.

**UPDATE** the bounds of curved edges is not bogus anymore, just not very precise and not necessarely performant.
The current algorighmt approximates the curve as a set of 10 segments, using regula T invervals. Then computes
distance between query point and each segment.

## References

- Approximating Cubic Bezier Curves in Flash MX
- The Distance Squared Function on a Planar Curve
- A Cubic Spline Library
- Wikipedia article on Bezier Curves - contains code to compute points on the line, useful for approximating the curve to a set of segments
- Image showing closest point on curve
- AGG about bezier curves
- Nice testcase for collision detection - SWF9, doesn't work with gnash actually.
- Collision detection research