V
V
Vasily Demin2015-05-03 23:26:37
Programming
Vasily Demin, 2015-05-03 23:26:37

How to make three sf::RectangleShape objects line up (sfml library, c++ language)?

I need three objects to rotate as one. That's how it should be 4c72455ae6344a84ac9a91e3f619c5ce.png, and that's how it turns out 2760d269f3b24c52bf01491bcfd87c8a.png. That is, instead of being rotated as one object, the three objects are rotated separately. Getting to the point, I need to find x2, y2 if x1, y1, width, height and rotation angle are known. Here is the drawing. 781550a834624a50a043cf5fc40cc8c9.pngIn the answer I would like to see the formula.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2015-05-03
@includedlibrary

Hook your rectangles into a hierarchy and rotate the parent.

M
maaGames, 2015-05-04
@maaGames

You need to rotate not around the center of the object, but around the axis of rotation. In this case, the axis of rotation passes outside the objects.
If transformation matrices are used, then first you need to move, then rotate, and not first rotate and then move.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question