I'm currently making a small 2D game in XNA Game Studio Express. It involves a player moving around a terrain and being able to collide with it. Nearly all the graphics and settings in my game are user generated so this allows for everything to be quite customisable.
For collision detection the user specifies paths made of Bezier curves which are stored in a file. The game reads this file and stores a number of points on the curves in an array. The player is also made of Bezier curves that are converted into points:

This shows how I want collision detection to happen; if any of the lines that make up the player intersect with any of the lines that make up the terrain, then a collision has occurred. Once a collision has occurred two things need to be done:
- Move the player the shortest distance possible so they are no longer intersecting the terrain
- Reflect the velocity of the player off the line of the terrain so they appear to bounce off the terrain.

It seems simple enough to just write:
playerPosition += intersectionPoint - new Vector2(x4, y4)Which would work for the visual example that I gave but what if points 1 and 2 swap places or points 3 and 4 swap What if the player is colliding with the ceiling not the ground There are many different ways in which these 4 points can intersect. How can I create an equation to move the player properly Or is there a better way of doing collision detection with Bezier curves
Thanks in advance for your help,
Fusion.