I've been trying to solve for this a while now. What I am trying to do is to find the coordinates of a point on an object while it rotates. After digging around I have found the following equation which in it's basic form is what I want
x = x*cos(θ) - y*sin(θ) y = x*sin(θ) + y*cos(θ)
With the screenshots below I've attached a white dot to the point I'm currently tracking which is really just the X Y of the red rectangle. As you can see assuming the middle screenshot is my starting point I want to have the white square be in the same spot regardless of rotation. Right now (because rotation isnt being taken into account) the white dot movies around on the rectangle as it rotates.
I know I need to take rotation into account but I'm not sure how to go about calculating it. This red rectangle moves about another object that is attached to a flexible joint so the coordinates of rotation aren't something particularly easy to come by. The rotation point of the red rectangle is center top, however.
Can anyone guide me in the right direction?