Realm Master![]() Member Posts: 1971 From: USA Registered: 05-15-2005 |
aaahhh!!! i cant figure this out!!! Equasion for circular distance: (D = (square root of)[(x1 - x2)^2 + (y1 - y2)^2] got it, but here's MY delema: i want it so that when i "rotate" one point in my program, the other point "rotates too" such as like this. two points lie on the same line (or sorta) the "base" point roatates, and the far point moves so that it lies on a circle (depicting the greatest distance from the base point) always being the same distance from the base point. in otherwords: i want a joint to work, picture it like your elbow and hand: when you rotate your elbow, your hand moves in an arch. I want it like that, only, it can go in a whole circle because... bah! you get the idea... can i have a little help?
------------------ Blessed are those who suffer for doing what is right. PM ME YOUR DESCRIPTION OF ME! ILL PUT IT HERE! |
||
vincent![]() Member Posts: 129 From: Amersfoort, the Netherlands Registered: 12-23-2002 |
Well, if I understand what you mean you do there are several ways to go about... First of all, how did you define the points from the base point... for example, if you defined them by a distance and an angle, its quite simple...
Then its just a matter of changing the rotation. However, if the points are defined by an x and a y, you'll need to let good 'ole matrix multiplication do its work: http://mathworld.wolfram.com/RotationMatrix.html which basically says that:
which means that x' = x * cos(angle) + y * -sin(angle) I think.. though it has been a while ago... This basically means that if you have a point (1, 2) and you want to rotate it say, 45 degrees: x' = 1 * cos(45) + 2 * -sin(45) This always rotates around the 0 point... so, you'll need to substract some first, and add later... anyway, I hoped it helped a bit.. note that most programming languages use radiants.. so 45 degrees would be PI/4.... anyway... hope it helps, and I hope its correct, cause it has been a while. [This message has been edited by vincent (edited October 14, 2005).] |
||
Realm Master![]() Member Posts: 1971 From: USA Registered: 05-15-2005 |
dang, i HATE not kowing this stuff... thanks vincent!
gaaa! I cant seem to get it to work... bah! All of my other friends are enjoying their day, and i spend it (doing something i love to do, mind you) working on somehting that ill never finish. I Always, ALWAYS, run into something i dunno how to do... *sigh*... firemaker... how do you DO it??! (being a child prodegy and all ------------------ Blessed are those who suffer for doing what is right. PM ME YOUR DESCRIPTION OF ME! ILL PUT IT HERE! [This message has been edited by Realm Master (edited October 14, 2005).] |
||
vincent![]() Member Posts: 129 From: Amersfoort, the Netherlands Registered: 12-23-2002 |
Alright.. lemme try putting it into semi-code.
Then ofcourse we might want to know what the rotation is of a point from the given orgin. Note that most programming languages have a tan2(x,y) function.. which does exactly the same thing as this here under, except for the orgin thing. If it does, I suggest you use it. Then you only need to do the orgin substraction thing.
Well, I hope it helps a bit. I haven't tested it.. so it might be wrong, but it might give you some clue into what direction you are looking. |