rotate.frink

Download or view rotate.frink in plain text format


// Function to rotate a point [x,y] around a point [xc,yc] with the rotation
// angle theta (positive specifying a counterclockwise rotation).
//
// The coordinates represent Frink's coordinate system, with y increasing
// downward.
rotate[x,y,xc,yc,theta] :=
{
   c = cos[theta]
   s = sin[-theta]
   xd = x-xc
   yd = yc-y
   
   xprime = xc + c xd + s yd
   yprime = yc + s xd - c yd

   return [xprime, yprime]
}


Download or view rotate.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen, eliasen@mindspring.com