title: Two points rotating around same center but distance grows
body: <p>I want to achieve that two points are rotating around each other. I therefore use a rotation matrix. However I now get the problem that the distance between the points is growing (see atached video <a href="https://www.dropbox.com/s/0cifen1b7jx5d2z/output2.avi" rel="nofollow">1</a>). The distance however should stay constant over my whole simulation.</p>
  
  <p>Here is my code I use for calculating the speed:</p>
  
  <p>Where p1 and p2 are the two points. </p>
  
  <pre><code>double xPos = p0.x+p1.x;
  double yPos = p0.y+p1.y;
  //The center between p1 and p2
  xPos /=2;
  yPos /=2;
  //the rotating angle
  double omega = 0.1;
  //calculate the new positions
  double x0new = xPos + (p0.x-xPos)*std::cos(omega) - (p0.y-yPos)*std::sin(omega);
  double y0new = yPos + (p0.x-xPos)*std::sin(omega) + (p0.y-yPos)*std::cos(omega);
  double x1new = xPos + (p1.x-xPos)*std::cos(omega) - (p1.y-yPos)*std::sin(omega);
  double y1new = yPos + (p1.x-xPos)*std::sin(omega) + (p1.y-yPos)*std::cos(omega);
  //the speed is exatly the difference as I integrate one timestep
  p0.setSpeed(p0.x-x0new, p0.y-y0new);
  p1.setSpeed(p1.x-x1new, p1.y-y1new);
  </code></pre>
  
  <p>I then integrate the speed exactly one timestep. What is wrong in my calculation?</p>
  
  <p><em><strong>Update</em></strong>
  It seems that my integration is wrong. If I set the positions direct it works perfect. However I do not now what is wrong with this integration:</p>
  
  <pre><code>setSpeed(ux,uy){
       ux_=ux;
       uy_=uy;
  }
  // integrate one timestep t = 1
  move(){
       x = x + ux_;
       y = y + uy_;
  }
  </code></pre>
  
  <p><a href="https://www.dropbox.com/s/0cifen1b7jx5d2z/output2.avi" rel="nofollow">Video of my behaviour</a></p>