x and y complex calculation

Darkwing

New member
Joined
Jun 15, 2014
Messages
7
Hello all, this is my first post and I hope I am doing this right.

I have a problem that is stumping me. I need to be able to calculate the x and y coordinates mathematically from rotating an object about a center point. So if my center point is (A, B), and a second point is (C, D), and A = 0; B = 0; C = -64; D = 32, then if I rotate (C, D) about point (A, B) 5 degrees, how do I calculate the new values for C and D? I hope this question is clear and thank you for any help you can provide.
 
You gave us no idea what you can do; try this:

Isosceles triangle ABC, AB=AC=10, angle A = 35 degrees.
Can you calculate length of BC?

If not, you're not ready for this.

ok, easy. Angle B is (180-35)/2 which is 72.5. then just SIN 72.5/10 = SIN 35/BC so BC = ~6

What should I do to calculate my x and y problem?
 
Hello all, this is my first post and I hope I am doing this right.

I have a problem that is stumping me. I need to be able to calculate the x and y coordinates mathematically from rotating an object about a center point. So if my center point is (A, B), and a second point is (C, D), and A = 0; B = 0; C = -64; D = 32, then if I rotate (C, D) about point (A, B) 5 degrees, how do I calculate the new values for C and D? I hope this question is clear and thank you for any help you can provide.

Assuming counterclockwise as positive Θ, then (x,y) will transform to (x',y') where,

x' = x*cos(Θ) - y*sin(Θ)

and

y' = x*sin(Θ) + y*cos(Θ)

Google is a wonderful resource - you just have to be able to read it http://en.wikipedia.org/wiki/Rotation_(mathematics))
 
Last edited by a moderator:
Assuming counterclockwise as positive Θ, then (x,y) will transform to (x',y') where,

x' = x*cos(Θ) - y*sin(Θ)

and

y' = x*sin(Θ) + y*cos(Θ)

Google is a wonderful resource - you just have to be able to read it http://en.wikipedia.org/wiki/Rotation_(mathematics))

I tried this but it did not work. I edited it as such:

x' = (x1-x2)*cos(O) + x2 - (y1-y2)* sin(O)

y' = (x1-x2)*sin(O) + y2 - (y1-y2)* cos(O)

and got a closer result. The second object rotates around the first, but spirals inward until x' = x2 and y' = y2.

Any further suggestions? (sorry I don't know how to do the theta symbol)
 
Quote Originally Posted by Subhotosh Khan View Post

Assuming counterclockwise as positive Θ, then (x,y) will transform to (x',y') where,


I tried this but it did not work. I edited it as such:

x' = (x1-x2)*cos(O) + x2 - (y1-y2)* sin(O)

y' = (x1-x2)*sin(O) + y2 - (y1-y2)* cos(O) x' = x*cos(Θ) - y*sin(Θ)

and

y' = x*sin(Θ) + y*cos(Θ)


and got a closer result. The second object rotates around the first, but spirals inward until x' = x2 and y' = y2.
why is it so complicated?
try
x' = x*cos(Θ) - y*sin(Θ)
y' = x*sin(Θ) + y*cos(Θ)
one more time, check each step carefully
 
why is it so complicated?
try
x' = x*cos(Θ) - y*sin(Θ)
y' = x*sin(Θ) + y*cos(Θ)
one more time, check each step carefully

I wish I knew! One error is that I told you guys the origin was 0,0. Well it isnt always. I need formulas that will account for the origin being any number of possible coordinates.

I checked it again, it only rotates about 0,0.
 
and got a closer result. The second object rotates around the first, but spirals inward until x' = x2 and y' = y2.
it is simple rigid rotation problem. I don't how do you get "spirals inward until x' = x2 and y' = y2."
 
If you want to rotate points around center point \(\displaystyle (x_0, y_0)\), through angle \(\displaystyle \theta\), first translate so that \(\displaystyle (x_0, y_0)\) is the center point: (x, y) maps to \(\displaystyle (x', y')= (x- x_0, y- y_0)\). Then rotate counterclockwise through angle \(\displaystyle \theta\) with the matrix multiplication \(\displaystyle \begin{bmatrix}x'' \\ y''\end{bmatrix}= \begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}\begin{bmatrix}x' \\ y'\end{bmatrix}\). Finally, translate center point back: \(\displaystyle (x'', y'')= (x'+x_0, y'+ y_0)\). Those can all be put together as \(\displaystyle (x, y)=> ((x- x_0)cos(\theta)- (y- y_0)sin(\theta)+ x_0, (x- x_0)sin(\theta)+ (y- y_0)cos(\theta)+ y_0)\).
 
If you want to rotate points around center point \(\displaystyle (x_0, y_0)\), through angle \(\displaystyle \theta\), first translate so that \(\displaystyle (x_0, y_0)\) is the center point: (x, y) maps to \(\displaystyle (x', y')= (x- x_0, y- y_0)\). Then rotate counterclockwise through angle \(\displaystyle \theta\) with the matrix multiplication \(\displaystyle \begin{bmatrix}x'' \\ y''\end{bmatrix}= \begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}\begin{bmatrix}x' \\ y'\end{bmatrix}\). Finally, translate center point back: \(\displaystyle (x'', y'')= (x'+x_0, y'+ y_0)\). Those can all be put together as \(\displaystyle (x, y)=> ((x- x_0)cos(\theta)- (y- y_0)sin(\theta)+ x_0, (x- x_0)sin(\theta)+ (y- y_0)cos(\theta)+ y_0)\).

This is what I had originally come up with, however when I put this into the system it makes the object spiral inwards. I have decided it must be a software issue. Thanks all for the assistance.
 
If you want to rotate points around center point [FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT], through angle [FONT=MathJax_Math]θ[/FONT], first translate so that [FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT] is the center point: (x, y) maps to [FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]′[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]′[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]=[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT]. Then rotate counterclockwise through angle [FONT=MathJax_Math]θ[/FONT] with the matrix multiplication [FONT=MathJax_Size3][[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]′′[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]′′[/FONT][FONT=MathJax_Size3]][/FONT][FONT=MathJax_Main]=[/FONT][FONT=MathJax_Size4][[/FONT][FONT=MathJax_Math]c[/FONT][FONT=MathJax_Math]o[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Math]i[/FONT][FONT=MathJax_Math]n[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Math]i[/FONT][FONT=MathJax_Math]n[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Math]c[/FONT][FONT=MathJax_Math]o[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Size4]][/FONT][FONT=MathJax_Size3][[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]′[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]′[/FONT][FONT=MathJax_Size3]][/FONT]. Finally, translate center point back: [FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]′′[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]′′[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]=[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]′[/FONT][FONT=MathJax_Main]+[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]′[/FONT][FONT=MathJax_Main]+[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT]. Those can all be put together as [FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]=[FONT=MathJax_Main]>[/FONT][/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Math]c[/FONT][FONT=MathJax_Math]o[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Math]i[/FONT][FONT=MathJax_Math]n[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]+[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main],[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]x[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Math]i[/FONT][FONT=MathJax_Math]n[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]+[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]−[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Math]c[/FONT][FONT=MathJax_Math]o[/FONT][FONT=MathJax_Math]s[/FONT][FONT=MathJax_Main]([/FONT][FONT=MathJax_Math]θ[/FONT][FONT=MathJax_Main])[/FONT][FONT=MathJax_Main]+[/FONT][FONT=MathJax_Math]y[/FONT][FONT=MathJax_Main]0[/FONT][FONT=MathJax_Main])[/FONT].
This is what I had originally come up with, however when I put this into the system it makes the object spiral inwards. I have decided it must be a software issue. Thanks all for the assistance.

You should have told that to us - giving us the equations - and we would have spent our time to fix the graphical problem you are facing. However now, after spending all this time, we are back to the starting point.

In the future, please be explicit and complete with your problem statement! That is the first step - probably the most crucial step of problem solution.
 
I tried this but it did not work. I edited it as such:


x' = (x1-x2)*cos(O) + x2 - (y1-y2)* sin(O)


y' = (x1-x2)*sin(O) + y2 - (y1-y2)* cos(O)


and got a closer result. The second object rotates around the first, but spirals inward until x' = x2 and y' = y2.


Any further suggestions? (sorry I don't know how to do the theta symbol)

Since you are being ugly, here is a quote by me from page one. I DID tell you this. Please read before accusing me. I have found a non-math solution, thanks everyone for your efforts.
 
Last edited by a moderator:
Since you are being ugly, here is a quote by me from page one. I DID tell you this. Please read before accusing me. I have found a non-math solution, thanks everyone for your efforts.

You did not tell us that ORIGINALLY. Your first post:

I have a problem that is stumping me. I need to be able to calculate the x and y coordinates mathematically from rotating an object about a center point. So if my center point is (A, B), and a second point is (C, D), and A = 0; B = 0; C = -64; D = 32, then if I rotate (C, D) about point (A, B) 5 degrees, how do I calculate the new values for C and D? I hope this question is clear and thank you for any help you can provide.

That's what you had asked for!!
 
you are being ugly

read before accusing

Hi Darkwing:

Seems like you were frustrated, at the time you posted this. It's healthy to blow off steam, but try to keep it off the boards.

This is a tutoring website, in a public forum. Individuals who seek help in this setting need to be able to accept constructive criticism.

Constructive criticism is a suggestion, not a personal attack. Hence, Subhotosh's reply is neither ugly nor an accusation; it is a suggestion.

We're glad that you were able to reach a solution. For the benefit of future readers, please consider posting how you worked it out.

Cheers ~ MarkBot :cool:
 
Last edited:
This is what I had originally come up with, however when I put this into the system it makes the object spiral inwards. I have decided it must be a software issue. Thanks all for the assistance.
Probably round off error.
 
Top