MIT 6 893 - How To Build a Sketch Based Interface

Unformatted text preview:

MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Lecture IntroductionHow To Build aSketch BasedInterfaceTevfik Metin Sezgin,Michael Oltmans,Randall Davis MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching2Consider This Device...MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching3Our Vision MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching4Our Model• The designersketches with penand paper• The observerinterprets the sketch• The observer anddesigner interactMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching5Demo• Conceptual mechanical design• Client– Low level sketch understanding– Recognize sketch as mechanicaldevice• Server– Simulate the recognized device MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching6How did we get here?• Low level sketch processing• Domain level recognition• Connection to existing design toolsMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching7Today’s goals• Learn to use the low level recognitiontoolkit• Learn how to build a simple sketchinginterface with the toolkit• Build your own interface to XfigAnd now, on to the Toolkit… MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching8• Given a freehand stroke, generatea geometric primitive– Lines– Circles– CurvesToolkit functionalityMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching9The Toolkit doesn’t do…• Higher level recognition (i.e., can’trecognize squares, rectangles, domainspecific shapes)• Gesture recognition MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching10TerminologySketch: Informal,messy diagramsconsisting of several strokesStroke: Array of timestampedpoints collected between pendown and pen up eventsMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching11Structure of an applicationSketchPanelStrokeDataListenerSimpleClassifierStrokeDataApplicationGeometricObject MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching12Package hierarchy• edu.mit.sketch.fig (SketchFig.java)• edu.mit.sketch.toolkit– Recognition related classes are here• edu.mit.sketch.geom– The geometry package• edu.mit.sketch.ui– User interface related classesMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching13Classes you will use mostoften• edu.mit.sketch.ui– SketchPanel• edu.mit.sketch.toolkit– StrokeData– SimpleClassifier• edu.mit.sketch.geom– GeneralPath– Polygon– Line– Ellipse– Point– Rectangle MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching14edu.mit.sketch.ui• SketchPanel– extends javax.swing.JPanel– Gathers stroke data– Displays raw strokes as they aredrawn– Has methods for adding andremoving StrokeDataListenersMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching15edu.mit.sketch.toolkit.StrokeData• This class holds and computes strokerelated information such as points inthe stroke, pen speed, curvature…• The constructor takes an array ofpoints• SketchPanel creates this object aftereach mouse up event MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching16edu.mit.sketch.toolkit.SimpleClassifier• Constructor takes a StrokeData object• Has a method int classify()• This method returns an int indicatingthe type of the approximationgenerated by the toolkit• Compare the result against thefollowing using a switch statement– SimpleClassifier.LINE– SimpleClassifier.ELLIPSE– SimpleClassifier.POLYGON– SimpleClassifier.COMPLEXMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching17edu.mit.sketch.toolkit.SimpleClassifier• One can also check for a particulartype by– SimpleClassifier.isLine()– SimpleClassifier.isEllipse()– SimpleClassifier.isPolygon()– SimpleClassifier.isComplex() MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching18edu.mit.sketch.toolkit.SimpleClassifier• Once the type is determined, theapproximation can be accessed by– Line getLineApproximation()– Ellipse getEllipseApproximation()– PolygongetPolygonApproximation()– GeneralPathgetComplexApproximation()MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching19Putting it all togetherpublic class XFigFrontendextends SketchPanelimplements StrokeDataListener {public XFigFrontend ( ) {addStrokeDataListener( this );}public void handleStroke( StrokeData stroke_data ){SimpleClassifier classifier =new SimpleClassifier( stroke_data );switch( classifier.classify() ) {case SimpleClassifier.LINE:...}}} MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching20How to get started• Compile and run– “make classpath” – only need to do this once foreach shell window– “make” – compiles the java files– java SketchTest• See how it uses the toolkit and the SimpleClassifier• Best strategy for understanding the control flow:find the handleStroke() method in TicTacToe.javaMIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching21How to get started• Compile and run– javac SketchTest.java* Java is not Python! ALWAYS recompile after makingchanges– <correct any errors!>– java SketchTest* don’t include the “.class” part of the name when running• Try compiling and running MyTTT (assuming I can find it)• See how it uses the toolkit and the SimpleClassifier• Best strategy for understanding the control flow: find thehandleStroke() method in TicTacToe.java MIT 6.893; SMA 5508 Spring 2004 Larry Rudolph Tutorial 10: Sketching22Resources• Javadoc documentation is includedwith toolkit– mozilla ~/assist/doc/index.html• Questions: contact Metin


View Full Document

MIT 6 893 - How To Build a Sketch Based Interface

Documents in this Course
Toolkits

Toolkits

16 pages

Cricket

Cricket

29 pages

Quiz 1

Quiz 1

8 pages

Security

Security

28 pages

Load more
Download How To Build a Sketch Based Interface
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view How To Build a Sketch Based Interface and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view How To Build a Sketch Based Interface 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?