TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Daniel
NA
1
0
how to rotate a polygon along any axis
Jul 29 2010 12:55 PM
I need to rotate a simple 2D polygon along any axis (to mimic 3D rotation). The polygon is draw on a canvas using lines (VS 2010). I need to keep track of all coordinates during rotation.
I was able to write code for rotating an hexagone around x or y axis using simple math where theta is the angle from the plane XY axis, Phi from the XZ plane.
(rotating around x axis)
pt.X = ptCentre.X + r * cos(theta);
pt.Y = ptCentre.Y + r * sin(theta) * cos(Phi);
(rotating around y axis)
pt.X = ptCentre.X + r * sin(theta) * cos(Phi);
pt.Y = ptCentre.Y + r * cos(theta);
This will not work for rotating the hexagon at 45 degree angle. I am not able to find the math/code for doing rotations at any angle, not just around x or y axis.
Reply
Answers (
1
)
how to populate data in data grid from table of sql server
GetElementById() not working