title: How to rotate a polygon around a point with Java?
body: <p>I'm creating a Canvas object ( lines, vertices, triangle, ...) and I would like to apply to them a rotation around a point.</p>
  
  <p>I can't use the rotate() method of Canvas because points are attached to GeoPoint on a Map, so if I use the rotate() method the all map is rotating ...</p>
  
  <p>The problem is that Canvas needs Point(int,int) and applying a rotation creates double because of cos and sin functions. So when I apply the rotation to the all points, because of casting double to int, I have some graphical issue that happens...</p>
  
  <p>So I'm looking for the best solution.</p>
  
  <p>Here my rotation code :</p>
  
  <pre><code>public Point rotatePoint(Point pt, Point center)
  {
      this.angle = ((this.angle/180)*Math.PI);
      double cosAngle = Math.cos(this.angle);
      double sinAngle = Math.sin(this.angle);
  
      pt.x = center.x + (int) ((pt.x-center.x)*cosAngle-(pt.y-center.y)*sinAngle);
      pt.y = center.y + (int) ((pt.x-center.x)*sinAngle+(pt.y-center.y)*cosAngle);
      return pt;
  }
  </code></pre>