Tracking a point on an object during rotation

1,440

If this is all in 2D, you have the coordinates of a point on the object, and want the coordinates of another point on the object, you can call the position of the known point $(x_0,y_0)$ and the offset from the known point to your dot $(x_1,y_1)$ when the rotation is $0$. Then at any time your dot is at $(x_0+x_1 \cos \theta -y_1 \sin \theta,y_0+y_1 \cos \theta +x_1 \sin \theta)$, which is just applying your equations to the known point.

If this is 3D the same basic idea applies, but you need three coordinates and two angles to specify the position of your dot. If we measure the angles from when the dot is above the fixed point by distance $r$, the position is $(x_0+r\cos \phi \sin \theta,y_0+r\sin \phi \sin \theta,z_0+r\cos \theta)$ where $\theta$ is a rotation around $y$ and $\phi$ is a subsequent rotation around $z$

Is this the sort of thing you were after?

Share:
1,440

Related videos on Youtube

methodin
Author by

methodin

Developer extraordinaire: PHP, jQuery, TWIG, Limonade, Android, PHPUnit, Apache, Ubuntu

Updated on October 25, 2020

Comments

  • methodin
    methodin about 3 years

    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?

    enter image description here

    enter image description here

    enter image description here

  • methodin
    methodin about 12 years
    I think you are kind of on the right track. I modified my question a tad to be more concise. Basically I want the white dot to always remain in the same spot as the second screenshot regardless of rotation. In the first it looks like the dot is in the same place as it would be if the rectangle was rotated 90 degrees to the right, but since I'm not taking the rotation into account it "moves around" as the rectangle rotates.
  • Ross Millikan
    Ross Millikan about 12 years
    Then you can reverse the equations to determine where the other point on the rectangle has to be. Presumably that is the joint location.