KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
With reference to this programming game I am currently building. alt text http://img12.imageshack.us/img12/2089/shapetransformationf.jpg To translate a Canvas in WPF, I am using two Forms: TranslateTransform (to move it), and RotateTransform (to rotate it) [ children of the same TransformationGroup ] I can easily get the top left x,y coordinates of a canvas when its not rotated (or rotated at 90deg, since it will be the same), but the problem I am facing is getting the top left (and the other 3 points) coordinates. This is because when a RotateTransform is applied, the TranslateTransform 's X and Y properties are not changed (and thus still indicate that the top-left of the square is like the dotted-square (from the image) The Canvas is being rotated from its center, so that is its origin. So how can I get the "new" x and y coordinates of the 4 points after a rotation ? [UPDATE] alt text http://img25.imageshack.us/img25/8676/shaperotationaltransfor.jpg I have found a way to find the top-left coordinates after a rotation (as you can see from the new image) by adding the OffsetX and OffsetY from the rotation to the starting X and Y coordinates. But I'm now having trouble figuring out the rest of the coordinates (the other 3). With this rotated shape, how can I figure out the x and y coordinates of the remaining 3 corners? [EDIT] The points in the 2n
Tags (comma-separated)
Save Edits
Cancel