public void createRotation(int centerX, int centerY, float angle, Roi roi)
   /*
		  Put a rotation (over angle) flow field in flow, and
		  include the part within the current ROI.
		  Only the v.v within the roi will be valid.
   */
   {
		  Rectangle r=null;
		  if (roi instanceof Roi)
				r = roi.getBoundingRect();
		  int fulls = 0;
		  for (int y = 0; y < getHeight(); y++)
		  {
			  for (int x = 0; x < getWidth(); x++)
			  {
					// set to invalid.
					set(x, y, 0, 0, false);
					boolean doflag = ! (roi instanceof Roi);
					if (! doflag)
						doflag = x > r.x && x < r.x+r.width && y > r.y && y < r.y+r.height && roi.contains(x, y);
					if (doflag)
					{
						  // Compute expected velocity.
						  float [] fv = polar((x - centerX) + 0.5f, - (y - centerY) + 0.5f);
						  float [] expA = new float[2];
						  expA[0] = fv[0] * (float) Math.tan(-angle); // angular velocity in image units.
						  expA[1] = fv[1] + (float) Math.PI / 2;       // direction of angular velocity (+90 degrees)
						  float [] expG = new float[2];
						  FlowJFlow.toGrid(expG, expA);       // true displacement in pixels.
						  // put in flow.
						  set(x, y, expG[0], expG[1]);
						  fulls++;
					}
				}
			}
			IJ.write("Rotate "+centerX+", "+centerY+"; "+fulls+" pixels in flow field");
	}