P
P
ppxy2014-10-22 19:32:49
JavaScript
ppxy, 2014-10-22 19:32:49

How to implement this rotation?

Good afternoon.
Tell me, the implementation of this movement (see figure):
1) Rotation of point A counterclockwise. Coordinates start (0, 0)
2) Rotation of point B counterclockwise. Point A is the origin.
I tried to implement this rotation using matrices. All is well only as long as the point is at rest. I did it according to the formula T ^-1 R T. (shift to 0, rotate, return). When point A starts rotating, in this implementation, it is clearly not what it should be. Although I'm not sure. Because I can’t mathematically substantiate what kind of movement will be as a result of these transformations.
The question is the following. Did I start right? (with displacement, rotation, return)
Or is it a more complex problem from the field of mechanics?
a85d7a19e71a4ddfa2a530db6690b69c.png
Is there an implementation in js?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Novikov, 2014-10-22
@BOOMER_74

Use oCanvas . The example from the main page is very similar to your task.

E
Evgeny Petrov, 2014-10-22
@Petroveg

Yes, it seems simple - rotation around the center, whose coordinates move in a circular orbit.
If you do matrices, then it seems like you need to multiply in the order of displacement-rotation.
And if implemented with improvised means, then I prefer to move the coordinate system jsfiddle.net/4e4xtLng/1

R
Rsa97, 2014-10-22
@Rsa97

Let R a and R b be the rotation matrices of point A with respect to O and B with respect to A. C is an arbitrary point of the object whose movement is specified by points A and B. Then the rotation of point C will look like this:
С' = R a ×A + R b ×(C-A)
Accordingly, movement of point A:
A' = R a ×A
Movement of point B:
B' = R a ×A+R b ×(BA)

U
ukrainoid, 2014-10-22
@ukrainoid

get_image_small.jpg
You can compare with the implementation of software rotation from the article ukrainoid.com/688x
, it may be useful

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question