title: How to work with floating point coordinates for Java's Graphics2D?
body: <p>So, I've got a fairly typical </p>
  
  <pre><code>public void paint(Graphics g) 
  </code></pre>
  
  <p>method, which I'm using to do things like</p>
  
  <pre><code>g2.drawOval(200+s.getX().intValue(), 200+s.getY().intValue(), 3, 3);
  </code></pre>
  
  <p>after casting it to a Graphics2D object.</p>
  
  <p>My problem is that I have coordinates expressed in floating point types, in this case, Doubles. What I want is values that are arbitrarily small, that can be scaled to make them actually perceptible. Seeing as how </p>
  
  <p>a) the drawing methods in Graphics2D require ints on input, </p>
  
  <p>b) the scaling is an independent step and </p>
  
  <p>c) my original values need to be int-ified without regards to scaling, I have some concerns whether this will display stuff properly.</p>
  
  <p>Indeed, if I set the raw coordinates to a tiny values, then apply scaling to compensate, the result is predictable: the coordinates are treated as zero, because that's what they approximate to when being int-ified. </p>
  
  <p>Is there some way to get around this so that I have both floating point coordinates and scaling which works?</p>