![]() ![]() But it requires five multiplications, three trig functions, a square root and an addition, which is way more computation than necessary. This is the correct answer, and it works for points in all quadrants and all rotation angles, including negative angles. If you plug in 5 and 66.87 for r and θ, you find that the rotated point ( x 1, y 1) = (1.964, 4.598). The x coordinate of the rotated point is rcos( θ), and the y coordinate is rsin( θ).You do this by adding 36.87°+30°, to get a rotated angle of 66.87°. The atan2() function accepts the x and y arguments separately, and so produces the correct answer in all four quadrants.) (Note: If you’re writing a computer program, you need to use the function atan2() instead of atan(). If you plug in (4,3) for ( x, y), you find that θ=36.87°. The angle can be found using trigonometry: θ = tan -1( y/ x). ![]() If you plug in (4,3) for ( x, y), you find that r = 5. The distance from the origin can be found using the Pythagorean Theorem: r 2 = x 2+ y 2.Polar coordinates define the location of a point by its distance from the origin ( r) and angle from the x-axis ( θ). If you’ve taken high school trigonometry, you might come up with a solution like this:Ĭonvert the point from Cartesian to polar coordinates. Take the point (4,3) and rotate it 30 degrees around the origin in a counterclockwise direction. This is a very common operation used in everything from video games to image processing. This tutorial describes the efficient way to rotate points around an arbitrary center on a two-dimensional (2D) Cartesian plane. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |