Leap Motion Development Essentials
()
About this ebook
Related to Leap Motion Development Essentials
Related ebooks
Percept: Fundamentals and Applications Rating: 0 out of 5 stars0 ratingsAugmented Reality with Kinect Rating: 0 out of 5 stars0 ratingsFlash Development for Android Cookbook Rating: 3 out of 5 stars3/5Mapping and Visualization with SuperCollider Rating: 5 out of 5 stars5/5ROS Robotics Projects Rating: 1 out of 5 stars1/5Learning Windows 8 Game Development Rating: 0 out of 5 stars0 ratingsMastering Augmented Reality Development with Unity: Create immersive and engaging AR experiences with Unity (English Edition) Rating: 0 out of 5 stars0 ratingsInvestigating Rollenwahrnehmung, Perspective and Space through Virtual Reality related Game Interfaces Rating: 0 out of 5 stars0 ratingsC++ Game Development: Build High-Performance Games from Scratch Rating: 0 out of 5 stars0 ratingsKinect Open Source Programming Secrets: Hacking the Kinect with OpenNI, NITE, and Java Rating: 0 out of 5 stars0 ratingsLearning Cocos2d-x Game Development Rating: 0 out of 5 stars0 ratingsSo You Want To Be A Game Developer: Let's get it done in just 30 days! Rating: 0 out of 5 stars0 ratingsiOS Programming: Starter Guide: What Every Programmer Needs to Know About iOS Programming Rating: 2 out of 5 stars2/5Game Physics Cookbook Rating: 0 out of 5 stars0 ratingsOpenSceneGraph 3.0 Beginner's Guide Rating: 0 out of 5 stars0 ratingsCinder Creative Coding Cookbook Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Shooter Games: Beginners' Guides, #2 Rating: 0 out of 5 stars0 ratingsData Acquisition Using LabVIEW Rating: 0 out of 5 stars0 ratingsSwift 3 Game Development - Second Edition Rating: 0 out of 5 stars0 ratingsD Web Development: Leverage the power of D and the vibe.d framework to develop web applications that are incredibly fast Rating: 0 out of 5 stars0 ratingsMastering Unity: Advanced Techniques for Interactive Design: Unity Game Development Series Rating: 0 out of 5 stars0 ratingsOuya Unity Game Development Rating: 0 out of 5 stars0 ratingsBlueprints Visual Scripting for Unreal Engine - Second Edition: The faster way to build games using UE4 Blueprints, 2nd Edition Rating: 0 out of 5 stars0 ratingsMaking Games For The NES: 8bitworkshop Rating: 5 out of 5 stars5/5Arduino Essentials Rating: 5 out of 5 stars5/5C++ Windows Programming Rating: 0 out of 5 stars0 ratingsPanda3d 1.7 Game Developer's Cookbook Rating: 0 out of 5 stars0 ratings
Programming For You
Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5PYTHON PROGRAMMING Rating: 4 out of 5 stars4/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsLinux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Godot from Zero to Proficiency (Foundations): Godot from Zero to Proficiency, #1 Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Learn Python in 10 Minutes Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Learn NodeJS in 1 Day: Complete Node JS Guide with Examples Rating: 3 out of 5 stars3/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsPython Games from Zero to Proficiency (Beginner): Python Games From Zero to Proficiency, #1 Rating: 0 out of 5 stars0 ratings
Reviews for Leap Motion Development Essentials
0 ratings0 reviews
Book preview
Leap Motion Development Essentials - Mischa Spiegelmock
Table of Contents
Leap Motion Development Essentials
Credits
About the Author
About the Reviewers
www.packtpub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Leap Motion SDK – A Quick Start
An overview of the SDK
Quick start
Major SDK components
Controller
Config
Screen
Math
Frame
Hand
Pointable
Finger positioning
An example of cursor control
A gesture-triggered action
Summary
2. Real Talk – Real Time
A simple gesture recognizer
Using the MIDI output
Blocking and latency
Multiprocessing with threads
Refactoring for multithreading
The producer-consumer race condition
Summary
3. Actual Gestures
Computer input
Natural gestures
Receiving gestures
WindowFlinger – a high-level gesture application
Window management abstraction
Window docking
Driver implementation – Mac OS X
Accessibility API
flinger::MacDriver
Summary
4. Leap and the Web
HTML5 and Leap
WebSocket
The Leap Motion service
LeapJS
JavaScript visualization
Summary
5. HTML5 Antics in 3D
Cross-platform graphics party
WebGL
Three.js + LeapJS – the awesomesauce
Animating rotation
Summary
Index
Leap Motion Development Essentials
Leap Motion Development Essentials
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2013
Production Reference: 1211013
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84969-772-9
www.packtpub.com
Cover Image by Suresh Mogre (<[email protected]>)
Credits
Author
Mischa Spiegelmock
Reviewers
Shaun Walker
Carlos Zinato
Acquisition Editors
Erol Staveley
Rebecca Youe
Commissioning Editor
Mohammed Fahad
Technical Editors
Vrinda Nitesh Bhosale
Pratik More
Amit Ramadas
Project Coordinator
Suraj Bist
Proofreader
Bernadette Watkins
Indexer
Hemangini Bari
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph
About the Author
Mischa Spiegelmock is an accomplished software engineer from the San Francisco Bay Area. Slightly infamous from light-hearted technical pranks from his youth, he is now a respectable CTO at a healthcare software startup. His passions are architecting elegant and useful programs and sharing his insights into software design with others in a straightforward and entertaining fashion.
This book would not exist without the extremely passionate people at Leap Motion, whose vision and heroic efforts to improve the interactions between humans and computers should be commended. Special mention to Elizabeth Ruscitto for taking the time to provide me with informative answers to my queries. I would also like to thank Hep Svadja Hepic Photography, for the amazing pictures.
About the Reviewers
Shaun Walker is a software and web developer from Tasmania, Australia. He enjoys tinkering with electronics, listening to music, playing computer games, and working on small projects that generally never get finished.
Shaun has a Bachelor's degree in Computing, majoring in Human Interface Technology, part of the HITLab, an International collaboration effort between a few universities around the world. His areas of focus during his studies were in augmented reality, virtual reality, and gesture-based interactions.
With a history in corporate IT support, working on network integration, software and web development, his main employment is with a Brisbane-based medical start-up.
Ramblings by Shaun can be found at his blog at http://theshaun.com or on Twitter @theshaun.
Carlos Zinato, aged 25, is from São Paulo, Brazil. Currently, he's living in Miami Beach, FL, developing mobile apps and games, playing bass guitar, and getting to know people and places.
Working with tools such as Objective-C, Leap Motion, Titanium, and Unity3D, Carlos makes mobile apps and games and this is what he loves to do.
Carlos is currently aiming to keep making awesome apps and games with skilled friends and teams. He not only cares about the money but, more importantly, about the knowledge. Carlos wants to keep working with brilliant people that enhance his job, his life, and his pocket.
www.packtpub.com
Support files, eBooks, discount offers and more
You might want to visit www.packtpub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packtpub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.packtpub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
Support files, eBooks, discount offers and morewww.packtpub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.packtpub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
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