title: Rotate a shape by 90 degrees
body: <p>I trying to rotate a shape by 90 degrees  .</p>
  
  <p>my shape is held by a class which has few points of (x,y) and lines of (point1,point2) which all the lines together component the shape.</p>
  
  <p>Actually in order to rotate a shape by 90 (or any other angle) degrees it should transform the points of the shape by to follow formula  - </p>
  
  <pre><code>(x,y) -&gt; (  x*cos(90)+y*sin(90) , -x*sin(90)+y*cos(90)  )  
  </code></pre>
  
  <p>so to achieve the above I tried the follow (it operated on each point which is component of the shape ) -</p>
  
  <pre><code>float x, y;
  // get the current point location ...
  x = currentPoint.x;
  y = currentPoint.y; 
  // create the cos , sin
  float cosA = (float) Math.cos(Math.toRadians(90));
  float sinA = (float) Math.sin(Math.toRadians(90));
  currentPoint.x = (int) (x * cosA + y * sinA);
  currentPoint.y = (int) (-x * sinA + y * cosA);
  </code></pre>
  
  <p>but it gives very weird result when I draw the shape after this rotation  . </p>
  
  <p>Can you detect something wrong in this implementation  ?  </p>