I'm gonna start with an apology, I'm struggling to articulate this question, so I'll begin with what I'm trying to achieve.
I am using Javascript with Raphael.
So, I'm trying to store the position of a point relative to the four corners of a polygon. Opposite corners of the polygon can be seen as having an axis between them, which always meets at a right-angle with the other axis. The polygon can be rotated, and grown/shrunk on either axis, but the axes will stay at right angles. I want the point to stay in the same spot on the polygon as it moves/stretches. The point is placed by the user clicking on a spot on the polygon.
I want to be able to take the X/Y co-ordinates of a mouseclick, and turn it into some relative percentage or something of the polygon's internal axes, which may not always be parallel with the browser's X/Y axes. How would I do this?
This image may help clarify the idea that I'm trying to express.
The green spot is the point in which I would like to store the relative position of within the polygon. I have X/Y co-ordinates for the red and blue corner spots.