/** Gets the rotation in radians */
 public float getRotation() {
   if (mDetector.getCount() < 2) {
     return 0;
   } else {
     float startDeltaX = mDetector.getStartX()[1] - mDetector.getStartX()[0];
     float startDeltaY = mDetector.getStartY()[1] - mDetector.getStartY()[0];
     float currentDeltaX = mDetector.getCurrentX()[1] - mDetector.getCurrentX()[0];
     float currentDeltaY = mDetector.getCurrentY()[1] - mDetector.getCurrentY()[0];
     float startAngle = (float) Math.atan2(startDeltaY, startDeltaX);
     float currentAngle = (float) Math.atan2(currentDeltaY, currentDeltaX);
     return currentAngle - startAngle;
   }
 }
 /** Gets the scale */
 public float getScale() {
   if (mDetector.getCount() < 2) {
     return 1;
   } else {
     float startDeltaX = mDetector.getStartX()[1] - mDetector.getStartX()[0];
     float startDeltaY = mDetector.getStartY()[1] - mDetector.getStartY()[0];
     float currentDeltaX = mDetector.getCurrentX()[1] - mDetector.getCurrentX()[0];
     float currentDeltaY = mDetector.getCurrentY()[1] - mDetector.getCurrentY()[0];
     float startDist = (float) Math.hypot(startDeltaX, startDeltaY);
     float currentDist = (float) Math.hypot(currentDeltaX, currentDeltaY);
     return currentDist / startDist;
   }
 }
 /**
  * Handles the given motion event.
  *
  * @param event event to handle
  * @return whether or not the event was handled
  */
 public boolean onTouchEvent(final MotionEvent event) {
   return mDetector.onTouchEvent(event);
 }
 /** Resets the component to the initial state. */
 public void reset() {
   mDetector.reset();
 }
 /** Factory method that creates a new instance of TransformGestureDetector */
 public static TransformGestureDetector newInstance() {
   return new TransformGestureDetector(MultiPointerGestureDetector.newInstance());
 }
 public TransformGestureDetector(MultiPointerGestureDetector multiPointerGestureDetector) {
   mDetector = multiPointerGestureDetector;
   mDetector.setListener(this);
 }
 /** Gets the Y component of the translation */
 public float getTranslationY() {
   return calcAverage(mDetector.getCurrentY(), mDetector.getCount())
       - calcAverage(mDetector.getStartY(), mDetector.getCount());
 }
 /** Gets the Y coordinate of the pivot point */
 public float getPivotY() {
   return calcAverage(mDetector.getStartY(), mDetector.getCount());
 }
 /** Gets whether gesture is in progress or not */
 public boolean isGestureInProgress() {
   return mDetector.isGestureInProgress();
 }
 /** Restarts the current gesture */
 public void restartGesture() {
   mDetector.restartGesture();
 }