Package 

Class MultiTouchController.PointInfo


  • 
    public class MultiTouchController.PointInfo
    
                        

    A class that packages up all MotionEvent information with all derived multitouch information (if available)

    • Method Summary

      Modifier and Type Method Description
      Array<float> getXs() Return the array of X coords -- only the first getNumTouchPoints() of these is defined.
      Array<float> getYs() Return the array of Y coords -- only the first getNumTouchPoints() of these is defined.
      Array<float> getPressures() Return the array of pressures -- only the first getNumTouchPoints() of these is defined.
      Array<int> getPointerIds() Return the array of pointer ids -- only the first getNumTouchPoints() of these is defined.
      boolean isDown()
      boolean isMultiTouch() True if number of touch points greater than or equal to 2.
      int getAction()
      long getEventTime()
      void set(MultiTouchController.PointInfo other) Copy all fields from one PointInfo class to another.
      float getMultiTouchWidth() Difference between x coords of touchpoint 0 and 1.
      float getMultiTouchHeight() Difference between y coords of touchpoint 0 and 1.
      float getMultiTouchDiameterSq() Calculate the squared diameter of the multitouch event, and cache it.
      float getMultiTouchDiameter() Calculate the diameter of the multitouch event, and cache it.
      float getMultiTouchAngle() Calculate the angle of a multitouch event, and cache it.
      int getNumTouchPoints() Return the total number of touch points
      float getX() Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more.
      float getY() Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more.
      float getPressure() Return the pressure the first touch point if there's only one, or the average pressure of first and second touch points if two or more.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getXs

         Array<float> getXs()

        Return the array of X coords -- only the first getNumTouchPoints() of these is defined.

      • getYs

         Array<float> getYs()

        Return the array of Y coords -- only the first getNumTouchPoints() of these is defined.

      • getPressures

         Array<float> getPressures()

        Return the array of pressures -- only the first getNumTouchPoints() of these is defined.

      • getPointerIds

         Array<int> getPointerIds()

        Return the array of pointer ids -- only the first getNumTouchPoints() of these is defined. These don't have to be all the numbers from 0 togetNumTouchPoints()-1 inclusive, numbers can be skipped if a finger is lifted and the touch sensor is capable of detecting that thatparticular touch point is no longer down. Note that a lot of sensors do not have this capability: when finger 1 is lifted up finger 2becomes the new finger 1. However in theory these IDs can correct for that. Convert back to indices using MotionEvent.findPointerIndex().

      • isMultiTouch

         boolean isMultiTouch()

        True if number of touch points greater than or equal to 2.

      • set

         void set(MultiTouchController.PointInfo other)

        Copy all fields from one PointInfo class to another. PointInfo objects are volatile so you should use this if you want to keep track of thelast touch event in your own code.

      • getMultiTouchWidth

         float getMultiTouchWidth()

        Difference between x coords of touchpoint 0 and 1.

      • getMultiTouchHeight

         float getMultiTouchHeight()

        Difference between y coords of touchpoint 0 and 1.

      • getMultiTouchDiameterSq

         float getMultiTouchDiameterSq()

        Calculate the squared diameter of the multitouch event, and cache it. Use this if you don't need to perform the sqrt.

      • getMultiTouchDiameter

         float getMultiTouchDiameter()

        Calculate the diameter of the multitouch event, and cache it. Uses fast int sqrt but gives accuracy to 1/16px.

      • getMultiTouchAngle

         float getMultiTouchAngle()

        Calculate the angle of a multitouch event, and cache it. Actually gives the smaller of the two angles between the x axis and the linebetween the two touchpoints, so range is [0,Math.PI/2]. Uses Math.atan2().

      • getX

         float getX()

        Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more.

      • getY

         float getY()

        Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more.

      • getPressure

         float getPressure()

        Return the pressure the first touch point if there's only one, or the average pressure of first and second touch points if two or more.