Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Leap Motion Development Essentials
Leap Motion Development Essentials
Leap Motion Development Essentials
Ebook202 pages1 hour

Leap Motion Development Essentials

Rating: 0 out of 5 stars

()

Read preview

About this ebook

This book is a fast-paced guide with practical examples that aims to help you understand and master the Leap Motion SDK.This book is for developers who are either involved in game development or who are looking to utilize Leap Motion technology in order to create brand new user interaction experiences to distinguish their products from the mass market. You should be comfortable with high-level languages and object-oriented development concepts in order to get the most out of this book.
LanguageEnglish
Release dateOct 25, 2013
ISBN9781849697736
Leap Motion Development Essentials

Related to Leap Motion Development Essentials

Related ebooks

Programming For You

View More

Related articles

Reviews for Leap Motion Development Essentials

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    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 (<suresh.mogre.99@gmail.com>)

    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 for more details.

    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.

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

    Enjoying the preview?
    Page 1 of 1