Once in a great while, a revolutionary and exciting new way of interacting with technology comes along. Leap Motion makes natural gesture-based interfaces a reality, and gives software developers access to a large and powerful set of features and capabilities. This guide is for software engineers who wish to get an overview of the Leap Software Development Kit modules, types and interfaces in C++ along with some guidelines for getting the most out of your Leap device and creating usable, gestural software interfaces.
Chapter 1, Leap Motion SDK – A Quick Start, explores how to begin using the Leap C++ SDK right away, with a sample mouse control program. It covers how to receive frame updates and read finger position data.
Chapter 2, Real Talk – Real Time, guides you through writing a multithreaded MIDI controller, which uses a blocking OS call without sacrificing responsiveness.
Chapter 3, Actual Gestures, covers a high-level discussion of gesture interfaces and a look at the available Leap SDK recognizers. It also covers creating an interface to manipulate Windows OS.
Chapter 4, Leap and the Web, teaches you how to create Leap-enabled web pages, using JavaScript with the LeapJS library, with no additional installation or configuration.
Chapter 5, HTML5 Antics in 3D, combines LeapJS, WebGL, and Three.js together to manipulate objects in 3D space in a web page using Leap Motion.
You will need a working knowledge of basic C++ and a compiler. Additional demonstration operating system-specific code is provided for Mac OS X APIs, but neither OS X nor familiarity with it is a requirement. An understanding of basic geometry and concepts such as vectors is useful for spatial manipulations.
This book is for developers with an interest in using the Leap Motion input device with their software. This book gives a broad overview of most of the available functionality in the Leap SDK, which can be transferred to any of the supported language interfaces, as the data types and routines are nearly identical.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "We can include other contexts through the use of the include
directive."
A block of code is set as follows:
if (frame.hands().empty()) return; const Leap::Hand firstHand = frame.hands()[0]; const Leap::FingerList fingers = firstHand.fingers();
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
namespace leapmidi { typedef double midi_control_value_raw; typedef unsigned short midi_control_value;
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, for example, appear in the text like this: "Prepare to be astounded when you point at the middle of your screen and the transfixing message, You are pointing at (0.519522, 0.483496, 0), is revealed".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you. You can also find the updated code samples at https://github.com/openleap/leapbook.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.