Book Image

Leap Motion Development Essentials

By : Mischa Spiegelmock
Book Image

Leap Motion Development Essentials

By: Mischa Spiegelmock

Overview of this book

Leap Motion is a company developing advanced motion sensing technology for human–computer interaction. Originally inspired by the level of difficulty of using a mouse and keyboard for 3D modeling, Leap Motion believe that moulding virtual clay should be as easy as moulding clay in your hands. Leap Motion now focus on bringing this motion sensing technology closer to the real world. Leap Motion Development Essentials explains the concepts and practical applications of gesture input for developers who want to take full advantage of Leap Motion technology. This guide explores the capabilities available to developers and gives you a clear overview of topics related to gesture input along with usable code samples. Leap Motion Development Essentials shows you everything you need to know about the Leap Motion SDK, from creating a working program with gesture input to more sophisticated applications covering a range of relevant topics. Sample code is provided and explained along with details of the most important and central API concepts. This book teaches you the essential information you need to design a gesture-enabled interface for your application, from specific gesture detection to best practices for this new input. You will be given guidance on practical considerations along with copious runnable demonstrations of API usage which are explained in step-by-step, reusable recipes.
Table of Contents (12 chapters)

Preface

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.

What this book covers

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.

What you need for this book

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.

Who this book is for

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.

Conventions

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".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

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 , 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.

Customer support

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.

Downloading the example code

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.

Errata

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

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 with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.