TouchTokens

Reference

ACM version R. Morales Gonzalez, C. Appert, G. Bailly and E. Pietriga. (2016). TouchTokens: Guiding Multi-Touch Patterns with Passive Tokens. In Proc. ACM Conference on Human Factors in Computing Systems, CHI 2016. ACM Press, New York, NY, May 2016, pages 4189-4202.

Fabrication

The following PDF file contains the vector shapes for the 6 tokens. Document size (for printing or laser cutting): 300 x 600mm.

If you want to use flexible tokens that can be squeezed and bent, check out the following vector descriptions: PDF file or Adobe Illustrator file.

Recognizers

Two implementations are available:

TUIO API

Test

     // e.g., with a touchpad of 105mm x 75mm with TUIO running on port 3333
     mvn clean package
     ./run.sh -tuio 3333 -inputWidth 105 -inputHeight 75
  

Use

TouchTokenListener is an interface that implements callback methods for TouchTokens events. Each callback delivers the id of the token, the touch points normalized in the input surface space ((0,0) is the top left corner and (1,1) is the bottom right corner) and the size of the input surface in millimeters.

     TokenListener listener = new TokenListener() {

        protected DecimalFormat df = new DecimalFormat("0.0000");

        public void tokenDown(TokenEvent event) {
           TouchPoint centroid = TouchTokenRecognizer.centroid(event.getPoints());
           System.out.println("+ "+event.tokenID+" ("+df.format(centroid.x)+", "+df.format(centroid.y)+")");
        }

        public void tokenMoved(TokenEvent event) {
           TouchPoint centroid = TouchTokenRecognizer.centroid(event.getPoints());
           System.out.println("~ "+event.tokenID+" ("+df.format(centroid.x)+", "+df.format(centroid.y)+")");
        }

        public void tokenUp(TokenEvent event) {
           TouchPoint centroid = TouchTokenRecognizer.centroid(event.getPoints());
           System.out.println("- "+event.tokenID+" ("+df.format(centroid.x)+", "+df.format(centroid.y)+")");
        }

     }

     ...

     TouchTokenRecognizer recognizer = new TouchTokenRecognizer(new File("templates/templates.txt"));
     TUIOManager tuioManager = new TUIOManager(recognizer, tuioPort, inputWidth, inputHeight);
     tuioManager.addTokenListener(listener);
	

Simple code examples

See classes Test, TestConsole, TestCanvas.

Android API

Test

Install TouchTokensDroid app.

Use

TouchTokenView is a subclass of android.view.View that implements callback methods for TouchTokens events. Each callback delivers the id of the token, the touch points normalized in the view space ((0,0) is the top left corner and (1,1) is the bottom right corner) and the size of the view in millimeters.

     public class TestView extends TouchTokenView {

        ...

        public void onTokenDown(String tokenID, ArrayList points, double viewWidthMm, double viewHeightMm) {
           // get the centroid of the touch points in normalized space
           TouchPoint centroid = TouchTokenRecognizer.centroid(points);
           Log.v("Token Input", ""+this.tokenID+" DOWN - centroid at "+centroid);

           // get token centroid location in pixels
           TouchPoint centroidPx = new TouchPoint(centroid.x * getWidth(), centroid.y * getHeight());
           // get token centroid location in millimeters
           TouchPoint centroidMm = new TouchPoint(centroid.x * viewWidthMm, centroid.y * viewHeightMm);
        }

        public void onTokenMoved(String tokenID, ArrayList points, double viewWidthMm, double viewHeightMm) {
           TouchPoint centroid = TouchTokenRecognizer.centroid(points);
           Log.v("Token Input", ""+this.tokenID+" MOVED - centroid at "+centroid);
        }

        public void onTokenUp(String tokenID, ArrayList points, double viewWidthMm, double viewHeightMm) {
           TouchPoint centroid = TouchTokenRecognizer.centroid(points);
           Log.v("Token Input", ""+this.tokenID+" UP - centroid at "+centroid);
        }
     }
  

Simple code examples

See class TestView.