I am creating a silverlight application which will allow you to click at two places on the screen and will draw an ellipse whose major axis starts and ends at the click locations. The clickable area is a Silverlight Grid control. Currently:
When you first click, I am:
- Dropping a marker at the click point.
- Creating an ellipse and parenting it to the Grid.
- Creating and setting an AngleTransform on the ellipse.
As you move the mouse, I am:
- Calculating the distance to the first click point.
- Setting the Width of the ellipse to this length.
- Calculating the angle of a line to the click point and the Grid's X-Axis.
- Setting the Ellipse's AngleTransform Angle to this angle.
So far, so good. The ellipse is displayed, and its length and angle of rotation follow the mouse as it moves.
However, the major axis of the ellipse is offset from the click point. How do I position the Ellipse so its major axis starts at the click point and ends at the current mouse position?