Main content

### Course: Pixar in a Box > Unit 14

Lesson 2: Mathematics of rotation# 3. Completing the proof

In this video, we'll discuss the geometry of rotation. We can find the new coordinates of a point after it's been rotated around the origin using the concepts of sine, cosine, and similar triangles to derive the formulas for the new coordinates.

## Want to join the conversation?

- yo I don't get any of this(8 votes)
- How can you come up with the equation x'=x*cosθ - y*sinθ

from:

x'=sqrt(x^2 + y^2) * cos(θ + arccos(x/sqrt(x^2 + y^2))) ?

Thanks(5 votes)- 2 years late, but here you go https://samybencherif.github.io/RotationProof/(0 votes)

- At3:17, there was a thing that was saying how they made a mistake in the formula when they wrote it down, but I didn't even notice cuz I was so confused about the equation in da first place lol XD(2 votes)
- Is there a way to calculate coordinates for rotating around another point? not just the origin?(1 vote)
- translate to the origin, rotate and translate back with the inverse of the original translation(2 votes)

- What about for 3 dimensional objects?(1 vote)
- I'm taking the rigging class and I cannot figure out how to complete this problem

blank = x * cos( blank ) - y * sin( blank );

blank = x * sin( blank ) + y * cos( blank );(0 votes)- The blanks inside
`cos()`

and`sin()`

will be the angle, in this case,`value`

. The first line calculates the value for`coordinate.x`

, the second for`coordinate.y`

.(3 votes)

- why exactly do we drop a line from p' straight down to the line r?(1 vote)
- Is there a way to calculate coordinates for rotating around another point? not just the origin?(1 vote)
- go and do the to step(1 vote)

## Video transcript

(Springing sound) - In the previous exercise, you should have found that length OA is R cosine theta. But why? First notice that OPA is a right triangle. So we can use sine and cosine. OA is the side adjacent to theta. Meaning that OA equals R cosine theta. Similarly, AP prime equals R sine theta. Good. So we need to show that angle DP prime A is phi. That's because there are similar triangles lurking in there. In particular, this triangle, and this triangle are similar. To see that, notice that this angle is equal to this angle. Because of the opposite angle theorem, notice also that this angle is 90 degrees, as is this angle. Meaning that the two triangles share two angles. They must also share the third angle, because all three angles must add up to 180 degrees. Thus, CP prime A is phi. Now we're set. One thing we're looking for is this distance, OC, because that's X prime. As we observed earlier, OC is equal to OB minus BC. So X prime equals OB minus BC. And since BC equals AD, we can write X prime equals OB minus AD. But what's OB? It's adjacent to phi, so cosine phi equals OB over OA. And we know that OA equals R cosine theta. So cosine phi equals OB over R cosine theta. And OB equals R cosine theta, cosine phi. So OB equals R cosine phi times cosine theta. But we know that R cosine phi is just X, so OB equals X cosine theta. Now what's AD? Well, AD is opposite phi in the triangle DP prime A. So sine phi equals AD over AP prime. And we know that AP prime equals R sine theta. So sine phi equals AD over R sine theta, which means that AD equals R sine theta sine phi. Which can be rearranged to be R sine phi times sine theta, and we know that R sine phi is just Y. So AD equals Y sine theta. Okay, so that means X prime equals X cosine theta minus Y sine theta. So we're halfway there. Now we just need to know what Y prime is. CP prime is Y prime, and it can be written as CP prime equals DP prime plus AB. DP prime is adjacent to phi, so cosine phi equals DP prime over AP prime. But AP prime is R sine theta. So, cosine phi equals DP prime over R sine theta. And DP prime equals R sine theta times cosine phi, which equals X sine theta. AB is opposite phi, so sine phi equals AB divided by OA. But OA is R cosine theta, so sine phi equals AB over R cosine theta. And that means AB equals R sine phi times cosine theta. But R sine phi is just Y, so AB equals Y cosine theta. Putting this together Y prime equals X sine theta plus Y cosine theta. Yay! We did it! In summary, X prime equals X cosine theta minus Y sine theta and Y prime equals X sine theta plus Y cosine theta. You hung in there, and now you've seen a super useful and prevalent formula. Whether you're doing computer graphics or building bridges or triangulating positions, you're gonna see these formulas come up again and again and again. Use the next exercise to get some practice with them.