title: Java 2d exploded pie chart segments
body: <p>I'm trying to add some distance (e.g. 10px) between a segment (arc) of the pie chart and it's center without success, here's what i've tried so far:</p>
  
  <p><a href="https://i.stack.imgur.com/kzfDg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kzfDg.png" alt="enter image description here"></a></p>
  
  <pre><code>int value = 20; // example
  double arcAngle = (value * 360 / 100);
  double angle = 360 - (arcAngle / 2); // direction to add the distance to (center of arc)
  double newX = pieCenterX + Math.cos(angle * Math.PI / 180.0) * 10;
  double newY = pieCenterY + Math.sin(angle * Math.PI / 180.0) * 10;
  
  // then drawing the arc with new x and y
  g.fill(new Arc2D.Double(newX, newY, bounds.getWidth(), bounds.getHeight(), startAngle, arcAngle, Arc2D.PIE));
  </code></pre>
  
  <p>Ideally i should end up with something like that:</p>
  
  <p><a href="https://i.stack.imgur.com/6mO6t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6mO6t.png" alt="enter image description here"></a></p>
  
  <p>I don't know much on how to approach this, so my code was taken from examples i found elsewhere.</p>