title: Java planetary orbit simulation: centering planets
body: <p>I've created a simple planetary simulation where a planet orbits a star.
  The code for the orbit is this:</p>
  
  <pre><code>    a = a + vel * delta;
      planetX = Math.cos(a) * orbitRadius + parentStar.getX();
      planetY = Math.sin(a) * orbitRadius + parentStar.getY();
  </code></pre>
  
  <p>Now that works just fine, but my problem is that the orbit is not from the center of the planet around the center of the star.
  <a href="http://i.stack.imgur.com/QD0Ls.png" rel="nofollow">This is what happens</a></p>
  
  <p>As you can see, the first red dot on the small circle is the Position of the planet wich orbits around the second small red dot, this is because the circle is drawn from (0,0), so both the planets (0,0) circles around the (0,0) of the star.</p>
  
  <p>I need the the center of the planet to circle the stars center, not their origin point.</p>
  
  <p>Is there a good fix for this?</p>