Re: Mathematica input from graphics tablets?

*To*: mathgroup at smc.vnet.net*Subject*: [mg19169] Re: Mathematica input from graphics tablets?*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Tue, 10 Aug 1999 02:52:36 -0400*Organization*: University of Western Australia*References*: <7nlqah$bfq@smc.vnet.net> <7o3dp3$128$1@dragonfly.wolfram.com> <7obbeg$3ra@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Murray Eisenberg wrote: > I have spoken with a number of Mathematica users -- myself included -- > who would love _some_ sort of interactive graphical input. For example, > being able to click two points and have Mathematica return the graphics > Line object joining the two as result (or as part of the entire graphics > object created by additional clicks, etc.) and, as a side effect, > displaying the line segment as well. You might be interested in the forthcoming book (and associated MathLink packages) entitled MathLink: Network Programming with Mathematica by Chikara Miyaji and Paul Abbott which has been completed and is to be published by CUP. I've appended the contents below. The most relevant part is Chapter 13. > One could imagine (dream of) additional capabilities, e.g., getting a > circular arc by specifying endpoints and center; a Bezier curve from > control points, etc. Indeed. > A GENERAL input mechanism would seem to be the way to go here. That is, > one way to input the points would be directly by clicking into a > notebook cell; another, obviously requiring an additional interface, > would allow graphics tablet input. And a general input mechanism means an external (perhaps Java) program communicating with Mathematica via MathLink. And you of course want full (Mathematica and external) programmability. > I hesitate to suggest that Mathematica should itself consist of > everything _including_ the proverbial "kitchen sink" (sorry for the > American English idiom here). But this is one thing that seems to > obvious to want to include. Agreed -- but MathLink is the best approach to adding such functionality. The book consists of two parts: Basics and Applications. The fundamentals of MathLink -- templates, data transfer model, and transfer time -- are explained in Basics. The Applications section demonstrates a wide range of MathLink application programs including a QuickTime movie interface and a graphical user interface (GUI) program. Basics Chapter 1. Introduction In this chapter, using a C compiler with the MathLink Library is discussed. In addition, basic information related to MathLink is presented. Chapter 2. Connecting the Front End and the Kernel Network basics are reviewed here and several ways to connect the kernel and front end are described. Two basic concepts of MathLink -- Create and Connect -- are then discussed. Using Mathematica functions, simple network programming is described and a basic packet monitor is implemented. Chapter 3. Compile AddTwo Program Here we build the AddTwo sample project. Modifying the source code, the data format of MathLink is then discussed. The MathLink template mechanism is also described. Chapter 4. Transfer Time using MathLink When you design a MathLink program, it is important to know how long it takes for data transfer. This chapter introduces MathLink list transfer, builds a tool for measuring transfer time, and does some experimentation about data transfer on various computers. Chapter 5. Debugging MathLink Programs In general, programs require debugging. This chaper describes this process for MathLink programs and demonstrates other debugging methods including print statements and the use of dialogs. Applications Chapter 6. Turtle Graphics Although Mathematica has excellent graphics, it does not include real-time graphics. In this chapter, a real-time graphics program using Macintosh's QuickDraw toolbox is created and the Turtle Graphics application is implemented using this program. Chapter 7. Cellular Automata In this chapter, a graphics program which shows cellular automata in real-time is created as an extension of the previous chapter. Also, the extension of these programs to make them work with multiple windows is described. Chapter 8. MovieDigitizer Here an interface to QuickTime movies is described. This program is based on a sample program from the Ultimate Mac Programming book. Turning it into a MathLink program makes Mathematica an analysis tool for movies. Chapter 9. Object-Oriented Programming After introducing an object-oriented programming (OOP) style for Mathematica -- heavily used in later chapters -- Class and Inheritance are discussed. Chapter 10. Creating an Event Driven Mechanism In this chapter, we build Serializer. This application enables MathLink template programs to send events to the kernel asynchronously. Using Serializer we can send events from multiple MathLink programs to one kernel. The event format and event sending mechanism of Serializer is described in detail since Serializer is a fundamental tool for later chapters. Chapter 11. Creating A Window Object Combining real-time graphics, the event sending mechanism, and OOP, a window object is created. Using this synergy we can define the response to events through simple Mathematica functions. As an example of this approach, a free-hand drawing application is implemented using just a few lines of Mathematica code. Chapter 12. Window Object Applications Here the window object developed in the previous chapter is extended to provide an interactive interface for the simulation of a cellular automata "Forest Fire". A second application is MathPaint, an application which mimics painting software and is an extension of the free-hand drawing program of chapter 11. The purpose of this chapter is to show how easy it is to customize window objects for special purposes. Chapter 13. Writing an Interactive Graphics System In this chapter we introduce point, line, curve, and text objects as window objects. Using the event-driven mechanism introduced in Chapter 10, these objects provide real-time interactive graphics which the current front end does not support. Two applications -- interactive geometry and interactive curve fitting -- are demonstrated. Coupling Mathematica's power with interactive graphics makes it easy to create sophisticated graphics applications. Chapter 14. Communication Between Mathematica Sessions This chapter shows how to link multiple Serializer sessions. Such a link enables us to send expressions between Mathematica sessions and assists cooperative work. For example, a user can copy and paste cell expressions to another session over the network, or exchange messages with other users. Hence Serializer becomes a communication tool between Mathematica sessions and is one powerful extension of this simple MathLink application. ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________