leap-motion 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +32 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -0
- data/README.rdoc +79 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/ext/motion/LeapRuby.cpp +16054 -0
- data/ext/motion/LeapRuby.h +34 -0
- data/ext/motion/extconf.rb +26 -0
- data/ext/motion/swig/Leap.h +4566 -0
- data/ext/motion/swig/Leap.i +799 -0
- data/ext/motion/swig/LeapMath.h +1036 -0
- data/leap-motion.gemspec +28 -0
- data/lib/leap-motion.rb +1 -0
- data/lib/motion/libLeap.dylib +0 -0
- data/samples/test.rb +47 -0
- data/test/helper.rb +17 -0
- metadata +134 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
/* ----------------------------------------------------------------------------
|
2
|
+
* This file was automatically generated by SWIG (http://www.swig.org).
|
3
|
+
* Version 2.0.12
|
4
|
+
*
|
5
|
+
* This file is not intended to be easily readable and contains a number of
|
6
|
+
* coding conventions designed to improve portability and efficiency. Do not make
|
7
|
+
* changes to this file unless you know what you are doing--modify the SWIG
|
8
|
+
* interface file instead.
|
9
|
+
* ----------------------------------------------------------------------------- */
|
10
|
+
|
11
|
+
#ifndef SWIG_Leap__Motion_WRAP_H_
|
12
|
+
#define SWIG_Leap__Motion_WRAP_H_
|
13
|
+
|
14
|
+
namespace Swig {
|
15
|
+
class Director;
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
class SwigDirector_Listener : public Leap::Listener, public Swig::Director {
|
20
|
+
|
21
|
+
public:
|
22
|
+
SwigDirector_Listener(VALUE self);
|
23
|
+
virtual ~SwigDirector_Listener();
|
24
|
+
virtual void onInit(Leap::Controller const &arg0);
|
25
|
+
virtual void onConnect(Leap::Controller const &arg0);
|
26
|
+
virtual void onDisconnect(Leap::Controller const &arg0);
|
27
|
+
virtual void onExit(Leap::Controller const &arg0);
|
28
|
+
virtual void onFrame(Leap::Controller const &arg0);
|
29
|
+
virtual void onFocusGained(Leap::Controller const &arg0);
|
30
|
+
virtual void onFocusLost(Leap::Controller const &arg0);
|
31
|
+
};
|
32
|
+
|
33
|
+
|
34
|
+
#endif
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
require 'rbconfig'
|
3
|
+
|
4
|
+
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
|
5
|
+
|
6
|
+
def crash(str)
|
7
|
+
printf(" extconf failure: %s\n", str)
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
if is_windows
|
12
|
+
$CFLAGS+=" -GX " # allow exceptions
|
13
|
+
else
|
14
|
+
$libs = append_library($libs, "stdc++")
|
15
|
+
end
|
16
|
+
|
17
|
+
inc, lib = dir_config('leap')
|
18
|
+
|
19
|
+
if [nil, nil] != [inc, lib]
|
20
|
+
$LDFLAGS << " -L#{lib} -lLeap"
|
21
|
+
$CFLAGS << " -Wall -g -I#{inc}"
|
22
|
+
else
|
23
|
+
crash "Please use --with-leap-lib= and --with-leap-include= to give the path to the LeapSDK lib and includes paths"
|
24
|
+
end
|
25
|
+
|
26
|
+
create_makefile("leap/motion")
|
@@ -0,0 +1,4566 @@
|
|
1
|
+
/******************************************************************************\
|
2
|
+
* Copyright (C) 2012-2013 Leap Motion, Inc. All rights reserved. *
|
3
|
+
* Leap Motion proprietary and confidential. Not for distribution. *
|
4
|
+
* Use subject to the terms of the Leap Motion SDK Agreement available at *
|
5
|
+
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
|
6
|
+
* between Leap Motion and you, your company or other organization. *
|
7
|
+
\******************************************************************************/
|
8
|
+
|
9
|
+
#if !defined(__Leap_h__)
|
10
|
+
#define __Leap_h__
|
11
|
+
|
12
|
+
#include "LeapMath.h"
|
13
|
+
#include <string>
|
14
|
+
#include <vector>
|
15
|
+
|
16
|
+
// Define integer types for Visual Studio 2008 and earlier
|
17
|
+
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
18
|
+
typedef __int32 int32_t;
|
19
|
+
typedef __int64 int64_t;
|
20
|
+
typedef unsigned __int32 uint32_t;
|
21
|
+
typedef unsigned __int64 uint64_t;
|
22
|
+
#else
|
23
|
+
#include <stdint.h>
|
24
|
+
#endif
|
25
|
+
|
26
|
+
// Define Leap export macros
|
27
|
+
#if defined(_WIN32) // Windows
|
28
|
+
#if LEAP_API_INTERNAL
|
29
|
+
#define LEAP_EXPORT
|
30
|
+
#elif LEAP_API_IMPLEMENTATION
|
31
|
+
#define LEAP_EXPORT __declspec(dllexport)
|
32
|
+
#else
|
33
|
+
#define LEAP_EXPORT __declspec(dllimport)
|
34
|
+
#endif
|
35
|
+
#define LEAP_EXPORT_CLASS
|
36
|
+
#define LEAP_EXPORT_PLUGIN __declspec(dllexport)
|
37
|
+
#elif !defined(SWIG)
|
38
|
+
#define LEAP_EXPORT __attribute__((visibility("default")))
|
39
|
+
#define LEAP_EXPORT_CLASS __attribute__((visibility("default")))
|
40
|
+
#define LEAP_EXPORT_PLUGIN __attribute__((visibility("default")))
|
41
|
+
#else
|
42
|
+
#define LEAP_EXPORT
|
43
|
+
#define LEAP_EXPORT_CLASS
|
44
|
+
#define LEAP_EXPORT_PLUGIN
|
45
|
+
#endif
|
46
|
+
|
47
|
+
namespace Leap {
|
48
|
+
|
49
|
+
// Interface for internal use only
|
50
|
+
class LEAP_EXPORT_CLASS Interface {
|
51
|
+
public:
|
52
|
+
struct Implementation {
|
53
|
+
LEAP_EXPORT virtual ~Implementation() {}
|
54
|
+
};
|
55
|
+
protected:
|
56
|
+
LEAP_EXPORT Interface(void* owner);
|
57
|
+
LEAP_EXPORT Interface(Implementation* reference, void* owner);
|
58
|
+
LEAP_EXPORT Interface(const Interface& rhs);
|
59
|
+
Interface(class SharedObject* object);
|
60
|
+
LEAP_EXPORT Interface& operator=(const Interface& rhs);
|
61
|
+
LEAP_EXPORT virtual ~Interface();
|
62
|
+
template<typename T> T* get() const { return static_cast<T*>(reference()); }
|
63
|
+
class SharedObject* m_object;
|
64
|
+
private:
|
65
|
+
LEAP_EXPORT Implementation* reference() const;
|
66
|
+
};
|
67
|
+
|
68
|
+
// Forward declarations for internal use only
|
69
|
+
class PointableImplementation;
|
70
|
+
class FingerImplementation;
|
71
|
+
class ToolImplementation;
|
72
|
+
class HandImplementation;
|
73
|
+
class GestureImplementation;
|
74
|
+
class ScreenImplementation;
|
75
|
+
class DeviceImplementation;
|
76
|
+
class InteractionBoxImplementation;
|
77
|
+
class FrameImplementation;
|
78
|
+
class ControllerImplementation;
|
79
|
+
template<typename T> class ListBaseImplementation;
|
80
|
+
|
81
|
+
// Forward declarations
|
82
|
+
class PointableList;
|
83
|
+
class FingerList;
|
84
|
+
class ToolList;
|
85
|
+
class HandList;
|
86
|
+
class GestureList;
|
87
|
+
class Hand;
|
88
|
+
class Gesture;
|
89
|
+
class Screen;
|
90
|
+
class InteractionBox;
|
91
|
+
class Frame;
|
92
|
+
class Listener;
|
93
|
+
|
94
|
+
/**
|
95
|
+
* The Pointable class reports the physical characteristics of a detected finger or tool.
|
96
|
+
*
|
97
|
+
* Both fingers and tools are classified as Pointable objects. Use the Pointable::isFinger()
|
98
|
+
* function to determine whether a Pointable object represents a finger. Use the
|
99
|
+
* Pointable::isTool() function to determine whether a Pointable object represents a tool.
|
100
|
+
* The Leap Motion software classifies a detected entity as a tool when it is thinner, straighter, and longer
|
101
|
+
* than a typical finger.
|
102
|
+
*
|
103
|
+
* \include Pointable_Get_Basic.txt
|
104
|
+
*
|
105
|
+
* To provide touch emulation, the Leap Motion software associates a floating touch
|
106
|
+
* plane that adapts to the user's finger movement and hand posture. The Leap Motion
|
107
|
+
* interprets purposeful movements toward this plane as potential touch points.
|
108
|
+
* The Pointable class reports
|
109
|
+
* touch state with the touchZone and touchDistance values.
|
110
|
+
*
|
111
|
+
* Note that Pointable objects can be invalid, which means that they do not contain
|
112
|
+
* valid tracking data and do not correspond to a physical entity. Invalid Pointable
|
113
|
+
* objects can be the result of asking for a Pointable object using an ID from an
|
114
|
+
* earlier frame when no Pointable objects with that ID exist in the current frame.
|
115
|
+
* A Pointable object created from the Pointable constructor is also invalid.
|
116
|
+
* Test for validity with the Pointable::isValid() function.
|
117
|
+
*
|
118
|
+
* @since 1.0
|
119
|
+
*/
|
120
|
+
class Pointable : public Interface {
|
121
|
+
public:
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Defines the values for reporting the state of a Pointable object in relation to
|
125
|
+
* an adaptive touch plane.
|
126
|
+
* @since 1.0
|
127
|
+
*/
|
128
|
+
enum Zone {
|
129
|
+
/**
|
130
|
+
* The Pointable object is too far from the plane to be
|
131
|
+
* considered hovering or touching.
|
132
|
+
* @since 1.0
|
133
|
+
*/
|
134
|
+
ZONE_NONE = 0,
|
135
|
+
/**
|
136
|
+
* The Pointable object is close to, but not touching
|
137
|
+
* the plane.
|
138
|
+
* @since 1.0
|
139
|
+
*/
|
140
|
+
ZONE_HOVERING = 1,
|
141
|
+
/**
|
142
|
+
* The Pointable has penetrated the plane.
|
143
|
+
* @since 1.0
|
144
|
+
*/
|
145
|
+
ZONE_TOUCHING = 2,
|
146
|
+
};
|
147
|
+
|
148
|
+
// For internal use only.
|
149
|
+
Pointable(PointableImplementation*);
|
150
|
+
// For internal use only.
|
151
|
+
Pointable(FingerImplementation*);
|
152
|
+
// For internal use only.
|
153
|
+
Pointable(ToolImplementation*);
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Constructs a Pointable object.
|
157
|
+
*
|
158
|
+
* An uninitialized pointable is considered invalid.
|
159
|
+
* Get valid Pointable objects from a Frame or a Hand object.
|
160
|
+
*
|
161
|
+
* \include Pointable_Pointable.txt
|
162
|
+
*
|
163
|
+
* @since 1.0
|
164
|
+
*/
|
165
|
+
LEAP_EXPORT Pointable();
|
166
|
+
|
167
|
+
/**
|
168
|
+
* A unique ID assigned to this Pointable object, whose value remains the
|
169
|
+
* same across consecutive frames while the tracked finger or tool remains
|
170
|
+
* visible. If tracking is lost (for example, when a finger is occluded by
|
171
|
+
* another finger or when it is withdrawn from the Leap Motion Controller field of view), the
|
172
|
+
* Leap Motion software may assign a new ID when it detects the entity in a future frame.
|
173
|
+
*
|
174
|
+
* \include Pointable_id.txt
|
175
|
+
*
|
176
|
+
* Use the ID value with the Frame::pointable() function to find this
|
177
|
+
* Pointable object in future frames.
|
178
|
+
*
|
179
|
+
* IDs should be from 1 to 100 (inclusive). If more than 100 objects are tracked
|
180
|
+
* an IDs of -1 will be used until an ID in the defined range is available.
|
181
|
+
*
|
182
|
+
* @returns The ID assigned to this Pointable object.
|
183
|
+
* @since 1.0
|
184
|
+
*/
|
185
|
+
LEAP_EXPORT int32_t id() const;
|
186
|
+
|
187
|
+
/**
|
188
|
+
* The Frame associated with this Pointable object.
|
189
|
+
*
|
190
|
+
* \include Pointable_frame.txt
|
191
|
+
*
|
192
|
+
* @returns The associated Frame object, if available; otherwise,
|
193
|
+
* an invalid Frame object is returned.
|
194
|
+
* @since 1.0
|
195
|
+
*/
|
196
|
+
LEAP_EXPORT Frame frame() const;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* The Hand associated with this finger or tool.
|
200
|
+
*
|
201
|
+
* \include Pointable_hand.txt
|
202
|
+
*
|
203
|
+
* @returns The associated Hand object, if available; otherwise,
|
204
|
+
* an invalid Hand object is returned.
|
205
|
+
* @since 1.0
|
206
|
+
*/
|
207
|
+
LEAP_EXPORT Hand hand() const;
|
208
|
+
|
209
|
+
/**
|
210
|
+
* The tip position in millimeters from the Leap Motion origin.
|
211
|
+
*
|
212
|
+
* \include Pointable_tipPosition.txt
|
213
|
+
*
|
214
|
+
* @returns The Vector containing the coordinates of the tip position.
|
215
|
+
* @since 1.0
|
216
|
+
*/
|
217
|
+
LEAP_EXPORT Vector tipPosition() const;
|
218
|
+
|
219
|
+
/**
|
220
|
+
* The rate of change of the tip position in millimeters/second.
|
221
|
+
*
|
222
|
+
* \include Pointable_tipVelocity.txt
|
223
|
+
*
|
224
|
+
* @returns The Vector containing the coordinates of the tip velocity.
|
225
|
+
* @since 1.0
|
226
|
+
*/
|
227
|
+
LEAP_EXPORT Vector tipVelocity() const;
|
228
|
+
|
229
|
+
/**
|
230
|
+
* The direction in which this finger or tool is pointing.
|
231
|
+
*
|
232
|
+
* \include Pointable_direction.txt
|
233
|
+
*
|
234
|
+
* The direction is expressed as a unit vector pointing in the same
|
235
|
+
* direction as the tip.
|
236
|
+
*
|
237
|
+
* \image html images/Leap_Finger_Model.png
|
238
|
+
*
|
239
|
+
* @returns The Vector pointing in the same direction as the tip of this
|
240
|
+
* Pointable object.
|
241
|
+
* @since 1.0
|
242
|
+
*/
|
243
|
+
LEAP_EXPORT Vector direction() const;
|
244
|
+
|
245
|
+
/**
|
246
|
+
* The estimated width of the finger or tool in millimeters.
|
247
|
+
*
|
248
|
+
* \include Pointable_width.txt
|
249
|
+
*
|
250
|
+
* The reported width is the average width of the visible portion of the
|
251
|
+
* finger or tool from the hand to the tip. If the width isn't known,
|
252
|
+
* then a value of 0 is returned.
|
253
|
+
*
|
254
|
+
* @returns The estimated width of this Pointable object.
|
255
|
+
* @since 1.0
|
256
|
+
*/
|
257
|
+
LEAP_EXPORT float width() const;
|
258
|
+
|
259
|
+
/**
|
260
|
+
* The estimated length of the finger or tool in millimeters.
|
261
|
+
*
|
262
|
+
* The reported length is the visible length of the finger or tool from the
|
263
|
+
* hand to tip. If the length isn't known, then a value of 0 is returned.
|
264
|
+
*
|
265
|
+
* \include Pointable_length.txt
|
266
|
+
*
|
267
|
+
* @returns The estimated length of this Pointable object.
|
268
|
+
* @since 1.0
|
269
|
+
*/
|
270
|
+
LEAP_EXPORT float length() const;
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Whether or not the Pointable is believed to be a finger.
|
274
|
+
* Fingers are generally shorter, thicker, and less straight than tools.
|
275
|
+
*
|
276
|
+
* \include Pointable_Conversion.txt
|
277
|
+
*
|
278
|
+
* @returns True, if this Pointable is classified as a finger.
|
279
|
+
* @since 1.0
|
280
|
+
*/
|
281
|
+
LEAP_EXPORT bool isFinger() const;
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Whether or not the Pointable is believed to be a tool.
|
285
|
+
* Tools are generally longer, thinner, and straighter than fingers.
|
286
|
+
*
|
287
|
+
* \include Pointable_Conversion.txt
|
288
|
+
*
|
289
|
+
* @returns True, if this Pointable is classified as a tool.
|
290
|
+
* @since 1.0
|
291
|
+
*/
|
292
|
+
LEAP_EXPORT bool isTool() const;
|
293
|
+
|
294
|
+
/**
|
295
|
+
* Reports whether this is a valid Pointable object.
|
296
|
+
*
|
297
|
+
* \include Pointable_isValid.txt
|
298
|
+
*
|
299
|
+
* @returns True, if this Pointable object contains valid tracking data.
|
300
|
+
* @since 1.0
|
301
|
+
*/
|
302
|
+
LEAP_EXPORT bool isValid() const;
|
303
|
+
|
304
|
+
/**
|
305
|
+
* The current touch zone of this Pointable object.
|
306
|
+
*
|
307
|
+
* The Leap Motion software computes the touch zone based on a floating touch
|
308
|
+
* plane that adapts to the user's finger movement and hand posture. The Leap
|
309
|
+
* Motion software interprets purposeful movements toward this plane as potential touch
|
310
|
+
* points. When a Pointable moves close to the adaptive touch plane, it enters the
|
311
|
+
* "hovering" zone. When a Pointable reaches or passes through the plane, it enters
|
312
|
+
* the "touching" zone.
|
313
|
+
*
|
314
|
+
* The possible states are present in the Zone enum of this class:
|
315
|
+
*
|
316
|
+
* * Zone.NONE -- The Pointable is outside the hovering zone.
|
317
|
+
* * Zone.HOVERING -- The Pointable is close to, but not touching the touch plane.
|
318
|
+
* * Zone.TOUCHING -- The Pointable has penetrated the touch plane.
|
319
|
+
*
|
320
|
+
* The touchDistance value provides a normalized indication of the distance to
|
321
|
+
* the touch plane when the Pointable is in the hovering or touching zones.
|
322
|
+
*
|
323
|
+
* \include Pointable_touchZone.txt
|
324
|
+
*
|
325
|
+
* @returns The touch zone of this Pointable
|
326
|
+
* @since 1.0
|
327
|
+
*/
|
328
|
+
LEAP_EXPORT Zone touchZone() const;
|
329
|
+
|
330
|
+
/**
|
331
|
+
* A value proportional to the distance between this Pointable object and the
|
332
|
+
* adaptive touch plane.
|
333
|
+
*
|
334
|
+
* \image html images/Leap_Touch_Plane.png
|
335
|
+
*
|
336
|
+
* The touch distance is a value in the range [-1, 1]. The value 1.0 indicates the
|
337
|
+
* Pointable is at the far edge of the hovering zone. The value 0 indicates the
|
338
|
+
* Pointable is just entering the touching zone. A value of -1.0 indicates the
|
339
|
+
* Pointable is firmly within the touching zone. Values in between are
|
340
|
+
* proportional to the distance from the plane. Thus, the touchDistance of 0.5
|
341
|
+
* indicates that the Pointable is halfway into the hovering zone.
|
342
|
+
*
|
343
|
+
* \include Pointable_touchDistance.txt
|
344
|
+
*
|
345
|
+
* You can use the touchDistance value to modulate visual feedback given to the
|
346
|
+
* user as their fingers close in on a touch target, such as a button.
|
347
|
+
*
|
348
|
+
* @returns The normalized touch distance of this Pointable object.
|
349
|
+
* @since 1.0
|
350
|
+
*/
|
351
|
+
LEAP_EXPORT float touchDistance() const;
|
352
|
+
|
353
|
+
/**
|
354
|
+
* The stabilized tip position of this Pointable.
|
355
|
+
*
|
356
|
+
* Smoothing and stabilization is performed in order to make
|
357
|
+
* this value more suitable for interaction with 2D content. The stabilized
|
358
|
+
* position lags behind the tip position by a variable amount, depending
|
359
|
+
* primarily on the speed of movement.
|
360
|
+
*
|
361
|
+
* \include Pointable_stabilizedTipPosition.txt
|
362
|
+
*
|
363
|
+
* @returns A modified tip position of this Pointable object
|
364
|
+
* with some additional smoothing and stabilization applied.
|
365
|
+
* @since 1.0
|
366
|
+
*/
|
367
|
+
LEAP_EXPORT Vector stabilizedTipPosition() const;
|
368
|
+
|
369
|
+
/**
|
370
|
+
* The duration of time this Pointable has been visible to the Leap Motion Controller.
|
371
|
+
*
|
372
|
+
* \include Pointable_timeVisible.txt
|
373
|
+
*
|
374
|
+
* @returns The duration (in seconds) that this Pointable has been tracked.
|
375
|
+
* @since 1.0
|
376
|
+
*/
|
377
|
+
LEAP_EXPORT float timeVisible() const;
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Returns an invalid Pointable object.
|
381
|
+
*
|
382
|
+
* You can use the instance returned by this function in comparisons testing
|
383
|
+
* whether a given Pointable instance is valid or invalid. (You can also use the
|
384
|
+
* Pointable::isValid() function.)
|
385
|
+
*
|
386
|
+
* \include Pointable_invalid.txt
|
387
|
+
*
|
388
|
+
* @returns The invalid Pointable instance.
|
389
|
+
* @since 1.0
|
390
|
+
*/
|
391
|
+
LEAP_EXPORT static const Pointable& invalid();
|
392
|
+
|
393
|
+
/**
|
394
|
+
* Compare Pointable object equality.
|
395
|
+
*
|
396
|
+
* \include Pointable_operator_equals.txt
|
397
|
+
*
|
398
|
+
* Two Pointable objects are equal if and only if both Pointable objects represent the
|
399
|
+
* exact same physical entities in the same frame and both Pointable objects are valid.
|
400
|
+
* @since 1.0
|
401
|
+
*/
|
402
|
+
LEAP_EXPORT bool operator==(const Pointable&) const;
|
403
|
+
|
404
|
+
/**
|
405
|
+
* Compare Pointable object inequality.
|
406
|
+
*
|
407
|
+
* \include Pointable_operator_not_equal.txt
|
408
|
+
*
|
409
|
+
* Two Pointable objects are equal if and only if both Pointable objects represent the
|
410
|
+
* exact same physical entities in the same frame and both Pointable objects are valid.
|
411
|
+
* @since 1.0
|
412
|
+
*/
|
413
|
+
LEAP_EXPORT bool operator!=(const Pointable&) const;
|
414
|
+
|
415
|
+
/**
|
416
|
+
* Writes a brief, human readable description of the Pointable object to an output stream.
|
417
|
+
*
|
418
|
+
* \include Pointable_operator_stream.txt
|
419
|
+
*
|
420
|
+
* @since 1.0
|
421
|
+
*/
|
422
|
+
LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Pointable&);
|
423
|
+
|
424
|
+
/**
|
425
|
+
* A string containing a brief, human readable description of the Pointable object.
|
426
|
+
*
|
427
|
+
* @returns A description of the Pointable object as a string.
|
428
|
+
* @since 1.0
|
429
|
+
*/
|
430
|
+
LEAP_EXPORT std::string toString() const;
|
431
|
+
};
|
432
|
+
|
433
|
+
/**
|
434
|
+
* The Finger class represents a tracked finger.
|
435
|
+
*
|
436
|
+
* Fingers are Pointable objects that the Leap Motion software has classified as a finger.
|
437
|
+
* Get valid Finger objects from a Frame or a Hand object.
|
438
|
+
*
|
439
|
+
* Fingers may be permanently associated to a hand. In this case the angular order of the finger IDs
|
440
|
+
* will be invariant. As fingers move in and out of view it is possible for the guessed ID
|
441
|
+
* of a finger to be incorrect. Consequently, it may be necessary for finger IDs to be
|
442
|
+
* exchanged. All tracked properties, such as velocity, will remain continuous in the API.
|
443
|
+
* However, quantities that are derived from the API output (such as a history of positions)
|
444
|
+
* will be discontinuous unless they have a corresponding ID exchange.
|
445
|
+
*
|
446
|
+
* Note that Finger objects can be invalid, which means that they do not contain
|
447
|
+
* valid tracking data and do not correspond to a physical finger. Invalid Finger
|
448
|
+
* objects can be the result of asking for a Finger object using an ID from an
|
449
|
+
* earlier frame when no Finger objects with that ID exist in the current frame.
|
450
|
+
* A Finger object created from the Finger constructor is also invalid.
|
451
|
+
* Test for validity with the Finger::isValid() function.
|
452
|
+
* @since 1.0
|
453
|
+
*/
|
454
|
+
class Finger : public Pointable {
|
455
|
+
public:
|
456
|
+
// For internal use only.
|
457
|
+
Finger(FingerImplementation*);
|
458
|
+
|
459
|
+
/**
|
460
|
+
* Constructs a Finger object.
|
461
|
+
*
|
462
|
+
* An uninitialized finger is considered invalid.
|
463
|
+
* Get valid Finger objects from a Frame or a Hand object.
|
464
|
+
* @since 1.0
|
465
|
+
*/
|
466
|
+
LEAP_EXPORT Finger();
|
467
|
+
|
468
|
+
/**
|
469
|
+
* If the specified Pointable object represents a finger, creates a copy
|
470
|
+
* of it as a Finger object; otherwise, creates an invalid Finger object.
|
471
|
+
*
|
472
|
+
* \include Finger_Finger.txt
|
473
|
+
*
|
474
|
+
* @since 1.0
|
475
|
+
*/
|
476
|
+
LEAP_EXPORT explicit Finger(const Pointable&);
|
477
|
+
|
478
|
+
/**
|
479
|
+
* Returns an invalid Finger object.
|
480
|
+
*
|
481
|
+
* You can use the instance returned by this function in comparisons testing
|
482
|
+
* whether a given Finger instance is valid or invalid. (You can also use the
|
483
|
+
* Finger::isValid() function.)
|
484
|
+
*
|
485
|
+
* \include Finger_invalid.txt
|
486
|
+
*
|
487
|
+
* @returns The invalid Finger instance.
|
488
|
+
* @since 1.0
|
489
|
+
*/
|
490
|
+
LEAP_EXPORT static const Finger& invalid();
|
491
|
+
|
492
|
+
/**
|
493
|
+
* A string containing a brief, human readable description of the Finger object.
|
494
|
+
*
|
495
|
+
* @returns A description of the Finger object as a string.
|
496
|
+
* @since 1.0
|
497
|
+
*/
|
498
|
+
LEAP_EXPORT std::string toString() const;
|
499
|
+
};
|
500
|
+
|
501
|
+
/**
|
502
|
+
* The Tool class represents a tracked tool.
|
503
|
+
*
|
504
|
+
* Tools are Pointable objects that the Leap Motion software has classified as a tool.
|
505
|
+
* Tools are longer, thinner, and straighter than a typical finger.
|
506
|
+
* Get valid Tool objects from a Frame or a Hand object.
|
507
|
+
*
|
508
|
+
* Tools may reference a hand, but unlike fingers they are not permanently associated.
|
509
|
+
* Instead, a tool can be transferred between hands while keeping the same ID.
|
510
|
+
*
|
511
|
+
* \image html images/Leap_Tool.png
|
512
|
+
*
|
513
|
+
* Note that Tool objects can be invalid, which means that they do not contain
|
514
|
+
* valid tracking data and do not correspond to a physical tool. Invalid Tool
|
515
|
+
* objects can be the result of asking for a Tool object using an ID from an
|
516
|
+
* earlier frame when no Tool objects with that ID exist in the current frame.
|
517
|
+
* A Tool object created from the Tool constructor is also invalid.
|
518
|
+
* Test for validity with the Tool::isValid() function.
|
519
|
+
* @since 1.0
|
520
|
+
*/
|
521
|
+
class Tool : public Pointable {
|
522
|
+
public:
|
523
|
+
// For internal use only.
|
524
|
+
Tool(ToolImplementation*);
|
525
|
+
|
526
|
+
/**
|
527
|
+
* Constructs a Tool object.
|
528
|
+
*
|
529
|
+
* An uninitialized tool is considered invalid.
|
530
|
+
* Get valid Tool objects from a Frame or a Hand object.
|
531
|
+
*
|
532
|
+
* \include Tool_Tool.txt
|
533
|
+
*
|
534
|
+
* @since 1.0
|
535
|
+
*/
|
536
|
+
LEAP_EXPORT Tool();
|
537
|
+
|
538
|
+
/**
|
539
|
+
* If the specified Pointable object represents a tool, creates a copy
|
540
|
+
* of it as a Tool object; otherwise, creates an invalid Tool object.
|
541
|
+
*
|
542
|
+
* \include Tool_Tool_copy.txt
|
543
|
+
*
|
544
|
+
* @since 1.0
|
545
|
+
*/
|
546
|
+
LEAP_EXPORT explicit Tool(const Pointable&);
|
547
|
+
|
548
|
+
/**
|
549
|
+
* Returns an invalid Tool object.
|
550
|
+
*
|
551
|
+
* You can use the instance returned by this function in comparisons testing
|
552
|
+
* whether a given Tool instance is valid or invalid. (You can also use the
|
553
|
+
* Tool::isValid() function.)
|
554
|
+
*
|
555
|
+
* \include Tool_invalid.txt
|
556
|
+
*
|
557
|
+
* @returns The invalid Tool instance.
|
558
|
+
* @since 1.0
|
559
|
+
*/
|
560
|
+
LEAP_EXPORT static const Tool& invalid();
|
561
|
+
|
562
|
+
/**
|
563
|
+
* A string containing a brief, human readable description of the Tool object.
|
564
|
+
*
|
565
|
+
* @returns A description of the Tool object as a string.
|
566
|
+
* @since 1.0
|
567
|
+
*/
|
568
|
+
LEAP_EXPORT std::string toString() const;
|
569
|
+
};
|
570
|
+
|
571
|
+
/**
|
572
|
+
* The Hand class reports the physical characteristics of a detected hand.
|
573
|
+
*
|
574
|
+
* Hand tracking data includes a palm position and velocity; vectors for
|
575
|
+
* the palm normal and direction to the fingers; properties of a sphere fit
|
576
|
+
* to the hand; and lists of the attached fingers and tools.
|
577
|
+
*
|
578
|
+
* Get Hand objects from a Frame object:
|
579
|
+
*
|
580
|
+
* \include Hand_Get_First.txt
|
581
|
+
*
|
582
|
+
* Note that Hand objects can be invalid, which means that they do not contain
|
583
|
+
* valid tracking data and do not correspond to a physical entity. Invalid Hand
|
584
|
+
* objects can be the result of asking for a Hand object using an ID from an
|
585
|
+
* earlier frame when no Hand objects with that ID exist in the current frame.
|
586
|
+
* A Hand object created from the Hand constructor is also invalid.
|
587
|
+
* Test for validity with the Hand::isValid() function.
|
588
|
+
* @since 1.0
|
589
|
+
*/
|
590
|
+
class Hand : public Interface {
|
591
|
+
public:
|
592
|
+
// For internal use only.
|
593
|
+
Hand(HandImplementation*);
|
594
|
+
|
595
|
+
/**
|
596
|
+
* Constructs a Hand object.
|
597
|
+
*
|
598
|
+
* An uninitialized hand is considered invalid.
|
599
|
+
* Get valid Hand objects from a Frame object.
|
600
|
+
*
|
601
|
+
* \include Hand_Hand.txt
|
602
|
+
*
|
603
|
+
* @since 1.0
|
604
|
+
*/
|
605
|
+
LEAP_EXPORT Hand();
|
606
|
+
|
607
|
+
/**
|
608
|
+
* A unique ID assigned to this Hand object, whose value remains the same
|
609
|
+
* across consecutive frames while the tracked hand remains visible. If
|
610
|
+
* tracking is lost (for example, when a hand is occluded by another hand
|
611
|
+
* or when it is withdrawn from or reaches the edge of the Leap Motion Controller field of view),
|
612
|
+
* the Leap Motion software may assign a new ID when it detects the hand in a future frame.
|
613
|
+
*
|
614
|
+
* Use the ID value with the Frame::hand() function to find this Hand object
|
615
|
+
* in future frames:
|
616
|
+
*
|
617
|
+
* \include Hand_Get_ID.txt
|
618
|
+
*
|
619
|
+
* @returns The ID of this hand.
|
620
|
+
* @since 1.0
|
621
|
+
*/
|
622
|
+
LEAP_EXPORT int32_t id() const;
|
623
|
+
|
624
|
+
/**
|
625
|
+
* The Frame associated with this Hand.
|
626
|
+
*
|
627
|
+
* \include Hand_frame.txt
|
628
|
+
*
|
629
|
+
* @returns The associated Frame object, if available; otherwise,
|
630
|
+
* an invalid Frame object is returned.
|
631
|
+
* @since 1.0
|
632
|
+
*/
|
633
|
+
LEAP_EXPORT Frame frame() const;
|
634
|
+
|
635
|
+
/**
|
636
|
+
* The list of Pointable objects (fingers and tools) detected in this frame
|
637
|
+
* that are associated with this hand, given in arbitrary order. The list
|
638
|
+
* can be empty if no fingers or tools associated with this hand are detected.
|
639
|
+
*
|
640
|
+
* Use the Pointable::isFinger() function to determine whether or not an
|
641
|
+
* item in the list represents a finger. Use the Pointable::isTool() function
|
642
|
+
* to determine whether or not an item in the list represents a tool.
|
643
|
+
* You can also get only fingers using the Hand::fingers() function or
|
644
|
+
* only tools using the Hand::tools() function.
|
645
|
+
*
|
646
|
+
* \include Hand_Get_Fingers.txt
|
647
|
+
*
|
648
|
+
* @returns The PointableList containing all Pointable objects associated with this hand.
|
649
|
+
* @since 1.0
|
650
|
+
*/
|
651
|
+
LEAP_EXPORT PointableList pointables() const;
|
652
|
+
|
653
|
+
/**
|
654
|
+
* The Pointable object with the specified ID associated with this hand.
|
655
|
+
*
|
656
|
+
* Use the Hand::pointable() function to retrieve a Pointable object
|
657
|
+
* associated with this hand using an ID value obtained from a previous frame.
|
658
|
+
* This function always returns a Pointable object, but if no finger or tool
|
659
|
+
* with the specified ID is present, an invalid Pointable object is returned.
|
660
|
+
*
|
661
|
+
* \include Hand_Get_Pointable_ByID.txt
|
662
|
+
*
|
663
|
+
* Note that the ID values assigned to objects persist across frames, but only until
|
664
|
+
* tracking of that object is lost. If tracking of a finger or tool is lost and subsequently
|
665
|
+
* regained, the new Pointable object representing that finger or tool may have a
|
666
|
+
* different ID than that representing the finger or tool in an earlier frame.
|
667
|
+
*
|
668
|
+
* @param id The ID value of a Pointable object from a previous frame.
|
669
|
+
* @returns The Pointable object with the matching ID if one exists for this
|
670
|
+
* hand in this frame; otherwise, an invalid Pointable object is returned.
|
671
|
+
* @since 1.0
|
672
|
+
*/
|
673
|
+
LEAP_EXPORT Pointable pointable(int32_t id) const;
|
674
|
+
|
675
|
+
/**
|
676
|
+
* The list of Finger objects detected in this frame that are attached to
|
677
|
+
* this hand, given in arbitrary order.
|
678
|
+
* The list can be empty if no fingers attached to this hand are detected.
|
679
|
+
*
|
680
|
+
* \include Hand_Get_Fingers.txt
|
681
|
+
*
|
682
|
+
* @returns The FingerList containing all Finger objects attached to this hand.
|
683
|
+
* @since 1.0
|
684
|
+
*/
|
685
|
+
LEAP_EXPORT FingerList fingers() const;
|
686
|
+
|
687
|
+
/**
|
688
|
+
* The Finger object with the specified ID attached to this hand.
|
689
|
+
*
|
690
|
+
* Use the Hand::finger() function to retrieve a Finger object attached to
|
691
|
+
* this hand using an ID value obtained from a previous frame.
|
692
|
+
* This function always returns a Finger object, but if no finger
|
693
|
+
* with the specified ID is present, an invalid Finger object is returned.
|
694
|
+
*
|
695
|
+
* \include Hand_finger.txt
|
696
|
+
*
|
697
|
+
* Note that ID values persist across frames, but only until tracking of a
|
698
|
+
* particular object is lost. If tracking of a finger is lost and subsequently
|
699
|
+
* regained, the new Finger object representing that finger may have a
|
700
|
+
* different ID than that representing the finger in an earlier frame.
|
701
|
+
*
|
702
|
+
* @param id The ID value of a Finger object from a previous frame.
|
703
|
+
* @returns The Finger object with the matching ID if one exists for this
|
704
|
+
* hand in this frame; otherwise, an invalid Finger object is returned.
|
705
|
+
* @since 1.0
|
706
|
+
*/
|
707
|
+
LEAP_EXPORT Finger finger(int32_t id) const;
|
708
|
+
|
709
|
+
/**
|
710
|
+
* The list of Tool objects detected in this frame that are held by this
|
711
|
+
* hand, given in arbitrary order.
|
712
|
+
* The list can be empty if no tools held by this hand are detected.
|
713
|
+
*
|
714
|
+
* \include Hand_tools.txt
|
715
|
+
*
|
716
|
+
* @returns The ToolList containing all Tool objects held by this hand.
|
717
|
+
* @since 1.0
|
718
|
+
*/
|
719
|
+
LEAP_EXPORT ToolList tools() const;
|
720
|
+
|
721
|
+
/**
|
722
|
+
* The Tool object with the specified ID held by this hand.
|
723
|
+
*
|
724
|
+
* Use the Hand::tool() function to retrieve a Tool object held by
|
725
|
+
* this hand using an ID value obtained from a previous frame.
|
726
|
+
* This function always returns a Tool object, but if no tool
|
727
|
+
* with the specified ID is present, an invalid Tool object is returned.
|
728
|
+
*
|
729
|
+
* \include Hand_tool.txt
|
730
|
+
*
|
731
|
+
* Note that ID values persist across frames, but only until tracking of a
|
732
|
+
* particular object is lost. If tracking of a tool is lost and subsequently
|
733
|
+
* regained, the new Tool object representing that tool may have a
|
734
|
+
* different ID than that representing the tool in an earlier frame.
|
735
|
+
*
|
736
|
+
* @param id The ID value of a Tool object from a previous frame.
|
737
|
+
* @returns The Tool object with the matching ID if one exists for this
|
738
|
+
* hand in this frame; otherwise, an invalid Tool object is returned.
|
739
|
+
* @since 1.0
|
740
|
+
*/
|
741
|
+
LEAP_EXPORT Tool tool(int32_t id) const;
|
742
|
+
|
743
|
+
/**
|
744
|
+
* The center position of the palm in millimeters from the Leap Motion Controller origin.
|
745
|
+
*
|
746
|
+
* \include Hand_palmPosition.txt
|
747
|
+
*
|
748
|
+
* @returns The Vector representing the coordinates of the palm position.
|
749
|
+
* @since 1.0
|
750
|
+
*/
|
751
|
+
LEAP_EXPORT Vector palmPosition() const;
|
752
|
+
|
753
|
+
/**
|
754
|
+
* The stabilized palm position of this Hand.
|
755
|
+
*
|
756
|
+
* Smoothing and stabilization is performed in order to make
|
757
|
+
* this value more suitable for interaction with 2D content. The stabilized
|
758
|
+
* position lags behind the palm position by a variable amount, depending
|
759
|
+
* primarily on the speed of movement.
|
760
|
+
*
|
761
|
+
* \include Hand_stabilizedPalmPosition.txt
|
762
|
+
*
|
763
|
+
* @returns A modified palm position of this Hand object
|
764
|
+
* with some additional smoothing and stabilization applied.
|
765
|
+
* @since 1.0
|
766
|
+
*/
|
767
|
+
LEAP_EXPORT Vector stabilizedPalmPosition() const;
|
768
|
+
|
769
|
+
/**
|
770
|
+
* The rate of change of the palm position in millimeters/second.
|
771
|
+
*
|
772
|
+
* \include Hand_palmVelocity.txt
|
773
|
+
*
|
774
|
+
* @returns The Vector representing the coordinates of the palm velocity.
|
775
|
+
* @since 1.0
|
776
|
+
*/
|
777
|
+
LEAP_EXPORT Vector palmVelocity() const;
|
778
|
+
|
779
|
+
/**
|
780
|
+
* The normal vector to the palm. If your hand is flat, this vector will
|
781
|
+
* point downward, or "out" of the front surface of your palm.
|
782
|
+
*
|
783
|
+
* \image html images/Leap_Palm_Vectors.png
|
784
|
+
*
|
785
|
+
* The direction is expressed as a unit vector pointing in the same
|
786
|
+
* direction as the palm normal (that is, a vector orthogonal to the palm).
|
787
|
+
*
|
788
|
+
* You can use the palm normal vector to compute the roll angle of the palm with
|
789
|
+
* respect to the horizontal plane:
|
790
|
+
*
|
791
|
+
* \include Hand_Get_Angles.txt
|
792
|
+
*
|
793
|
+
* @returns The Vector normal to the plane formed by the palm.
|
794
|
+
* @since 1.0
|
795
|
+
*/
|
796
|
+
LEAP_EXPORT Vector palmNormal() const;
|
797
|
+
|
798
|
+
/**
|
799
|
+
* The direction from the palm position toward the fingers.
|
800
|
+
*
|
801
|
+
* The direction is expressed as a unit vector pointing in the same
|
802
|
+
* direction as the directed line from the palm position to the fingers.
|
803
|
+
*
|
804
|
+
* You can use the palm direction vector to compute the pitch and yaw angles of the palm with
|
805
|
+
* respect to the horizontal plane:
|
806
|
+
*
|
807
|
+
* \include Hand_Get_Angles.txt
|
808
|
+
*
|
809
|
+
* @returns The Vector pointing from the palm position toward the fingers.
|
810
|
+
* @since 1.0
|
811
|
+
*/
|
812
|
+
LEAP_EXPORT Vector direction() const;
|
813
|
+
|
814
|
+
/**
|
815
|
+
* The center of a sphere fit to the curvature of this hand.
|
816
|
+
*
|
817
|
+
* \include Hand_sphereCenter.txt
|
818
|
+
*
|
819
|
+
* This sphere is placed roughly as if the hand were holding a ball.
|
820
|
+
*
|
821
|
+
* \image html images/Leap_Hand_Ball.png
|
822
|
+
*
|
823
|
+
* @returns The Vector representing the center position of the sphere.
|
824
|
+
* @since 1.0
|
825
|
+
*/
|
826
|
+
LEAP_EXPORT Vector sphereCenter() const;
|
827
|
+
|
828
|
+
/**
|
829
|
+
* The radius of a sphere fit to the curvature of this hand.
|
830
|
+
*
|
831
|
+
* This sphere is placed roughly as if the hand were holding a ball. Thus the
|
832
|
+
* size of the sphere decreases as the fingers are curled into a fist.
|
833
|
+
*
|
834
|
+
* \include Hand_sphereRadius.txt
|
835
|
+
*
|
836
|
+
* @returns The radius of the sphere in millimeters.
|
837
|
+
* @since 1.0
|
838
|
+
*/
|
839
|
+
LEAP_EXPORT float sphereRadius() const;
|
840
|
+
|
841
|
+
/**
|
842
|
+
* The change of position of this hand between the current frame and
|
843
|
+
* the specified frame.
|
844
|
+
*
|
845
|
+
* The returned translation vector provides the magnitude and direction of
|
846
|
+
* the movement in millimeters.
|
847
|
+
*
|
848
|
+
* \include Hand_translation.txt
|
849
|
+
*
|
850
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
851
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
852
|
+
* returns a zero vector.
|
853
|
+
*
|
854
|
+
* @param sinceFrame The starting frame for computing the translation.
|
855
|
+
* @returns A Vector representing the heuristically determined change in
|
856
|
+
* hand position between the current frame and that specified in the
|
857
|
+
* sinceFrame parameter.
|
858
|
+
* @since 1.0
|
859
|
+
*/
|
860
|
+
LEAP_EXPORT Vector translation(const Frame& sinceFrame) const;
|
861
|
+
|
862
|
+
/**
|
863
|
+
* The estimated probability that the hand motion between the current
|
864
|
+
* frame and the specified frame is intended to be a translating motion.
|
865
|
+
*
|
866
|
+
* \include Hand_translationProbability.txt
|
867
|
+
*
|
868
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
869
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
870
|
+
* returns zero.
|
871
|
+
*
|
872
|
+
* @param sinceFrame The starting frame for computing the translation.
|
873
|
+
* @returns A value between 0 and 1 representing the estimated probability
|
874
|
+
* that the hand motion between the current frame and the specified frame
|
875
|
+
* is intended to be a translating motion.
|
876
|
+
* @since 1.0
|
877
|
+
*/
|
878
|
+
LEAP_EXPORT float translationProbability(const Frame& sinceFrame) const;
|
879
|
+
|
880
|
+
/**
|
881
|
+
* The axis of rotation derived from the change in orientation of this
|
882
|
+
* hand, and any associated fingers and tools, between the current frame
|
883
|
+
* and the specified frame.
|
884
|
+
*
|
885
|
+
* \include Hand_rotationAxis.txt
|
886
|
+
*
|
887
|
+
* The returned direction vector is normalized.
|
888
|
+
*
|
889
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
890
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
891
|
+
* returns a zero vector.
|
892
|
+
*
|
893
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
894
|
+
* @returns A normalized direction Vector representing the heuristically
|
895
|
+
* determined axis of rotational change of the hand between the current
|
896
|
+
* frame and that specified in the sinceFrame parameter.
|
897
|
+
* @since 1.0
|
898
|
+
*/
|
899
|
+
LEAP_EXPORT Vector rotationAxis(const Frame& sinceFrame) const;
|
900
|
+
|
901
|
+
/**
|
902
|
+
* The angle of rotation around the rotation axis derived from the change
|
903
|
+
* in orientation of this hand, and any associated fingers and tools,
|
904
|
+
* between the current frame and the specified frame.
|
905
|
+
*
|
906
|
+
* \include Hand_rotationAngle.txt
|
907
|
+
*
|
908
|
+
* The returned angle is expressed in radians measured clockwise around the
|
909
|
+
* rotation axis (using the right-hand rule) between the start and end frames.
|
910
|
+
* The value is always between 0 and pi radians (0 and 180 degrees).
|
911
|
+
*
|
912
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
913
|
+
* this frame or sinceFrame are invalid Frame objects, then the angle of
|
914
|
+
* rotation is zero.
|
915
|
+
*
|
916
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
917
|
+
* @returns A positive value representing the heuristically determined
|
918
|
+
* rotational change of the hand between the current frame and that
|
919
|
+
* specified in the sinceFrame parameter.
|
920
|
+
* @since 1.0
|
921
|
+
*/
|
922
|
+
LEAP_EXPORT float rotationAngle(const Frame& sinceFrame) const;
|
923
|
+
|
924
|
+
/**
|
925
|
+
* The angle of rotation around the specified axis derived from the change
|
926
|
+
* in orientation of this hand, and any associated fingers and tools,
|
927
|
+
* between the current frame and the specified frame.
|
928
|
+
*
|
929
|
+
* \include Hand_rotationAngle_axis.txt
|
930
|
+
*
|
931
|
+
* The returned angle is expressed in radians measured clockwise around the
|
932
|
+
* rotation axis (using the right-hand rule) between the start and end frames.
|
933
|
+
* The value is always between -pi and pi radians (-180 and 180 degrees).
|
934
|
+
*
|
935
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
936
|
+
* this frame or sinceFrame are invalid Frame objects, then the angle of
|
937
|
+
* rotation is zero.
|
938
|
+
*
|
939
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
940
|
+
* @param axis The axis to measure rotation around.
|
941
|
+
* @returns A value representing the heuristically determined rotational
|
942
|
+
* change of the hand between the current frame and that specified in the
|
943
|
+
* sinceFrame parameter around the specified axis.
|
944
|
+
* @since 1.0
|
945
|
+
*/
|
946
|
+
LEAP_EXPORT float rotationAngle(const Frame& sinceFrame, const Vector& axis) const;
|
947
|
+
|
948
|
+
/**
|
949
|
+
* The transform matrix expressing the rotation derived from the change
|
950
|
+
* in orientation of this hand, and any associated fingers and tools,
|
951
|
+
* between the current frame and the specified frame.
|
952
|
+
*
|
953
|
+
* \include Hand_rotationMatrix.txt
|
954
|
+
*
|
955
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
956
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
957
|
+
* returns an identity matrix.
|
958
|
+
*
|
959
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
960
|
+
* @returns A transformation Matrix representing the heuristically determined
|
961
|
+
* rotational change of the hand between the current frame and that specified
|
962
|
+
* in the sinceFrame parameter.
|
963
|
+
* @since 1.0
|
964
|
+
*/
|
965
|
+
LEAP_EXPORT Matrix rotationMatrix(const Frame& sinceFrame) const;
|
966
|
+
|
967
|
+
/**
|
968
|
+
* The estimated probability that the hand motion between the current
|
969
|
+
* frame and the specified frame is intended to be a rotating motion.
|
970
|
+
*
|
971
|
+
* \include Hand_rotationProbability.txt
|
972
|
+
*
|
973
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
974
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
975
|
+
* returns zero.
|
976
|
+
*
|
977
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
978
|
+
* @returns A value between 0 and 1 representing the estimated probability
|
979
|
+
* that the hand motion between the current frame and the specified frame
|
980
|
+
* is intended to be a rotating motion.
|
981
|
+
* @since 1.0
|
982
|
+
*/
|
983
|
+
LEAP_EXPORT float rotationProbability(const Frame& sinceFrame) const;
|
984
|
+
|
985
|
+
/**
|
986
|
+
* The scale factor derived from this hand's motion between the current frame
|
987
|
+
* and the specified frame.
|
988
|
+
*
|
989
|
+
* The scale factor is always positive. A value of 1.0 indicates no
|
990
|
+
* scaling took place. Values between 0.0 and 1.0 indicate contraction
|
991
|
+
* and values greater than 1.0 indicate expansion.
|
992
|
+
*
|
993
|
+
* \include Hand_scaleFactor.txt
|
994
|
+
*
|
995
|
+
* The Leap Motion software derives scaling from the relative inward or outward motion of
|
996
|
+
* a hand and its associated fingers and tools (independent of translation
|
997
|
+
* and rotation).
|
998
|
+
*
|
999
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
1000
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
1001
|
+
* returns 1.0.
|
1002
|
+
*
|
1003
|
+
* @param sinceFrame The starting frame for computing the relative scaling.
|
1004
|
+
* @returns A positive value representing the heuristically determined
|
1005
|
+
* scaling change ratio of the hand between the current frame and that
|
1006
|
+
* specified in the sinceFrame parameter.
|
1007
|
+
* @since 1.0
|
1008
|
+
*/
|
1009
|
+
LEAP_EXPORT float scaleFactor(const Frame& sinceFrame) const;
|
1010
|
+
|
1011
|
+
/**
|
1012
|
+
* The estimated probability that the hand motion between the current
|
1013
|
+
* frame and the specified frame is intended to be a scaling motion.
|
1014
|
+
*
|
1015
|
+
* \include Hand_scaleProbability.txt
|
1016
|
+
*
|
1017
|
+
* If a corresponding Hand object is not found in sinceFrame, or if either
|
1018
|
+
* this frame or sinceFrame are invalid Frame objects, then this method
|
1019
|
+
* returns zero.
|
1020
|
+
*
|
1021
|
+
* @param sinceFrame The starting frame for computing the relative scaling.
|
1022
|
+
* @returns A value between 0 and 1 representing the estimated probability
|
1023
|
+
* that the hand motion between the current frame and the specified frame
|
1024
|
+
* is intended to be a scaling motion.
|
1025
|
+
* @since 1.0
|
1026
|
+
*/
|
1027
|
+
LEAP_EXPORT float scaleProbability(const Frame& sinceFrame) const;
|
1028
|
+
|
1029
|
+
/**
|
1030
|
+
* The duration of time this Hand has been visible to the Leap Motion Controller.
|
1031
|
+
*
|
1032
|
+
* \include Hand_timeVisible.txt
|
1033
|
+
*
|
1034
|
+
* @returns The duration (in seconds) that this Hand has been tracked.
|
1035
|
+
* @since 1.0
|
1036
|
+
*/
|
1037
|
+
LEAP_EXPORT float timeVisible() const;
|
1038
|
+
|
1039
|
+
/**
|
1040
|
+
* Reports whether this is a valid Hand object.
|
1041
|
+
*
|
1042
|
+
* \include Hand_isValid.txt
|
1043
|
+
*
|
1044
|
+
* @returns True, if this Hand object contains valid tracking data.
|
1045
|
+
* @since 1.0
|
1046
|
+
*/
|
1047
|
+
LEAP_EXPORT bool isValid() const;
|
1048
|
+
|
1049
|
+
/**
|
1050
|
+
* Returns an invalid Hand object.
|
1051
|
+
*
|
1052
|
+
* \include Hand_invalid.txt
|
1053
|
+
*
|
1054
|
+
* You can use the instance returned by this function in comparisons testing
|
1055
|
+
* whether a given Hand instance is valid or invalid. (You can also use the
|
1056
|
+
* Hand::isValid() function.)
|
1057
|
+
*
|
1058
|
+
* @returns The invalid Hand instance.
|
1059
|
+
* @since 1.0
|
1060
|
+
*/
|
1061
|
+
LEAP_EXPORT static const Hand& invalid();
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
* Compare Hand object equality.
|
1065
|
+
*
|
1066
|
+
* \include Hand_operator_equals.txt
|
1067
|
+
*
|
1068
|
+
* Two Hand objects are equal if and only if both Hand objects represent the
|
1069
|
+
* exact same physical hand in the same frame and both Hand objects are valid.
|
1070
|
+
* @since 1.0
|
1071
|
+
*/
|
1072
|
+
LEAP_EXPORT bool operator==(const Hand&) const;
|
1073
|
+
|
1074
|
+
/**
|
1075
|
+
* Compare Hand object inequality.
|
1076
|
+
*
|
1077
|
+
* \include Hand_operator_not_equals.txt
|
1078
|
+
*
|
1079
|
+
* Two Hand objects are equal if and only if both Hand objects represent the
|
1080
|
+
* exact same physical hand in the same frame and both Hand objects are valid.
|
1081
|
+
* @since 1.0
|
1082
|
+
*/
|
1083
|
+
LEAP_EXPORT bool operator!=(const Hand&) const;
|
1084
|
+
|
1085
|
+
/**
|
1086
|
+
* Writes a brief, human readable description of the Hand object to an output stream.
|
1087
|
+
*
|
1088
|
+
* \include Hand_operator_stream.txt
|
1089
|
+
*
|
1090
|
+
* @since 1.0
|
1091
|
+
*/
|
1092
|
+
LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Hand&);
|
1093
|
+
|
1094
|
+
/**
|
1095
|
+
* A string containing a brief, human readable description of the Hand object.
|
1096
|
+
*
|
1097
|
+
* @returns A description of the Hand as a string.
|
1098
|
+
* @since 1.0
|
1099
|
+
*/
|
1100
|
+
LEAP_EXPORT std::string toString() const;
|
1101
|
+
};
|
1102
|
+
|
1103
|
+
/**
|
1104
|
+
* The Gesture class represents a recognized movement by the user.
|
1105
|
+
*
|
1106
|
+
* The Leap Motion Controller watches the activity within its field of view for certain movement
|
1107
|
+
* patterns typical of a user gesture or command. For example, a movement from side to
|
1108
|
+
* side with the hand can indicate a swipe gesture, while a finger poking forward
|
1109
|
+
* can indicate a screen tap gesture.
|
1110
|
+
*
|
1111
|
+
* When the Leap Motion software recognizes a gesture, it assigns an ID and adds a
|
1112
|
+
* Gesture object to the frame gesture list. For continuous gestures, which
|
1113
|
+
* occur over many frames, the Leap Motion software updates the gesture by adding
|
1114
|
+
* a Gesture object having the same ID and updated properties in each
|
1115
|
+
* subsequent frame.
|
1116
|
+
*
|
1117
|
+
* **Important:** Recognition for each type of gesture must be enabled using the
|
1118
|
+
* Controller::enableGesture() function; otherwise **no gestures are recognized or
|
1119
|
+
* reported**.
|
1120
|
+
*
|
1121
|
+
* \include Gesture_Feature_enable.txt
|
1122
|
+
*
|
1123
|
+
* Subclasses of Gesture define the properties for the specific movement patterns
|
1124
|
+
* recognized by the Leap Motion software.
|
1125
|
+
*
|
1126
|
+
* The Gesture subclasses for include:
|
1127
|
+
*
|
1128
|
+
* * CircleGesture -- A circular movement by a finger.
|
1129
|
+
* * SwipeGesture -- A straight line movement by the hand with fingers extended.
|
1130
|
+
* * ScreenTapGesture -- A forward tapping movement by a finger.
|
1131
|
+
* * KeyTapGesture -- A downward tapping movement by a finger.
|
1132
|
+
*
|
1133
|
+
* Circle and swipe gestures are continuous and these objects can have a
|
1134
|
+
* state of start, update, and stop.
|
1135
|
+
*
|
1136
|
+
* The screen tap gesture is a discrete gesture. The Leap Motion software only creates a single
|
1137
|
+
* ScreenTapGesture object for each tap and it always has a stop state.
|
1138
|
+
*
|
1139
|
+
* Get valid Gesture instances from a Frame object. You can get a list of gestures
|
1140
|
+
* with the Frame::gestures() method. You can get a list of gestures since a
|
1141
|
+
* specified frame with the `Frame::gestures(const Frame&)` method. You can also
|
1142
|
+
* use the `Frame::gesture()` method to find a gesture in the current frame using
|
1143
|
+
* an ID value obtained in a previous frame.
|
1144
|
+
*
|
1145
|
+
* Gesture objects can be invalid. For example, when you get a gesture by ID
|
1146
|
+
* using `Frame::gesture()`, and there is no gesture with that ID in the current
|
1147
|
+
* frame, then `gesture()` returns an Invalid Gesture object (rather than a null
|
1148
|
+
* value). Always check object validity in situations where a gesture might be
|
1149
|
+
* invalid.
|
1150
|
+
*
|
1151
|
+
* The following keys can be used with the Config class to configure the gesture
|
1152
|
+
* recognizer:
|
1153
|
+
*
|
1154
|
+
* Key string | Value type | Default value | Units
|
1155
|
+
* -----------|------------|---------------|------
|
1156
|
+
* Gesture.Circle.MinRadius | float | 5.0 | mm
|
1157
|
+
* Gesture.Circle.MinArc | float | 1.5*pi | radians
|
1158
|
+
* Gesture.Swipe.MinLength | float | 150 | mm
|
1159
|
+
* Gesture.Swipe.MinVelocity | float | 1000 | mm/s
|
1160
|
+
* Gesture.KeyTap.MinDownVelocity | float | 50 | mm/s
|
1161
|
+
* Gesture.KeyTap.HistorySeconds | float | 0.1 | s
|
1162
|
+
* Gesture.KeyTap.MinDistance | float | 5.0 | mm
|
1163
|
+
* Gesture.ScreenTap.MinForwardVelocity | float | 50 | mm/s
|
1164
|
+
* Gesture.ScreenTap.HistorySeconds | float | 0.1 | s
|
1165
|
+
* Gesture.ScreenTap.MinDistance | float | 3.0 | mm
|
1166
|
+
* @since 1.0
|
1167
|
+
*/
|
1168
|
+
class Gesture : public Interface {
|
1169
|
+
public:
|
1170
|
+
// For internal use only.
|
1171
|
+
Gesture(GestureImplementation*);
|
1172
|
+
|
1173
|
+
/**
|
1174
|
+
* The supported types of gestures.
|
1175
|
+
* @since 1.0
|
1176
|
+
*/
|
1177
|
+
enum Type {
|
1178
|
+
/**
|
1179
|
+
* An invalid type.
|
1180
|
+
* @since 1.0
|
1181
|
+
*/
|
1182
|
+
TYPE_INVALID = -1,
|
1183
|
+
/**
|
1184
|
+
* A straight line movement by the hand with fingers extended.
|
1185
|
+
* @since 1.0
|
1186
|
+
*/
|
1187
|
+
TYPE_SWIPE = 1,
|
1188
|
+
/**
|
1189
|
+
* A circular movement by a finger.
|
1190
|
+
* @since 1.0
|
1191
|
+
*/
|
1192
|
+
TYPE_CIRCLE = 4,
|
1193
|
+
/**
|
1194
|
+
* A forward tapping movement by a finger.
|
1195
|
+
* @since 1.0
|
1196
|
+
*/
|
1197
|
+
TYPE_SCREEN_TAP = 5,
|
1198
|
+
/**
|
1199
|
+
* A downward tapping movement by a finger.
|
1200
|
+
* @since 1.0
|
1201
|
+
*/
|
1202
|
+
TYPE_KEY_TAP = 6
|
1203
|
+
};
|
1204
|
+
|
1205
|
+
/**
|
1206
|
+
* The possible gesture states.
|
1207
|
+
* @since 1.0
|
1208
|
+
*/
|
1209
|
+
enum State {
|
1210
|
+
/**
|
1211
|
+
* An invalid state
|
1212
|
+
* @since 1.0
|
1213
|
+
*/
|
1214
|
+
STATE_INVALID = -1,
|
1215
|
+
/**
|
1216
|
+
* The gesture is starting. Just enough has happened to recognize it.
|
1217
|
+
* @since 1.0
|
1218
|
+
*/
|
1219
|
+
STATE_START = 1,
|
1220
|
+
/**
|
1221
|
+
* The gesture is in progress. (Note: not all gestures have updates).
|
1222
|
+
* @since 1.0
|
1223
|
+
*/
|
1224
|
+
STATE_UPDATE = 2,
|
1225
|
+
/**
|
1226
|
+
* The gesture has completed or stopped.
|
1227
|
+
* @since 1.0
|
1228
|
+
*/
|
1229
|
+
STATE_STOP = 3,
|
1230
|
+
};
|
1231
|
+
|
1232
|
+
/**
|
1233
|
+
* Constructs a new Gesture object.
|
1234
|
+
*
|
1235
|
+
* An uninitialized Gesture object is considered invalid. Get valid instances
|
1236
|
+
* of the Gesture class, which will be one of the Gesture subclasses, from a
|
1237
|
+
* Frame object.
|
1238
|
+
* @since 1.0
|
1239
|
+
*/
|
1240
|
+
LEAP_EXPORT Gesture();
|
1241
|
+
|
1242
|
+
/**
|
1243
|
+
* Constructs a new copy of an Gesture object.
|
1244
|
+
*
|
1245
|
+
* \include Gesture_Gesture_copy.txt
|
1246
|
+
*
|
1247
|
+
* @since 1.0
|
1248
|
+
*/
|
1249
|
+
LEAP_EXPORT Gesture(const Gesture& rhs);
|
1250
|
+
|
1251
|
+
/**
|
1252
|
+
* The gesture type.
|
1253
|
+
*
|
1254
|
+
* \include Gesture_type.txt
|
1255
|
+
*
|
1256
|
+
* @returns Gesture::Type A value from the Gesture::Type enumeration.
|
1257
|
+
* @since 1.0
|
1258
|
+
*/
|
1259
|
+
LEAP_EXPORT Type type() const;
|
1260
|
+
|
1261
|
+
/**
|
1262
|
+
* The gesture state.
|
1263
|
+
*
|
1264
|
+
* Recognized movements occur over time and have a beginning, a middle,
|
1265
|
+
* and an end. The 'state()' attribute reports where in that sequence this
|
1266
|
+
* Gesture object falls.
|
1267
|
+
*
|
1268
|
+
* \include Gesture_state.txt
|
1269
|
+
*
|
1270
|
+
* @returns Gesture::State A value from the Gesture::State enumeration.
|
1271
|
+
* @since 1.0
|
1272
|
+
*/
|
1273
|
+
LEAP_EXPORT State state() const;
|
1274
|
+
|
1275
|
+
/**
|
1276
|
+
* The gesture ID.
|
1277
|
+
*
|
1278
|
+
* All Gesture objects belonging to the same recognized movement share the
|
1279
|
+
* same ID value. Use the ID value with the Frame::gesture() method to
|
1280
|
+
* find updates related to this Gesture object in subsequent frames.
|
1281
|
+
*
|
1282
|
+
* \include Gesture_id.txt
|
1283
|
+
*
|
1284
|
+
* @returns int32_t the ID of this Gesture.
|
1285
|
+
* @since 1.0
|
1286
|
+
*/
|
1287
|
+
LEAP_EXPORT int32_t id() const;
|
1288
|
+
|
1289
|
+
/**
|
1290
|
+
* The elapsed duration of the recognized movement up to the
|
1291
|
+
* frame containing this Gesture object, in microseconds.
|
1292
|
+
*
|
1293
|
+
* \include Gesture_duration.txt
|
1294
|
+
*
|
1295
|
+
* The duration reported for the first Gesture in the sequence (with the
|
1296
|
+
* STATE_START state) will typically be a small positive number since
|
1297
|
+
* the movement must progress far enough for the Leap Motion software to recognize it as
|
1298
|
+
* an intentional gesture.
|
1299
|
+
*
|
1300
|
+
* @return int64_t the elapsed duration in microseconds.
|
1301
|
+
* @since 1.0
|
1302
|
+
*/
|
1303
|
+
LEAP_EXPORT int64_t duration() const;
|
1304
|
+
|
1305
|
+
/**
|
1306
|
+
* The elapsed duration in seconds.
|
1307
|
+
*
|
1308
|
+
* \include Gesture_durationSeconds.txt
|
1309
|
+
*
|
1310
|
+
* @see duration()
|
1311
|
+
* @return float the elapsed duration in seconds.
|
1312
|
+
* @since 1.0
|
1313
|
+
*/
|
1314
|
+
LEAP_EXPORT float durationSeconds() const;
|
1315
|
+
|
1316
|
+
/**
|
1317
|
+
* The Frame containing this Gesture instance.
|
1318
|
+
*
|
1319
|
+
* \include Gesture_frame.txt
|
1320
|
+
_
|
1321
|
+
* @return Frame The parent Frame object.
|
1322
|
+
* @since 1.0
|
1323
|
+
*/
|
1324
|
+
LEAP_EXPORT Frame frame() const;
|
1325
|
+
|
1326
|
+
/**
|
1327
|
+
* The list of hands associated with this Gesture, if any.
|
1328
|
+
*
|
1329
|
+
* \include Gesture_hands.txt
|
1330
|
+
*
|
1331
|
+
* If no hands are related to this gesture, the list is empty.
|
1332
|
+
*
|
1333
|
+
* @return HandList the list of related Hand objects.
|
1334
|
+
* @since 1.0
|
1335
|
+
*/
|
1336
|
+
LEAP_EXPORT HandList hands() const;
|
1337
|
+
|
1338
|
+
/**
|
1339
|
+
* The list of fingers and tools associated with this Gesture, if any.
|
1340
|
+
*
|
1341
|
+
* If no Pointable objects are related to this gesture, the list is empty.
|
1342
|
+
*
|
1343
|
+
* \include Gesture_pointables.txt
|
1344
|
+
*
|
1345
|
+
* @return PointableList the list of related Pointable objects.
|
1346
|
+
* @since 1.0
|
1347
|
+
*/
|
1348
|
+
LEAP_EXPORT PointableList pointables() const;
|
1349
|
+
|
1350
|
+
/**
|
1351
|
+
* Reports whether this Gesture instance represents a valid Gesture.
|
1352
|
+
*
|
1353
|
+
* An invalid Gesture object does not represent a snapshot of a recognized
|
1354
|
+
* movement. Invalid Gesture objects are returned when a valid object cannot
|
1355
|
+
* be provided. For example, when you get an gesture by ID
|
1356
|
+
* using Frame::gesture(), and there is no gesture with that ID in the current
|
1357
|
+
* frame, then gesture() returns an Invalid Gesture object (rather than a null
|
1358
|
+
* value). Always check object validity in situations where an gesture might be
|
1359
|
+
* invalid.
|
1360
|
+
*
|
1361
|
+
* \include Gesture_isValid.txt
|
1362
|
+
*
|
1363
|
+
* @returns bool True, if this is a valid Gesture instance; false, otherwise.
|
1364
|
+
* @since 1.0
|
1365
|
+
*/
|
1366
|
+
LEAP_EXPORT bool isValid() const;
|
1367
|
+
|
1368
|
+
/**
|
1369
|
+
* Compare Gesture object equality.
|
1370
|
+
*
|
1371
|
+
* \include Gesture_operator_equals.txt
|
1372
|
+
*
|
1373
|
+
* Two Gestures are equal if they represent the same snapshot of the same
|
1374
|
+
* recognized movement.
|
1375
|
+
* @since 1.0
|
1376
|
+
*/
|
1377
|
+
LEAP_EXPORT bool operator==(const Gesture& rhs) const;
|
1378
|
+
|
1379
|
+
/**
|
1380
|
+
* Compare Gesture object inequality.
|
1381
|
+
*
|
1382
|
+
* \include Gesture_operator_not_equals.txt
|
1383
|
+
*
|
1384
|
+
* Two Gestures are equal only if they represent the same snapshot of the same
|
1385
|
+
* recognized movement.
|
1386
|
+
* @since 1.0
|
1387
|
+
*/
|
1388
|
+
LEAP_EXPORT bool operator!=(const Gesture& rhs) const;
|
1389
|
+
|
1390
|
+
/**
|
1391
|
+
* A string containing a brief, human-readable description of this
|
1392
|
+
* Gesture.
|
1393
|
+
*
|
1394
|
+
* \include Gesture_toString.txt
|
1395
|
+
*
|
1396
|
+
* @since 1.0
|
1397
|
+
*/
|
1398
|
+
LEAP_EXPORT std::string toString() const;
|
1399
|
+
|
1400
|
+
/**
|
1401
|
+
* Returns an invalid Gesture object.
|
1402
|
+
*
|
1403
|
+
* You can use the instance returned by this function in comparisons testing
|
1404
|
+
* whether a given Gesture instance is valid or invalid. (You can also use the
|
1405
|
+
* Gesture::isValid() function.)
|
1406
|
+
*
|
1407
|
+
* \include Gesture_invalid.txt
|
1408
|
+
*
|
1409
|
+
* @returns The invalid Gesture instance.
|
1410
|
+
* @since 1.0
|
1411
|
+
*/
|
1412
|
+
LEAP_EXPORT static const Gesture& invalid();
|
1413
|
+
};
|
1414
|
+
|
1415
|
+
/**
|
1416
|
+
* The SwipeGesture class represents a swiping motion of a finger or tool.
|
1417
|
+
*
|
1418
|
+
* \image html images/Leap_Gesture_Swipe.png
|
1419
|
+
*
|
1420
|
+
* **Important:** To use swipe gestures in your application, you must enable
|
1421
|
+
* recognition of the swipe gesture. You can enable recognition with:
|
1422
|
+
*
|
1423
|
+
* \include Gesture_Swipe_Enable.txt
|
1424
|
+
*
|
1425
|
+
* Swipe gestures are continuous.
|
1426
|
+
*
|
1427
|
+
* You can set the minimum length and velocity required for a movement
|
1428
|
+
* to be recognized as a swipe using the config attribute of a connected
|
1429
|
+
* Controller object. Use the following keys to configure swipe recognition:
|
1430
|
+
*
|
1431
|
+
* Key string | Value type | Default value | Units
|
1432
|
+
* -----------|------------|---------------|------
|
1433
|
+
* Gesture.Swipe.MinLength | float | 150 | mm
|
1434
|
+
* Gesture.Swipe.MinVelocity | float | 1000 | mm/s
|
1435
|
+
*
|
1436
|
+
* The following example demonstrates how to set the swipe configuration
|
1437
|
+
* parameters:
|
1438
|
+
*
|
1439
|
+
* \include Gesture_Swipe_Params.txt
|
1440
|
+
* @since 1.0
|
1441
|
+
*/
|
1442
|
+
class SwipeGesture : public Gesture
|
1443
|
+
{
|
1444
|
+
public:
|
1445
|
+
/**
|
1446
|
+
* The swipe gesture type.
|
1447
|
+
*
|
1448
|
+
* \include SwipeGesture_classType.txt
|
1449
|
+
*
|
1450
|
+
* @returns Type The type value designating a swipe gesture.
|
1451
|
+
* @since 1.0
|
1452
|
+
*/
|
1453
|
+
static Type classType() { return TYPE_SWIPE; }
|
1454
|
+
|
1455
|
+
LEAP_EXPORT SwipeGesture();
|
1456
|
+
|
1457
|
+
/**
|
1458
|
+
* Constructs a SwipeGesture object from an instance of the Gesture class.
|
1459
|
+
*
|
1460
|
+
* \include SwipeGesture_SwipeGesture.txt
|
1461
|
+
*
|
1462
|
+
* @param rhs The Gesture instance to specialize. This Gesture instance must
|
1463
|
+
* be a SwipeGesture object.
|
1464
|
+
* @since 1.0
|
1465
|
+
*/
|
1466
|
+
LEAP_EXPORT SwipeGesture(const Gesture& rhs);
|
1467
|
+
|
1468
|
+
/**
|
1469
|
+
* The position where the swipe began.
|
1470
|
+
*
|
1471
|
+
* \include SwipeGesture_startPosition.txt
|
1472
|
+
*
|
1473
|
+
* @returns Vector The starting position within the Leap Motion frame of
|
1474
|
+
* reference, in mm.
|
1475
|
+
* @since 1.0
|
1476
|
+
*/
|
1477
|
+
LEAP_EXPORT Vector startPosition() const;
|
1478
|
+
|
1479
|
+
/**
|
1480
|
+
* The current position of the swipe.
|
1481
|
+
*
|
1482
|
+
* \include SwipeGesture_position.txt
|
1483
|
+
*
|
1484
|
+
* @returns Vector The current swipe position within the Leap Motion frame of
|
1485
|
+
* reference, in mm.
|
1486
|
+
* @since 1.0
|
1487
|
+
*/
|
1488
|
+
LEAP_EXPORT Vector position() const;
|
1489
|
+
|
1490
|
+
/**
|
1491
|
+
* The unit direction vector parallel to the swipe motion.
|
1492
|
+
*
|
1493
|
+
* \include SwipeGesture_direction.txt
|
1494
|
+
*
|
1495
|
+
* You can compare the components of the vector to classify the swipe as
|
1496
|
+
* appropriate for your application. For example, if you are using swipes
|
1497
|
+
* for two dimensional scrolling, you can compare the x and y values to
|
1498
|
+
* determine if the swipe is primarily horizontal or vertical.
|
1499
|
+
*
|
1500
|
+
* @returns Vector The unit direction vector representing the swipe
|
1501
|
+
* motion.
|
1502
|
+
* @since 1.0
|
1503
|
+
*/
|
1504
|
+
LEAP_EXPORT Vector direction() const;
|
1505
|
+
|
1506
|
+
/**
|
1507
|
+
* The swipe speed in mm/second.
|
1508
|
+
*
|
1509
|
+
* \include SwipeGesture_speed.txt
|
1510
|
+
*
|
1511
|
+
* @returns float The speed of the finger performing the swipe gesture in
|
1512
|
+
* millimeters per second.
|
1513
|
+
* @since 1.0
|
1514
|
+
*/
|
1515
|
+
LEAP_EXPORT float speed() const;
|
1516
|
+
|
1517
|
+
/**
|
1518
|
+
* The finger performing the swipe gesture.
|
1519
|
+
*
|
1520
|
+
* \include SwipeGesture_pointable.txt
|
1521
|
+
*
|
1522
|
+
* @returns Pointable A Pointable object representing the swiping finger.
|
1523
|
+
* @since 1.0
|
1524
|
+
*/
|
1525
|
+
LEAP_EXPORT Pointable pointable() const;
|
1526
|
+
};
|
1527
|
+
|
1528
|
+
/**
|
1529
|
+
* The CircleGesture classes represents a circular finger movement.
|
1530
|
+
*
|
1531
|
+
* A circle movement is recognized when the tip of a finger draws a circle
|
1532
|
+
* within the Leap Motion Controller field of view.
|
1533
|
+
*
|
1534
|
+
* \image html images/Leap_Gesture_Circle.png
|
1535
|
+
*
|
1536
|
+
* **Important:** To use circle gestures in your application, you must enable
|
1537
|
+
* recognition of the circle gesture. You can enable recognition with:
|
1538
|
+
*
|
1539
|
+
* \include Gesture_Circle_Enable.txt
|
1540
|
+
*
|
1541
|
+
* Circle gestures are continuous. The CircleGesture objects for the gesture have
|
1542
|
+
* three possible states:
|
1543
|
+
*
|
1544
|
+
* * State::STATE_START -- The circle gesture has just started. The movement has
|
1545
|
+
* progressed far enough for the recognizer to classify it as a circle.
|
1546
|
+
* * State::STATE_UPDATE -- The circle gesture is continuing.
|
1547
|
+
* * State::STATE_STOP -- The circle gesture is finished.
|
1548
|
+
*
|
1549
|
+
* You can set the minimum radius and minimum arc length required for a movement
|
1550
|
+
* to be recognized as a circle using the config attribute of a connected
|
1551
|
+
* Controller object. Use the following keys to configure circle recognition:
|
1552
|
+
*
|
1553
|
+
* Key string | Value type | Default value | Units
|
1554
|
+
* -----------|------------|---------------|------
|
1555
|
+
* Gesture.Circle.MinRadius | float | 5.0 | mm
|
1556
|
+
* Gesture.Circle.MinArc | float | 1.5*pi | radians
|
1557
|
+
*
|
1558
|
+
* The following example demonstrates how to set the circle configuration
|
1559
|
+
* parameters:
|
1560
|
+
*
|
1561
|
+
* \include Gesture_Circle_Params.txt
|
1562
|
+
*
|
1563
|
+
* @since 1.0
|
1564
|
+
*/
|
1565
|
+
class CircleGesture : public Gesture
|
1566
|
+
{
|
1567
|
+
public:
|
1568
|
+
/**
|
1569
|
+
* The circle gesture type.
|
1570
|
+
*
|
1571
|
+
* \include CircleGesture_classType.txt
|
1572
|
+
*
|
1573
|
+
* @returns Type The type value designating a circle gesture.
|
1574
|
+
* @since 1.0
|
1575
|
+
*/
|
1576
|
+
static Type classType() { return TYPE_CIRCLE; }
|
1577
|
+
|
1578
|
+
/**
|
1579
|
+
* Constructs a new CircleGesture object.
|
1580
|
+
*
|
1581
|
+
* An uninitialized CircleGesture object is considered invalid. Get valid instances
|
1582
|
+
* of the CircleGesture class from a Frame object.
|
1583
|
+
* @since 1.0
|
1584
|
+
*/
|
1585
|
+
LEAP_EXPORT CircleGesture();
|
1586
|
+
|
1587
|
+
/**
|
1588
|
+
* Constructs a CircleGesture object from an instance of the Gesture class.
|
1589
|
+
*
|
1590
|
+
* \include CircleGesture_CircleGesture.txt
|
1591
|
+
*
|
1592
|
+
* @param rhs The Gesture instance to specialize. This Gesture instance must
|
1593
|
+
* be a CircleGesture object.
|
1594
|
+
* @since 1.0
|
1595
|
+
*/
|
1596
|
+
LEAP_EXPORT CircleGesture(const Gesture& rhs);
|
1597
|
+
|
1598
|
+
/**
|
1599
|
+
* The center point of the circle within the Leap Motion frame of reference.
|
1600
|
+
*
|
1601
|
+
* \include CircleGesture_center.txt
|
1602
|
+
* @returns Vector The center of the circle in mm from the Leap Motion origin.
|
1603
|
+
* @since 1.0
|
1604
|
+
*/
|
1605
|
+
LEAP_EXPORT Vector center() const;
|
1606
|
+
|
1607
|
+
/**
|
1608
|
+
* Returns the normal vector for the circle being traced.
|
1609
|
+
*
|
1610
|
+
* If you draw the circle clockwise, the normal vector points in the same
|
1611
|
+
* general direction as the pointable object drawing the circle. If you draw
|
1612
|
+
* the circle counterclockwise, the normal points back toward the
|
1613
|
+
* pointable. If the angle between the normal and the pointable object
|
1614
|
+
* drawing the circle is less than 90 degrees, then the circle is clockwise.
|
1615
|
+
*
|
1616
|
+
* \include Gesture_Circle_Direction.txt
|
1617
|
+
*
|
1618
|
+
* @return Vector the normal vector for the circle being traced
|
1619
|
+
* @since 1.0
|
1620
|
+
*/
|
1621
|
+
LEAP_EXPORT Vector normal() const;
|
1622
|
+
|
1623
|
+
/**
|
1624
|
+
* The number of times the finger tip has traversed the circle.
|
1625
|
+
*
|
1626
|
+
* Progress is reported as a positive number of the number. For example,
|
1627
|
+
* a progress value of .5 indicates that the finger has gone halfway
|
1628
|
+
* around, while a value of 3 indicates that the finger has gone around
|
1629
|
+
* the the circle three times.
|
1630
|
+
*
|
1631
|
+
* \include CircleGesture_progress.txt
|
1632
|
+
*
|
1633
|
+
* Progress starts where the circle gesture began. Since the circle
|
1634
|
+
* must be partially formed before the Leap Motion software can recognize it, progress
|
1635
|
+
* will be greater than zero when a circle gesture first appears in the
|
1636
|
+
* frame.
|
1637
|
+
*
|
1638
|
+
* @returns float A positive number indicating the gesture progress.
|
1639
|
+
* @since 1.0
|
1640
|
+
*/
|
1641
|
+
LEAP_EXPORT float progress() const;
|
1642
|
+
|
1643
|
+
/**
|
1644
|
+
* The radius of the circle.
|
1645
|
+
*
|
1646
|
+
* \include CircleGesture_radius.txt
|
1647
|
+
*
|
1648
|
+
* @returns The circle radius in mm.
|
1649
|
+
* @since 1.0
|
1650
|
+
*/
|
1651
|
+
LEAP_EXPORT float radius() const;
|
1652
|
+
|
1653
|
+
/**
|
1654
|
+
* The finger performing the circle gesture.
|
1655
|
+
*
|
1656
|
+
* \include CircleGesture_pointable.txt
|
1657
|
+
*
|
1658
|
+
* @returns Pointable A Pointable object representing the circling finger.
|
1659
|
+
* @since 1.0
|
1660
|
+
*/
|
1661
|
+
LEAP_EXPORT Pointable pointable() const;
|
1662
|
+
};
|
1663
|
+
|
1664
|
+
/**
|
1665
|
+
* The ScreenTapGesture class represents a tapping gesture by a finger or tool.
|
1666
|
+
*
|
1667
|
+
* A screen tap gesture is recognized when the tip of a finger pokes forward
|
1668
|
+
* and then springs back to approximately the original postion, as if
|
1669
|
+
* tapping a vertical screen. The tapping finger must pause briefly before beginning the tap.
|
1670
|
+
*
|
1671
|
+
* \image html images/Leap_Gesture_Tap2.png
|
1672
|
+
*
|
1673
|
+
* **Important:** To use screen tap gestures in your application, you must enable
|
1674
|
+
* recognition of the screen tap gesture. You can enable recognition with:
|
1675
|
+
*
|
1676
|
+
* \include Gesture_ScreenTap_Enable.txt
|
1677
|
+
*
|
1678
|
+
* ScreenTap gestures are discrete. The ScreenTapGesture object representing a tap always
|
1679
|
+
* has the state, STATE_STOP. Only one ScreenTapGesture object is created for each
|
1680
|
+
* screen tap gesture recognized.
|
1681
|
+
*
|
1682
|
+
* You can set the minimum finger movement and velocity required for a movement
|
1683
|
+
* to be recognized as a screen tap as well as adjust the detection window for
|
1684
|
+
* evaluating the movement using the config attribute of a connected
|
1685
|
+
* Controller object. Use the following keys to configure screen tap recognition:
|
1686
|
+
*
|
1687
|
+
* Key string | Value type | Default value | Units
|
1688
|
+
* -----------|------------|---------------|------
|
1689
|
+
* Gesture.ScreenTap.MinForwardVelocity | float | 50 | mm/s
|
1690
|
+
* Gesture.ScreenTap.HistorySeconds | float | 0.1 | s
|
1691
|
+
* Gesture.ScreenTap.MinDistance | float | 3.0 | mm
|
1692
|
+
*
|
1693
|
+
* The following example demonstrates how to set the screen tap configuration
|
1694
|
+
* parameters:
|
1695
|
+
*
|
1696
|
+
* \include Gesture_ScreenTap_Params.txt
|
1697
|
+
* @since 1.0
|
1698
|
+
*/
|
1699
|
+
class ScreenTapGesture : public Gesture
|
1700
|
+
{
|
1701
|
+
public:
|
1702
|
+
/**
|
1703
|
+
* The screen tap gesture type.
|
1704
|
+
*
|
1705
|
+
* \include ScreenTapGesture_classType.txt
|
1706
|
+
*
|
1707
|
+
* @returns Type The type value designating a screen tap gesture.
|
1708
|
+
* @since 1.0
|
1709
|
+
*/
|
1710
|
+
static Type classType() { return TYPE_SCREEN_TAP; }
|
1711
|
+
|
1712
|
+
/**
|
1713
|
+
* Constructs a new ScreenTapGesture object.
|
1714
|
+
*
|
1715
|
+
* An uninitialized ScreenTapGesture object is considered invalid. Get valid instances
|
1716
|
+
* of the ScreenTapGesture class from a Frame object.
|
1717
|
+
* @since 1.0
|
1718
|
+
*/
|
1719
|
+
LEAP_EXPORT ScreenTapGesture();
|
1720
|
+
|
1721
|
+
/**
|
1722
|
+
* Constructs a ScreenTapGesture object from an instance of the Gesture class.
|
1723
|
+
*
|
1724
|
+
* \include ScreenTapGesture_ScreenTapGesture.txt
|
1725
|
+
*
|
1726
|
+
* @param rhs The Gesture instance to specialize. This Gesture instance must
|
1727
|
+
* be a ScreenTapGesture object.
|
1728
|
+
* @since 1.0
|
1729
|
+
*/
|
1730
|
+
LEAP_EXPORT ScreenTapGesture(const Gesture& rhs);
|
1731
|
+
|
1732
|
+
/**
|
1733
|
+
* The position where the screen tap is registered.
|
1734
|
+
*
|
1735
|
+
* \include ScreenTapGesture_position.txt
|
1736
|
+
*
|
1737
|
+
* @return Vector A Vector containing the coordinates of screen tap location.
|
1738
|
+
* @since 1.0
|
1739
|
+
*/
|
1740
|
+
LEAP_EXPORT Vector position() const;
|
1741
|
+
|
1742
|
+
/**
|
1743
|
+
* The direction of finger tip motion.
|
1744
|
+
*
|
1745
|
+
* \include ScreenTapGesture_direction.txt
|
1746
|
+
*
|
1747
|
+
* @returns Vector A unit direction vector.
|
1748
|
+
* @since 1.0
|
1749
|
+
*/
|
1750
|
+
LEAP_EXPORT Vector direction() const;
|
1751
|
+
|
1752
|
+
/**
|
1753
|
+
* The progess value is always 1.0 for a screen tap gesture.
|
1754
|
+
*
|
1755
|
+
* @returns float The value 1.0.
|
1756
|
+
* @since 1.0
|
1757
|
+
*/
|
1758
|
+
LEAP_EXPORT float progress() const;
|
1759
|
+
|
1760
|
+
/**
|
1761
|
+
* The finger performing the screen tap gesture.
|
1762
|
+
*
|
1763
|
+
* \include ScreenTapGesture_pointable.txt
|
1764
|
+
*
|
1765
|
+
* @returns Pointable A Pointable object representing the tapping finger.
|
1766
|
+
* @since 1.0
|
1767
|
+
*/
|
1768
|
+
LEAP_EXPORT Pointable pointable() const;
|
1769
|
+
};
|
1770
|
+
|
1771
|
+
/**
|
1772
|
+
* The KeyTapGesture class represents a tapping gesture by a finger or tool.
|
1773
|
+
*
|
1774
|
+
* A key tap gesture is recognized when the tip of a finger rotates down toward the
|
1775
|
+
* palm and then springs back to approximately the original postion, as if
|
1776
|
+
* tapping. The tapping finger must pause briefly before beginning the tap.
|
1777
|
+
*
|
1778
|
+
* \image html images/Leap_Gesture_Tap.png
|
1779
|
+
*
|
1780
|
+
* **Important:** To use key tap gestures in your application, you must enable
|
1781
|
+
* recognition of the key tap gesture. You can enable recognition with:
|
1782
|
+
*
|
1783
|
+
* \include Gesture_KeyTap_Enable.txt
|
1784
|
+
*
|
1785
|
+
* Key tap gestures are discrete. The KeyTapGesture object representing a tap always
|
1786
|
+
* has the state, STATE_STOP. Only one KeyTapGesture object is created for each
|
1787
|
+
* key tap gesture recognized.
|
1788
|
+
*
|
1789
|
+
* You can set the minimum finger movement and velocity required for a movement
|
1790
|
+
* to be recognized as a key tap as well as adjust the detection window for
|
1791
|
+
* evaluating the movement using the config attribute of a connected
|
1792
|
+
* Controller object. Use the following configuration keys to configure key tap
|
1793
|
+
* recognition:
|
1794
|
+
*
|
1795
|
+
* Key string | Value type | Default value | Units
|
1796
|
+
* -----------|------------|---------------|------
|
1797
|
+
* Gesture.KeyTap.MinDownVelocity | float | 50 | mm/s
|
1798
|
+
* Gesture.KeyTap.HistorySeconds | float | 0.1 | s
|
1799
|
+
* Gesture.KeyTap.MinDistance | float | 5.0 | mm
|
1800
|
+
*
|
1801
|
+
* The following example demonstrates how to set the key tap configuration
|
1802
|
+
* parameters:
|
1803
|
+
*
|
1804
|
+
* \include Gesture_KeyTap_Params.txt
|
1805
|
+
*
|
1806
|
+
* @since 1.0
|
1807
|
+
*/
|
1808
|
+
class KeyTapGesture : public Gesture
|
1809
|
+
{
|
1810
|
+
public:
|
1811
|
+
/**
|
1812
|
+
* The key tap gesture type.
|
1813
|
+
*
|
1814
|
+
* \include KeyTapGesture_classType.txt
|
1815
|
+
*
|
1816
|
+
* @returns Type The type value designating a key tap gesture.
|
1817
|
+
* @since 1.0
|
1818
|
+
*/
|
1819
|
+
static Type classType() { return TYPE_KEY_TAP; }
|
1820
|
+
|
1821
|
+
/**
|
1822
|
+
* Constructs a new KeyTapGesture object.
|
1823
|
+
*
|
1824
|
+
* An uninitialized KeyTapGesture object is considered invalid. Get valid instances
|
1825
|
+
* of the KeyTapGesture class from a Frame object.
|
1826
|
+
* @since 1.0
|
1827
|
+
*/
|
1828
|
+
LEAP_EXPORT KeyTapGesture();
|
1829
|
+
|
1830
|
+
/**
|
1831
|
+
* Constructs a KeyTapGesture object from an instance of the Gesture class.
|
1832
|
+
*
|
1833
|
+
* \include KeyTapGesture_KeyTapGesture.txt
|
1834
|
+
*
|
1835
|
+
* @param rhs The Gesture instance to specialize. This Gesture instance must
|
1836
|
+
* be a KeyTapGesture object.
|
1837
|
+
* @since 1.0
|
1838
|
+
*/
|
1839
|
+
LEAP_EXPORT KeyTapGesture(const Gesture& rhs);
|
1840
|
+
|
1841
|
+
/**
|
1842
|
+
* The position where the key tap is registered.
|
1843
|
+
*
|
1844
|
+
* \include KeyTapGesture_position.txt
|
1845
|
+
*
|
1846
|
+
* @return Vector A Vector containing the coordinates of tap location.
|
1847
|
+
* @since 1.0
|
1848
|
+
*/
|
1849
|
+
LEAP_EXPORT Vector position() const;
|
1850
|
+
|
1851
|
+
/**
|
1852
|
+
* The direction of finger tip motion.
|
1853
|
+
*
|
1854
|
+
* \include KeyTapGesture_direction.txt
|
1855
|
+
*
|
1856
|
+
* @returns Vector A unit direction vector if the finger tip is moving;
|
1857
|
+
* otherwise, a zero-vector.
|
1858
|
+
* @since 1.0
|
1859
|
+
*/
|
1860
|
+
LEAP_EXPORT Vector direction() const;
|
1861
|
+
|
1862
|
+
/**
|
1863
|
+
* The progess value is always 1.0 for a key tap gesture.
|
1864
|
+
*
|
1865
|
+
* @returns float The value 1.0.
|
1866
|
+
* @since 1.0
|
1867
|
+
*/
|
1868
|
+
LEAP_EXPORT float progress() const;
|
1869
|
+
|
1870
|
+
/**
|
1871
|
+
* The finger performing the key tap gesture.
|
1872
|
+
*
|
1873
|
+
* \include KeyTapGesture_pointable.txt
|
1874
|
+
*
|
1875
|
+
* @returns Pointable A Pointable object representing the tapping finger.
|
1876
|
+
* @since 1.0
|
1877
|
+
*/
|
1878
|
+
LEAP_EXPORT Pointable pointable() const;
|
1879
|
+
};
|
1880
|
+
|
1881
|
+
/*
|
1882
|
+
* The Screen class is currently unsupported.
|
1883
|
+
*
|
1884
|
+
* We are re-evaluating this feature due to the cumbersome location process
|
1885
|
+
* required to use it and the amount of confusion about the feature's purpose.
|
1886
|
+
*
|
1887
|
+
* The Screen class represents a computer monitor screen.
|
1888
|
+
*
|
1889
|
+
* The Screen class reports characteristics describing the position and
|
1890
|
+
* orientation of the monitor screen within the Leap Motion coordinate system. These
|
1891
|
+
* characteristics include the bottom-left corner position of the screen,
|
1892
|
+
* direction vectors for the horizontal and vertical axes of the screen, and
|
1893
|
+
* the screen's normal vector. The screen must be properly registered with the
|
1894
|
+
* Screen Locator for the Leap Motion software to report these characteristics accurately.
|
1895
|
+
* The Screen class also reports the size of the screen in pixels, using
|
1896
|
+
* information obtained from the operating system. (Run the Screen Locator
|
1897
|
+
* from the Leap Motion Settings dialog, on the Screen page.)
|
1898
|
+
*
|
1899
|
+
* You can get the point of intersection between the screen and a ray
|
1900
|
+
* projected from a Pointable object using the Screen::intersect() function.
|
1901
|
+
* Likewise, you can get the closest point on the screen to a point in space
|
1902
|
+
* using the Screen::project() function. Again, the screen location
|
1903
|
+
* must be registered with the Screen Locator for these functions to
|
1904
|
+
* return accurate values.
|
1905
|
+
*
|
1906
|
+
* Note that Screen objects can be invalid, which means that they do not contain
|
1907
|
+
* valid screen coordinate data and do not correspond to a physical entity.
|
1908
|
+
* Test for validity with the Screen::isValid() function.
|
1909
|
+
* @since 1.0
|
1910
|
+
*/
|
1911
|
+
class Screen : public Interface {
|
1912
|
+
public:
|
1913
|
+
// For internal use only.
|
1914
|
+
Screen(ScreenImplementation*);
|
1915
|
+
|
1916
|
+
/**
|
1917
|
+
* Constructs a Screen object.
|
1918
|
+
*
|
1919
|
+
* An uninitialized screen is considered invalid.
|
1920
|
+
* Get valid Screen objects from a ScreenList object obtained using the
|
1921
|
+
* Controller::locatedScreens() method.
|
1922
|
+
* @since 1.0
|
1923
|
+
*/
|
1924
|
+
LEAP_EXPORT Screen();
|
1925
|
+
|
1926
|
+
/**
|
1927
|
+
* A unique identifier for this screen based on the screen
|
1928
|
+
* information in the configuration. A default screen with ID, *0*,
|
1929
|
+
* always exists and contains default characteristics, even if no screens
|
1930
|
+
* have been located.
|
1931
|
+
* @since 1.0
|
1932
|
+
*/
|
1933
|
+
LEAP_EXPORT int32_t id() const;
|
1934
|
+
|
1935
|
+
/**
|
1936
|
+
* Returns the intersection between this screen and a ray projecting from a
|
1937
|
+
* Pointable object.
|
1938
|
+
*
|
1939
|
+
* The projected ray emanates from the Pointable tipPosition along the
|
1940
|
+
* Pointable's direction vector.
|
1941
|
+
*
|
1942
|
+
* Set the normalize parameter to true to request the intersection point in
|
1943
|
+
* normalized screen coordinates. Normalized screen coordinates are usually
|
1944
|
+
* values between 0 and 1, where 0 represents the screen's origin at the
|
1945
|
+
* bottom-left corner and 1 represents the opposite edge (either top or
|
1946
|
+
* right). When you request normalized coordinates, the z-component of the
|
1947
|
+
* returned vector is zero. Multiply a normalized coordinate by the values
|
1948
|
+
* returned by Screen::widthPixels() or Screen::heightPixels() to calculate
|
1949
|
+
* the screen position in pixels (remembering that many other computer
|
1950
|
+
* graphics coordinate systems place the origin in the top-left corner).
|
1951
|
+
*
|
1952
|
+
* Set the normalize parameter to false to request the intersection point
|
1953
|
+
* in Leap Motion coordinates (millimeters from the Leap Motion origin).
|
1954
|
+
*
|
1955
|
+
* If the Pointable object points outside the screen's border (but still
|
1956
|
+
* intersects the plane in which the screen lies), the returned intersection
|
1957
|
+
* point is clamped to the nearest point on the edge of the screen.
|
1958
|
+
*
|
1959
|
+
* You can use the clampRatio parameter to contract or expand the area in
|
1960
|
+
* which you can point. For example, if you set the clampRatio parameter to
|
1961
|
+
* 0.5, then the positions reported for intersection points outside the
|
1962
|
+
* central 50% of the screen are moved to the border of this smaller area.
|
1963
|
+
* If, on the other hand, you expanded the area by setting clampRatio to
|
1964
|
+
* a value such as 3.0, then you could point well outside screen's physical
|
1965
|
+
* boundary before the intersection points would be clamped. The positions
|
1966
|
+
* for any points clamped would also be placed on this larger outer border.
|
1967
|
+
* The positions reported for any intersection points inside the clamping
|
1968
|
+
* border are unaffected by clamping.
|
1969
|
+
*
|
1970
|
+
* \include Screen_Normalized_2.txt
|
1971
|
+
*
|
1972
|
+
* If the Pointable object does not point toward the plane of the screen
|
1973
|
+
* (i.e. it is pointing parallel to or away from the screen), then the
|
1974
|
+
* components of the returned vector are all set to NaN (not-a-number).
|
1975
|
+
*
|
1976
|
+
* @param pointable The Pointable object to check for screen intersection.
|
1977
|
+
*
|
1978
|
+
* @param normalize If true, return normalized coordinates representing
|
1979
|
+
* the intersection point as a percentage of the screen's width and height.
|
1980
|
+
* If false, return Leap Motion coordinates (millimeters from the Leap Motion origin,
|
1981
|
+
* which is located at the center of the top surface of the Leap Motion Controller).
|
1982
|
+
* If true and the clampRatio parameter is set to 1.0, coordinates will be
|
1983
|
+
* of the form (0..1, 0..1, 0). Setting the clampRatio to a different value
|
1984
|
+
* changes the range for normalized coordinates. For example, a clampRatio
|
1985
|
+
* of 5.0 changes the range of values to be of the form (-2..3, -2..3, 0).
|
1986
|
+
*
|
1987
|
+
* @param clampRatio Adjusts the clamping border around this screen.
|
1988
|
+
* By default this ratio is 1.0, and the border corresponds to the actual
|
1989
|
+
* boundaries of the screen. Setting clampRatio to 0.5 would reduce the
|
1990
|
+
* interaction area. Likewise, setting the ratio to 2.0 would increase the
|
1991
|
+
* interaction area, adding 50% around each edge of the physical monitor.
|
1992
|
+
* Intersection points outside the interaction area are repositioned to
|
1993
|
+
* the closest point on the clamping border before the vector is returned.
|
1994
|
+
*
|
1995
|
+
* @returns A Vector containing the coordinates of the intersection between
|
1996
|
+
* this screen and a ray projecting from the specified Pointable object.
|
1997
|
+
* @since 1.0
|
1998
|
+
*/
|
1999
|
+
LEAP_EXPORT Vector intersect(const Pointable& pointable, bool normalize, float clampRatio = 1.0f) const;
|
2000
|
+
|
2001
|
+
/**
|
2002
|
+
* Returns the intersection between this screen and a ray projecting from
|
2003
|
+
* the specified position along the specified direction.
|
2004
|
+
*
|
2005
|
+
* Set the normalize parameter to true to request the intersection point in
|
2006
|
+
* normalized screen coordinates. Normalized screen coordinates are usually
|
2007
|
+
* values between 0 and 1, where 0 represents the screen's origin at the
|
2008
|
+
* bottom-left corner and 1 represents the opposite edge (either top or
|
2009
|
+
* right). When you request normalized coordinates, the z-component of the
|
2010
|
+
* returned vector is zero. Multiply a normalized coordinate by the values
|
2011
|
+
* returned by Screen::widthPixels() or Screen::heightPixels() to calculate
|
2012
|
+
* the screen position in pixels (remembering that many other computer
|
2013
|
+
* graphics coordinate systems place the origin in the top-left corner).
|
2014
|
+
*
|
2015
|
+
* Set the normalize parameter to false to request the intersection point
|
2016
|
+
* in Leap Motion coordinates (millimeters from the Leap Motion origin).
|
2017
|
+
*
|
2018
|
+
* If the specified ray points outside the screen's border (but still
|
2019
|
+
* intersects the plane in which the screen lies), the returned intersection
|
2020
|
+
* point is clamped to the nearest point on the edge of the screen.
|
2021
|
+
*
|
2022
|
+
* You can use the clampRatio parameter to contract or expand the area in
|
2023
|
+
* which you can point. For example, if you set the clampRatio parameter to
|
2024
|
+
* 0.5, then the positions reported for intersection points outside the
|
2025
|
+
* central 50% of the screen are moved to the border of this smaller area.
|
2026
|
+
* If, on the other hand, you expanded the area by setting clampRatio to
|
2027
|
+
* a value such as 3.0, then you could point well outside screen's physical
|
2028
|
+
* boundary before the intersection points would be clamped. The positions
|
2029
|
+
* for any points clamped would also be placed on this larger outer border.
|
2030
|
+
* The positions reported for any intersection points inside the clamping
|
2031
|
+
* border are unaffected by clamping.
|
2032
|
+
*
|
2033
|
+
* If the specified ray does not point toward the plane of the screen
|
2034
|
+
* (i.e. it is pointing parallel to or away from the screen), then the
|
2035
|
+
* components of the returned vector are all set to NaN (not-a-number).
|
2036
|
+
*
|
2037
|
+
* @param position The position from which to check for screen intersection.
|
2038
|
+
* @param direction The direction in which to check for screen intersection.
|
2039
|
+
*
|
2040
|
+
* @param normalize If true, return normalized coordinates representing
|
2041
|
+
* the intersection point as a percentage of the screen's width and height.
|
2042
|
+
* If false, return Leap Motion coordinates (millimeters from the Leap Motion origin,
|
2043
|
+
* which is located at the center of the top surface of the Leap Motion Controller).
|
2044
|
+
* If true and the clampRatio parameter is set to 1.0, coordinates will be
|
2045
|
+
* of the form (0..1, 0..1, 0). Setting the clampRatio to a different value
|
2046
|
+
* changes the range for normalized coordinates. For example, a clampRatio
|
2047
|
+
* of 5.0 changes the range of values to be of the form (-2..3, -2..3, 0).
|
2048
|
+
*
|
2049
|
+
* @param clampRatio Adjusts the clamping border around this screen.
|
2050
|
+
* By default this ratio is 1.0, and the border corresponds to the actual
|
2051
|
+
* boundaries of the screen. Setting clampRatio to 0.5 would reduce the
|
2052
|
+
* interaction area. Likewise, setting the ratio to 2.0 would increase the
|
2053
|
+
* interaction area, adding 50% around each edge of the physical monitor.
|
2054
|
+
* Intersection points outside the interaction area are repositioned to
|
2055
|
+
* the closest point on the clamping border before the vector is returned.
|
2056
|
+
*
|
2057
|
+
* @returns A Vector containing the coordinates of the intersection between
|
2058
|
+
* this screen and a ray projecting from the specified position in the
|
2059
|
+
* specified direction.
|
2060
|
+
* @since 1.0
|
2061
|
+
*/
|
2062
|
+
LEAP_EXPORT Vector intersect(const Vector& position, const Vector& direction, bool normalize, float clampRatio = 1.0f) const;
|
2063
|
+
|
2064
|
+
/**
|
2065
|
+
* Returns the projection from the specified position onto this screen.
|
2066
|
+
*
|
2067
|
+
* Set the normalize parameter to true to request the projection point in
|
2068
|
+
* normalized screen coordinates. Normalized screen coordinates are usually
|
2069
|
+
* values between 0 and 1, where 0 represents the screen's origin at the
|
2070
|
+
* bottom-left corner and 1 represents the opposite edge (either top or
|
2071
|
+
* right). When you request normalized coordinates, the z-component of the
|
2072
|
+
* returned vector is zero. Multiply a normalized coordinate by the values
|
2073
|
+
* returned by Screen::widthPixels() or Screen::heightPixels() to calculate
|
2074
|
+
* the screen position in pixels (remembering that many other computer
|
2075
|
+
* graphics coordinate systems place the origin in the top-left corner).
|
2076
|
+
*
|
2077
|
+
* Set the normalize parameter to false to request the projection point
|
2078
|
+
* in Leap Motion coordinates (millimeters from the Leap Motion origin).
|
2079
|
+
*
|
2080
|
+
* If the specified point projects outside the screen's border, the returned
|
2081
|
+
* projection point is clamped to the nearest point on the edge of the screen.
|
2082
|
+
*
|
2083
|
+
* You can use the clampRatio parameter to contract or expand the area in
|
2084
|
+
* which you can point. For example, if you set the clampRatio parameter to
|
2085
|
+
* 0.5, then the positions reported for projection points outside the
|
2086
|
+
* central 50% of the screen are moved to the border of this smaller area.
|
2087
|
+
* If, on the other hand, you expanded the area by setting clampRatio to
|
2088
|
+
* a value such as 3.0, then you could point well outside screen's physical
|
2089
|
+
* boundary before the projection points would be clamped. The positions
|
2090
|
+
* for any points clamped would also be placed on this larger outer border.
|
2091
|
+
* The positions reported for any projection points inside the clamping
|
2092
|
+
* border are unaffected by clamping.
|
2093
|
+
*
|
2094
|
+
* @param position The position from which to project onto this screen.
|
2095
|
+
*
|
2096
|
+
* @param normalize If true, return normalized coordinates representing
|
2097
|
+
* the projection point as a percentage of the screen's width and height.
|
2098
|
+
* If false, return Leap Motion coordinates (millimeters from the Leap Motion origin,
|
2099
|
+
* which is located at the center of the top surface of the Leap Motion Controller).
|
2100
|
+
* If true and the clampRatio parameter is set to 1.0, coordinates will be
|
2101
|
+
* of the form (0..1, 0..1, 0). Setting the clampRatio to a different value
|
2102
|
+
* changes the range for normalized coordinates. For example, a clampRatio
|
2103
|
+
* of 5.0 changes the range of values to be of the form (-2..3, -2..3, 0).
|
2104
|
+
*
|
2105
|
+
* @param clampRatio Adjusts the clamping border around this screen.
|
2106
|
+
* By default this ratio is 1.0, and the border corresponds to the actual
|
2107
|
+
* boundaries of the screen. Setting clampRatio to 0.5 would reduce the
|
2108
|
+
* interaction area. Likewise, setting the ratio to 2.0 would increase the
|
2109
|
+
* interaction area, adding 50% around each edge of the physical monitor.
|
2110
|
+
* Projection points outside the interaction area are repositioned to
|
2111
|
+
* the closest point on the clamping border before the vector is returned.
|
2112
|
+
*
|
2113
|
+
* @returns A Vector containing the coordinates of the projection between
|
2114
|
+
* this screen and a ray projecting from the specified position onto the
|
2115
|
+
* screen along its normal vector.
|
2116
|
+
* @since 1.0
|
2117
|
+
*/
|
2118
|
+
LEAP_EXPORT Vector project(const Vector& position, bool normalize, float clampRatio = 1.0f) const;
|
2119
|
+
|
2120
|
+
/**
|
2121
|
+
* A Vector representing the horizontal axis of this Screen within the
|
2122
|
+
* Leap Motion coordinate system.
|
2123
|
+
*
|
2124
|
+
* The magnitude of this vector estimates the physical width of this Screen
|
2125
|
+
* in millimeters. The direction of this vector is parallel to the bottom
|
2126
|
+
* edge of the screen and points toward the right edge of the screen.
|
2127
|
+
*
|
2128
|
+
* Together, horizontalAxis(), verticalAxis(), and bottomLeftCorner()
|
2129
|
+
* describe the physical position, size and orientation of this Screen.
|
2130
|
+
*
|
2131
|
+
* @returns A Vector representing the bottom, horizontal edge of this Screen.
|
2132
|
+
* @since 1.0
|
2133
|
+
*/
|
2134
|
+
LEAP_EXPORT Vector horizontalAxis() const;
|
2135
|
+
|
2136
|
+
/**
|
2137
|
+
* A Vector representing the vertical axis of this Screen within the
|
2138
|
+
* Leap Motion coordinate system.
|
2139
|
+
*
|
2140
|
+
* The magnitude of this vector estimates the physical height of this Screen
|
2141
|
+
* in millimeters. The direction of this vector is parallel to the left
|
2142
|
+
* edge of the screen and points toward the top edge of the screen.
|
2143
|
+
*
|
2144
|
+
* Together, horizontalAxis(), verticalAxis(), and bottomLeftCorner()
|
2145
|
+
* describe the physical position, size and orientation of this screen.
|
2146
|
+
*
|
2147
|
+
* @returns A Vector representing the left, vertical edge of this Screen.
|
2148
|
+
* @since 1.0
|
2149
|
+
*/
|
2150
|
+
LEAP_EXPORT Vector verticalAxis() const;
|
2151
|
+
|
2152
|
+
/**
|
2153
|
+
* A Vector representing the bottom left corner of this Screen within the
|
2154
|
+
* Leap Motion coordinate system.
|
2155
|
+
*
|
2156
|
+
* The point represented by this vector defines the origin of the screen
|
2157
|
+
* in the Leap Motion coordinate system.
|
2158
|
+
*
|
2159
|
+
* Together, horizontalAxis(), verticalAxis(), and bottomLeftCorner()
|
2160
|
+
* describe the physical position, size and orientation of this Screen.
|
2161
|
+
*
|
2162
|
+
* @returns A Vector containing the coordinates of the bottom-left corner
|
2163
|
+
* of this Screen.
|
2164
|
+
* @since 1.0
|
2165
|
+
*/
|
2166
|
+
LEAP_EXPORT Vector bottomLeftCorner() const;
|
2167
|
+
|
2168
|
+
/**
|
2169
|
+
* A Vector normal to the plane in which this Screen lies.
|
2170
|
+
*
|
2171
|
+
* The normal vector is a unit direction vector orthogonal to the screen's
|
2172
|
+
* surface plane. It points toward a viewer positioned for typical use of
|
2173
|
+
* the monitor.
|
2174
|
+
*
|
2175
|
+
* @returns A Vector representing this Screen's normal vector.
|
2176
|
+
* @since 1.0
|
2177
|
+
*/
|
2178
|
+
LEAP_EXPORT Vector normal() const;
|
2179
|
+
|
2180
|
+
/**
|
2181
|
+
* The horizontal resolution of this screen, in pixels.
|
2182
|
+
*
|
2183
|
+
* @returns The width of this Screen in pixels.
|
2184
|
+
* @since 1.0
|
2185
|
+
*/
|
2186
|
+
LEAP_EXPORT int widthPixels() const;
|
2187
|
+
|
2188
|
+
/**
|
2189
|
+
* The vertical resolution of this screen, in pixels.
|
2190
|
+
*
|
2191
|
+
* @returns The height of this Screen in pixels.
|
2192
|
+
* @since 1.0
|
2193
|
+
*/
|
2194
|
+
LEAP_EXPORT int heightPixels() const;
|
2195
|
+
|
2196
|
+
/**
|
2197
|
+
* The shortest distance from the specified point to the plane in which this
|
2198
|
+
* Screen lies.
|
2199
|
+
*
|
2200
|
+
* @returns The length of the perpendicular line segment extending from
|
2201
|
+
* the plane this Screen lies in to the specified point.
|
2202
|
+
* @since 1.0
|
2203
|
+
*/
|
2204
|
+
LEAP_EXPORT float distanceToPoint(const Vector& point) const;
|
2205
|
+
|
2206
|
+
/**
|
2207
|
+
* Reports whether this is a valid Screen object.
|
2208
|
+
*
|
2209
|
+
* **Important:** A valid Screen object does not necessarily contain
|
2210
|
+
* up-to-date screen location information. Location information is only
|
2211
|
+
* accurate until the Leap Motion Controller or the monitor are moved. In addition, the
|
2212
|
+
* primary screen always contains default location information even if the
|
2213
|
+
* user has never run the screen location utility. This default location
|
2214
|
+
* information will not return accurate results.
|
2215
|
+
*
|
2216
|
+
* @returns True, if this Screen object contains valid data.
|
2217
|
+
* @since 1.0
|
2218
|
+
*/
|
2219
|
+
LEAP_EXPORT bool isValid() const;
|
2220
|
+
|
2221
|
+
/**
|
2222
|
+
* Returns an invalid Screen object.
|
2223
|
+
*
|
2224
|
+
* You can use the instance returned by this function in comparisons testing
|
2225
|
+
* whether a given Screen instance is valid or invalid. (You can also use the
|
2226
|
+
* Screen::isValid() function.)
|
2227
|
+
*
|
2228
|
+
* @returns The invalid Screen instance.
|
2229
|
+
* @since 1.0
|
2230
|
+
*/
|
2231
|
+
LEAP_EXPORT static const Screen& invalid();
|
2232
|
+
|
2233
|
+
/**
|
2234
|
+
* Compare Screen object equality.
|
2235
|
+
* Two Screen objects are equal if and only if both Screen objects represent the
|
2236
|
+
* exact same Screens and both Screens are valid.
|
2237
|
+
* @since 1.0
|
2238
|
+
*/
|
2239
|
+
LEAP_EXPORT bool operator==(const Screen&) const;
|
2240
|
+
|
2241
|
+
/**
|
2242
|
+
* Compare Screen object inequality.
|
2243
|
+
* Two Screen objects are equal if and only if both Screen objects represent the
|
2244
|
+
* exact same Screens and both Screens are valid.
|
2245
|
+
* @since 1.0
|
2246
|
+
*/
|
2247
|
+
LEAP_EXPORT bool operator!=(const Screen&) const;
|
2248
|
+
|
2249
|
+
/**
|
2250
|
+
* Writes a brief, human readable description of the Screen object.
|
2251
|
+
* @since 1.0
|
2252
|
+
*/
|
2253
|
+
LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Screen&);
|
2254
|
+
|
2255
|
+
/**
|
2256
|
+
* A string containing a brief, human readable description of the Screen object.
|
2257
|
+
*
|
2258
|
+
* @returns A description of the Screen as a string.
|
2259
|
+
* @since 1.0
|
2260
|
+
*/
|
2261
|
+
LEAP_EXPORT std::string toString() const;
|
2262
|
+
};
|
2263
|
+
|
2264
|
+
/**
|
2265
|
+
* The Device class represents a physically connected device.
|
2266
|
+
*
|
2267
|
+
* The Device class contains information related to a particular connected
|
2268
|
+
* device such as field of view, device id, and calibrated positions.
|
2269
|
+
*
|
2270
|
+
* Note that Device objects can be invalid, which means that they do not contain
|
2271
|
+
* valid device information and do not correspond to a physical device.
|
2272
|
+
* Test for validity with the Device::isValid() function.
|
2273
|
+
* @since 1.0
|
2274
|
+
*/
|
2275
|
+
class Device : public Interface {
|
2276
|
+
public:
|
2277
|
+
// For internal use only.
|
2278
|
+
Device(DeviceImplementation*);
|
2279
|
+
|
2280
|
+
/**
|
2281
|
+
* Constructs a Device object.
|
2282
|
+
*
|
2283
|
+
* An uninitialized device is considered invalid.
|
2284
|
+
* Get valid Device objects from a DeviceList object obtained using the
|
2285
|
+
* Controller::devices() method.
|
2286
|
+
*
|
2287
|
+
* \include Device_Device.txt
|
2288
|
+
*
|
2289
|
+
* @since 1.0
|
2290
|
+
*/
|
2291
|
+
LEAP_EXPORT Device();
|
2292
|
+
|
2293
|
+
/**
|
2294
|
+
* The angle of view along the x axis of this device.
|
2295
|
+
*
|
2296
|
+
* \image html images/Leap_horizontalViewAngle.png
|
2297
|
+
*
|
2298
|
+
* The Leap Motion controller scans a region in the shape of an inverted pyramid
|
2299
|
+
* centered at the device's center and extending upwards. The horizontalViewAngle
|
2300
|
+
* reports the view angle along the long dimension of the device.
|
2301
|
+
*
|
2302
|
+
* \include Device_horizontalViewAngle.txt
|
2303
|
+
*
|
2304
|
+
* @returns The horizontal angle of view in radians.
|
2305
|
+
* @since 1.0
|
2306
|
+
*/
|
2307
|
+
LEAP_EXPORT float horizontalViewAngle() const;
|
2308
|
+
|
2309
|
+
/**
|
2310
|
+
* The angle of view along the z axis of this device.
|
2311
|
+
*
|
2312
|
+
* \image html images/Leap_verticalViewAngle.png
|
2313
|
+
*
|
2314
|
+
* The Leap Motion controller scans a region in the shape of an inverted pyramid
|
2315
|
+
* centered at the device's center and extending upwards. The verticalViewAngle
|
2316
|
+
* reports the view angle along the short dimension of the device.
|
2317
|
+
*
|
2318
|
+
* \include Device_verticalViewAngle.txt
|
2319
|
+
*
|
2320
|
+
* @returns The vertical angle of view in radians.
|
2321
|
+
* @since 1.0
|
2322
|
+
*/
|
2323
|
+
LEAP_EXPORT float verticalViewAngle() const;
|
2324
|
+
|
2325
|
+
/**
|
2326
|
+
* The maximum reliable tracking range.
|
2327
|
+
*
|
2328
|
+
* The range reports the maximum recommended distance from the device center
|
2329
|
+
* for which tracking is expected to be reliable. This distance is not a hard limit.
|
2330
|
+
* Tracking may be still be functional above this distance or begin to degrade slightly
|
2331
|
+
* before this distance depending on calibration and extreme environmental conditions.
|
2332
|
+
*
|
2333
|
+
* \include Device_range.txt
|
2334
|
+
*
|
2335
|
+
* @returns The recommended maximum range of the device in mm.
|
2336
|
+
* @since 1.0
|
2337
|
+
*/
|
2338
|
+
LEAP_EXPORT float range() const;
|
2339
|
+
|
2340
|
+
/**
|
2341
|
+
* The distance to the nearest edge of the Leap Motion controller's view volume.
|
2342
|
+
*
|
2343
|
+
* The view volume is an axis-aligned, inverted pyramid centered on the device origin
|
2344
|
+
* and extending upward to the range limit. The walls of the pyramid are described
|
2345
|
+
* by the horizontalViewAngle and verticalViewAngle and the roof by the range.
|
2346
|
+
* This function estimates the distance between the specified input position and the
|
2347
|
+
* nearest wall or roof of the view volume.
|
2348
|
+
*
|
2349
|
+
* \include Device_distanceToBoundary.txt
|
2350
|
+
*
|
2351
|
+
* @param position The point to use for the distance calculation.
|
2352
|
+
* @returns The distance in millimeters from the input position to the nearest boundary.
|
2353
|
+
* @since 1.0
|
2354
|
+
*/
|
2355
|
+
LEAP_EXPORT float distanceToBoundary(const Vector& position) const;
|
2356
|
+
|
2357
|
+
/**
|
2358
|
+
* Reports whether this is a valid Device object.
|
2359
|
+
*
|
2360
|
+
* \include Device_isValid.txt
|
2361
|
+
*
|
2362
|
+
* @returns True, if this Device object contains valid data.
|
2363
|
+
* @since 1.0
|
2364
|
+
*/
|
2365
|
+
LEAP_EXPORT bool isValid() const;
|
2366
|
+
|
2367
|
+
/**
|
2368
|
+
* Returns an invalid Device object.
|
2369
|
+
*
|
2370
|
+
* You can use the instance returned by this function in comparisons testing
|
2371
|
+
* whether a given Device instance is valid or invalid. (You can also use the
|
2372
|
+
* Device::isValid() function.)
|
2373
|
+
*
|
2374
|
+
* \include Device_invalid.txt
|
2375
|
+
*
|
2376
|
+
* @returns The invalid Device instance.
|
2377
|
+
* @since 1.0
|
2378
|
+
*/
|
2379
|
+
LEAP_EXPORT static const Device& invalid();
|
2380
|
+
|
2381
|
+
/**
|
2382
|
+
* Compare Device object equality.
|
2383
|
+
*
|
2384
|
+
* \include Device_operator_equals.txt
|
2385
|
+
*
|
2386
|
+
* Two Device objects are equal if and only if both Device objects represent the
|
2387
|
+
* exact same Device and both Devices are valid.
|
2388
|
+
* @since 1.0
|
2389
|
+
*/
|
2390
|
+
LEAP_EXPORT bool operator==(const Device&) const;
|
2391
|
+
|
2392
|
+
/**
|
2393
|
+
* Compare Device object inequality.
|
2394
|
+
*
|
2395
|
+
* \include Device_operator_not_equals.txt
|
2396
|
+
*
|
2397
|
+
* Two Device objects are equal if and only if both Device objects represent the
|
2398
|
+
* exact same Device and both Devices are valid.
|
2399
|
+
* @since 1.0
|
2400
|
+
*/
|
2401
|
+
LEAP_EXPORT bool operator!=(const Device&) const;
|
2402
|
+
|
2403
|
+
/**
|
2404
|
+
* Writes a brief, human readable description of the Device object.
|
2405
|
+
*
|
2406
|
+
* \include Device_operator_stream.txt
|
2407
|
+
*
|
2408
|
+
* @since 1.0
|
2409
|
+
*/
|
2410
|
+
LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Device&);
|
2411
|
+
|
2412
|
+
/**
|
2413
|
+
* A string containing a brief, human readable description of the Device object.
|
2414
|
+
*
|
2415
|
+
* @returns A description of the Device as a string.
|
2416
|
+
* @since 1.0
|
2417
|
+
*/
|
2418
|
+
LEAP_EXPORT std::string toString() const;
|
2419
|
+
};
|
2420
|
+
|
2421
|
+
// For internal use only.
|
2422
|
+
template<typename L, typename T>
|
2423
|
+
class ConstListIterator {
|
2424
|
+
public:
|
2425
|
+
ConstListIterator<L,T>(const L& list, int index) : m_list(list), m_index(index) {}
|
2426
|
+
|
2427
|
+
const T operator*() const { return m_list[m_index]; }
|
2428
|
+
void operator++(int) {++m_index;}
|
2429
|
+
const ConstListIterator<L,T>& operator++() { ++m_index; return *this; }
|
2430
|
+
bool operator!=(const ConstListIterator<L,T>& rhs) const { return m_index != rhs.m_index; }
|
2431
|
+
bool operator==(const ConstListIterator<L,T>& rhs) const { return m_index == rhs.m_index; }
|
2432
|
+
|
2433
|
+
typedef std::ptrdiff_t difference_type;
|
2434
|
+
typedef T value_type;
|
2435
|
+
typedef const T* pointer;
|
2436
|
+
typedef const T& reference;
|
2437
|
+
typedef std::forward_iterator_tag iterator_category;
|
2438
|
+
|
2439
|
+
private:
|
2440
|
+
const L& m_list;
|
2441
|
+
int m_index;
|
2442
|
+
};
|
2443
|
+
|
2444
|
+
/**
|
2445
|
+
* The PointableList class represents a list of Pointable objects.
|
2446
|
+
*
|
2447
|
+
* Pointable objects include entities that can be pointed, such as fingers and tools.
|
2448
|
+
*
|
2449
|
+
* Get a PointableList object by calling Frame::pointables() or Hand::pointables().
|
2450
|
+
*
|
2451
|
+
* \include PointableList_PointableList.txt
|
2452
|
+
*
|
2453
|
+
* @since 1.0
|
2454
|
+
*/
|
2455
|
+
class PointableList : public Interface {
|
2456
|
+
public:
|
2457
|
+
// For internal use only.
|
2458
|
+
PointableList(const ListBaseImplementation<Pointable>&);
|
2459
|
+
|
2460
|
+
/**
|
2461
|
+
* Constructs an empty list of pointable entities.
|
2462
|
+
* @since 1.0
|
2463
|
+
*/
|
2464
|
+
LEAP_EXPORT PointableList();
|
2465
|
+
|
2466
|
+
/**
|
2467
|
+
* Returns the number of pointable entities in this list.
|
2468
|
+
*
|
2469
|
+
* \include PointableList_count.txt
|
2470
|
+
*
|
2471
|
+
* @returns The number of pointable entities in this list.
|
2472
|
+
* @since 1.0
|
2473
|
+
*/
|
2474
|
+
LEAP_EXPORT int count() const;
|
2475
|
+
|
2476
|
+
/**
|
2477
|
+
* Reports whether the list is empty.
|
2478
|
+
*
|
2479
|
+
* \include PointableList_isEmpty.txt
|
2480
|
+
*
|
2481
|
+
* @returns True, if the list has no members.
|
2482
|
+
* @since 1.0
|
2483
|
+
*/
|
2484
|
+
LEAP_EXPORT bool isEmpty() const;
|
2485
|
+
|
2486
|
+
/**
|
2487
|
+
* Access a list member by its position in the list.
|
2488
|
+
*
|
2489
|
+
* \include PointableList_operator_index.txt
|
2490
|
+
*
|
2491
|
+
* @param index The zero-based list position index.
|
2492
|
+
* @returns The Pointable object at the specified index.
|
2493
|
+
* @since 1.0
|
2494
|
+
*/
|
2495
|
+
LEAP_EXPORT Pointable operator[](int index) const;
|
2496
|
+
|
2497
|
+
/**
|
2498
|
+
* Appends the members of the specifed PointableList to this PointableList.
|
2499
|
+
* @param other A PointableList object containing Pointable objects
|
2500
|
+
* to append to the end of this PointableList.
|
2501
|
+
* @since 1.0
|
2502
|
+
*/
|
2503
|
+
LEAP_EXPORT PointableList& append(const PointableList& other);
|
2504
|
+
|
2505
|
+
/**
|
2506
|
+
* Appends the members of the specifed FingerList to this PointableList.
|
2507
|
+
* @param other A FingerList object containing Finger objects
|
2508
|
+
* to append to the end of this PointableList.
|
2509
|
+
* @since 1.0
|
2510
|
+
*/
|
2511
|
+
LEAP_EXPORT PointableList& append(const FingerList& other);
|
2512
|
+
|
2513
|
+
/**
|
2514
|
+
* Appends the members of the specifed ToolList to this PointableList.
|
2515
|
+
* @param other A ToolList object containing Tool objects
|
2516
|
+
* to append to the end of this PointableList.
|
2517
|
+
* @since 1.0
|
2518
|
+
*/
|
2519
|
+
LEAP_EXPORT PointableList& append(const ToolList& other);
|
2520
|
+
|
2521
|
+
/**
|
2522
|
+
* The member of the list that is farthest to the left within the standard
|
2523
|
+
* Leap Motion frame of reference (i.e has the smallest X coordinate).
|
2524
|
+
*
|
2525
|
+
* \include PointableList_leftmost.txt
|
2526
|
+
*
|
2527
|
+
* @returns The leftmost pointable, or invalid if list is empty.
|
2528
|
+
* @since 1.0
|
2529
|
+
*/
|
2530
|
+
LEAP_EXPORT Pointable leftmost() const;
|
2531
|
+
|
2532
|
+
/**
|
2533
|
+
* The member of the list that is farthest to the right within the standard
|
2534
|
+
* Leap Motion frame of reference (i.e has the largest X coordinate).
|
2535
|
+
*
|
2536
|
+
* \include PointableList_rightmost.txt
|
2537
|
+
*
|
2538
|
+
* @returns The rightmost pointable, or invalid if list is empty.
|
2539
|
+
* @since 1.0
|
2540
|
+
*/
|
2541
|
+
LEAP_EXPORT Pointable rightmost() const;
|
2542
|
+
|
2543
|
+
|
2544
|
+
/**
|
2545
|
+
* The member of the list that is farthest to the front within the standard
|
2546
|
+
* Leap Motion frame of reference (i.e has the smallest Z coordinate).
|
2547
|
+
*
|
2548
|
+
* \include PointableList_frontmost.txt
|
2549
|
+
*
|
2550
|
+
* @returns The frontmost pointable, or invalid if list is empty.
|
2551
|
+
* @since 1.0
|
2552
|
+
*/
|
2553
|
+
LEAP_EXPORT Pointable frontmost() const;
|
2554
|
+
|
2555
|
+
/**
|
2556
|
+
* A C++ iterator type for PointableList objects.
|
2557
|
+
*
|
2558
|
+
* \include PointableList_iterator.txt
|
2559
|
+
*
|
2560
|
+
* @since 1.0
|
2561
|
+
*/
|
2562
|
+
typedef ConstListIterator<PointableList, Pointable> const_iterator;
|
2563
|
+
|
2564
|
+
/**
|
2565
|
+
* The C++ iterator set to the beginning of this PointableList.
|
2566
|
+
*
|
2567
|
+
* \include PointableList_begin.txt
|
2568
|
+
*
|
2569
|
+
* @since 1.0
|
2570
|
+
*/
|
2571
|
+
LEAP_EXPORT const_iterator begin() const;
|
2572
|
+
|
2573
|
+
/**
|
2574
|
+
* The C++ iterator set to the end of this PointableList.
|
2575
|
+
*
|
2576
|
+
* \include PointableList_end.txt
|
2577
|
+
*
|
2578
|
+
* @since 1.0
|
2579
|
+
*/
|
2580
|
+
LEAP_EXPORT const_iterator end() const;
|
2581
|
+
};
|
2582
|
+
|
2583
|
+
/**
|
2584
|
+
* The FingerList class represents a list of Finger objects.
|
2585
|
+
*
|
2586
|
+
* Get a FingerList object by calling Frame::fingers().
|
2587
|
+
*
|
2588
|
+
* \include FingerList_FingerList.txt
|
2589
|
+
*
|
2590
|
+
* @since 1.0
|
2591
|
+
*/
|
2592
|
+
class FingerList : public Interface {
|
2593
|
+
public:
|
2594
|
+
// For internal use only.
|
2595
|
+
FingerList(const ListBaseImplementation<Finger>&);
|
2596
|
+
|
2597
|
+
/**
|
2598
|
+
* Constructs an empty list of fingers.
|
2599
|
+
* @since 1.0
|
2600
|
+
*/
|
2601
|
+
LEAP_EXPORT FingerList();
|
2602
|
+
|
2603
|
+
/**
|
2604
|
+
* Returns the number of fingers in this list.
|
2605
|
+
*
|
2606
|
+
* \include FingerList_count.txt
|
2607
|
+
*
|
2608
|
+
* @returns The number of fingers in this list.
|
2609
|
+
* @since 1.0
|
2610
|
+
*/
|
2611
|
+
LEAP_EXPORT int count() const;
|
2612
|
+
|
2613
|
+
/**
|
2614
|
+
* Reports whether the list is empty.
|
2615
|
+
*
|
2616
|
+
* \include FingerList_isEmpty.txt
|
2617
|
+
*
|
2618
|
+
* @returns True, if the list has no members.
|
2619
|
+
* @since 1.0
|
2620
|
+
*/
|
2621
|
+
LEAP_EXPORT bool isEmpty() const;
|
2622
|
+
|
2623
|
+
/**
|
2624
|
+
* Access a list member by its position in the list.
|
2625
|
+
*
|
2626
|
+
* \include FingerList_index.txt
|
2627
|
+
*
|
2628
|
+
* @param index The zero-based list position index.
|
2629
|
+
* @returns The Finger object at the specified index.
|
2630
|
+
* @since 1.0
|
2631
|
+
*/
|
2632
|
+
LEAP_EXPORT Finger operator[](int index) const;
|
2633
|
+
|
2634
|
+
/**
|
2635
|
+
* Appends the members of the specifed FingerList to this FingerList.
|
2636
|
+
* @param other A FingerList object containing Finger objects
|
2637
|
+
* to append to the end of this FingerList.
|
2638
|
+
* @since 1.0
|
2639
|
+
*/
|
2640
|
+
LEAP_EXPORT FingerList& append(const FingerList& other);
|
2641
|
+
|
2642
|
+
/**
|
2643
|
+
* The member of the list that is farthest to the left within the standard
|
2644
|
+
* Leap Motion frame of reference (i.e has the smallest X coordinate).
|
2645
|
+
*
|
2646
|
+
* \include FingerList_leftmost.txt
|
2647
|
+
*
|
2648
|
+
* @returns The leftmost finger, or invalid if list is empty.
|
2649
|
+
* @since 1.0
|
2650
|
+
*/
|
2651
|
+
LEAP_EXPORT Finger leftmost() const;
|
2652
|
+
|
2653
|
+
/**
|
2654
|
+
* The member of the list that is farthest to the right within the standard
|
2655
|
+
* Leap Motion frame of reference (i.e has the largest X coordinate).
|
2656
|
+
*
|
2657
|
+
* \include FingerList_rightmost.txt
|
2658
|
+
*
|
2659
|
+
* @returns The rightmost finger, or invalid if list is empty.
|
2660
|
+
* @since 1.0
|
2661
|
+
*/
|
2662
|
+
LEAP_EXPORT Finger rightmost() const;
|
2663
|
+
|
2664
|
+
/**
|
2665
|
+
* The member of the list that is farthest to the front within the standard
|
2666
|
+
* Leap Motion frame of reference (i.e has the smallest Z coordinate).
|
2667
|
+
*
|
2668
|
+
* \include FingerList_frontmost.txt
|
2669
|
+
*
|
2670
|
+
* @returns The frontmost finger, or invalid if list is empty.
|
2671
|
+
* @since 1.0
|
2672
|
+
*/
|
2673
|
+
LEAP_EXPORT Finger frontmost() const;
|
2674
|
+
|
2675
|
+
/**
|
2676
|
+
* A C++ iterator type for FingerList objects.
|
2677
|
+
*
|
2678
|
+
* \include FingerList_iterator.txt
|
2679
|
+
*
|
2680
|
+
* @since 1.0
|
2681
|
+
*/
|
2682
|
+
typedef ConstListIterator<FingerList, Finger> const_iterator;
|
2683
|
+
|
2684
|
+
/**
|
2685
|
+
* The C++ iterator set to the beginning of this FingerList.
|
2686
|
+
*
|
2687
|
+
* \include FingerList_begin.txt
|
2688
|
+
*
|
2689
|
+
* @since 1.0
|
2690
|
+
*/
|
2691
|
+
LEAP_EXPORT const_iterator begin() const;
|
2692
|
+
|
2693
|
+
/**
|
2694
|
+
* The C++ iterator set to the end of this FingerList.
|
2695
|
+
*
|
2696
|
+
* \include FingerList_end.txt
|
2697
|
+
*
|
2698
|
+
* @since 1.0
|
2699
|
+
*/
|
2700
|
+
LEAP_EXPORT const_iterator end() const;
|
2701
|
+
};
|
2702
|
+
|
2703
|
+
/**
|
2704
|
+
* The ToolList class represents a list of Tool objects.
|
2705
|
+
*
|
2706
|
+
* Get a ToolList object by calling Frame::tools() or Hand::tools().
|
2707
|
+
*
|
2708
|
+
* \include ToolList_ToolList.txt
|
2709
|
+
*
|
2710
|
+
* @since 1.0
|
2711
|
+
*/
|
2712
|
+
class ToolList : public Interface {
|
2713
|
+
public:
|
2714
|
+
// For internal use only.
|
2715
|
+
ToolList(const ListBaseImplementation<Tool>&);
|
2716
|
+
|
2717
|
+
/**
|
2718
|
+
* Constructs an empty list of tools.
|
2719
|
+
* @since 1.0
|
2720
|
+
*/
|
2721
|
+
LEAP_EXPORT ToolList();
|
2722
|
+
|
2723
|
+
/**
|
2724
|
+
* Returns the number of tools in this list.
|
2725
|
+
*
|
2726
|
+
* \include ToolList_count.txt
|
2727
|
+
*
|
2728
|
+
* @returns The number of tools in this list.
|
2729
|
+
* @since 1.0
|
2730
|
+
*/
|
2731
|
+
LEAP_EXPORT int count() const;
|
2732
|
+
|
2733
|
+
/**
|
2734
|
+
* Reports whether the list is empty.
|
2735
|
+
*
|
2736
|
+
* \include ToolList_isEmpty.txt
|
2737
|
+
*
|
2738
|
+
* @returns True, if the list has no members.
|
2739
|
+
* @since 1.0
|
2740
|
+
*/
|
2741
|
+
LEAP_EXPORT bool isEmpty() const;
|
2742
|
+
|
2743
|
+
/**
|
2744
|
+
* Access a list member by its position in the list.
|
2745
|
+
*
|
2746
|
+
* \include ToolList_operator_index.txt
|
2747
|
+
*
|
2748
|
+
* @param index The zero-based list position index.
|
2749
|
+
* @returns The Tool object at the specified index.
|
2750
|
+
* @since 1.0
|
2751
|
+
*/
|
2752
|
+
LEAP_EXPORT Tool operator[](int index) const;
|
2753
|
+
|
2754
|
+
/**
|
2755
|
+
* Appends the members of the specifed ToolList to this ToolList.
|
2756
|
+
* @param other A ToolList object containing Tool objects
|
2757
|
+
* to append to the end of this ToolList.
|
2758
|
+
* @since 1.0
|
2759
|
+
*/
|
2760
|
+
LEAP_EXPORT ToolList& append(const ToolList& other);
|
2761
|
+
|
2762
|
+
/**
|
2763
|
+
* The member of the list that is farthest to the left within the standard
|
2764
|
+
* Leap Motion frame of reference (i.e has the smallest X coordinate).
|
2765
|
+
*
|
2766
|
+
* \include ToolList_leftmost.txt
|
2767
|
+
*
|
2768
|
+
* @returns The leftmost tool, or invalid if list is empty.
|
2769
|
+
* @since 1.0
|
2770
|
+
*/
|
2771
|
+
LEAP_EXPORT Tool leftmost() const;
|
2772
|
+
|
2773
|
+
/**
|
2774
|
+
* The member of the list that is farthest to the right within the standard
|
2775
|
+
* Leap Motion frame of reference (i.e has the largest X coordinate).
|
2776
|
+
*
|
2777
|
+
* \include ToolList_rightmost.txt
|
2778
|
+
*
|
2779
|
+
* @returns The rightmost tool, or invalid if list is empty.
|
2780
|
+
* @since 1.0
|
2781
|
+
*/
|
2782
|
+
LEAP_EXPORT Tool rightmost() const;
|
2783
|
+
|
2784
|
+
/**
|
2785
|
+
* The member of the list that is farthest to the front within the standard
|
2786
|
+
* Leap Motion frame of reference (i.e has the smallest Z coordinate).
|
2787
|
+
*
|
2788
|
+
* \include ToolList_frontmost.txt
|
2789
|
+
*
|
2790
|
+
* @returns The frontmost tool, or invalid if list is empty.
|
2791
|
+
* @since 1.0
|
2792
|
+
*/
|
2793
|
+
LEAP_EXPORT Tool frontmost() const;
|
2794
|
+
|
2795
|
+
/**
|
2796
|
+
* A C++ iterator type for ToolList objects.
|
2797
|
+
*
|
2798
|
+
* \include ToolList_iterator.txt
|
2799
|
+
*
|
2800
|
+
* @since 1.0
|
2801
|
+
*/
|
2802
|
+
typedef ConstListIterator<ToolList, Tool> const_iterator;
|
2803
|
+
|
2804
|
+
/**
|
2805
|
+
* The C++ iterator set to the beginning of this ToolList.
|
2806
|
+
*
|
2807
|
+
* \include ToolList_begin.txt
|
2808
|
+
* @since 1.0
|
2809
|
+
*/
|
2810
|
+
LEAP_EXPORT const_iterator begin() const;
|
2811
|
+
|
2812
|
+
/**
|
2813
|
+
* The C++ iterator set to the end of this ToolList.
|
2814
|
+
*
|
2815
|
+
* \include ToolList_end.txt
|
2816
|
+
*
|
2817
|
+
* @since 1.0
|
2818
|
+
*/
|
2819
|
+
LEAP_EXPORT const_iterator end() const;
|
2820
|
+
};
|
2821
|
+
|
2822
|
+
/**
|
2823
|
+
* The HandList class represents a list of Hand objects.
|
2824
|
+
*
|
2825
|
+
* Get a HandList object by calling Frame::hands().
|
2826
|
+
*
|
2827
|
+
* \include HandList_HandList.txt
|
2828
|
+
*
|
2829
|
+
* @since 1.0
|
2830
|
+
*/
|
2831
|
+
class HandList : public Interface {
|
2832
|
+
public:
|
2833
|
+
// For internal use only.
|
2834
|
+
HandList(const ListBaseImplementation<Hand>&);
|
2835
|
+
|
2836
|
+
/**
|
2837
|
+
* Constructs an empty list of hands.
|
2838
|
+
* @since 1.0
|
2839
|
+
*/
|
2840
|
+
LEAP_EXPORT HandList();
|
2841
|
+
|
2842
|
+
/**
|
2843
|
+
* Returns the number of hands in this list.
|
2844
|
+
*
|
2845
|
+
* \include HandList_count.txt
|
2846
|
+
* @returns The number of hands in this list.
|
2847
|
+
* @since 1.0
|
2848
|
+
*/
|
2849
|
+
LEAP_EXPORT int count() const;
|
2850
|
+
|
2851
|
+
/**
|
2852
|
+
* Reports whether the list is empty.
|
2853
|
+
*
|
2854
|
+
* \include HandList_isEmpty.txt
|
2855
|
+
*
|
2856
|
+
* @returns True, if the list has no members.
|
2857
|
+
* @since 1.0
|
2858
|
+
*/
|
2859
|
+
LEAP_EXPORT bool isEmpty() const;
|
2860
|
+
|
2861
|
+
/**
|
2862
|
+
* Access a list member by its position in the list.
|
2863
|
+
*
|
2864
|
+
* \include HandList_operator_index.txt
|
2865
|
+
*
|
2866
|
+
* @param index The zero-based list position index.
|
2867
|
+
* @returns The Hand object at the specified index.
|
2868
|
+
* @since 1.0
|
2869
|
+
*/
|
2870
|
+
LEAP_EXPORT Hand operator[](int index) const;
|
2871
|
+
|
2872
|
+
/**
|
2873
|
+
* Appends the members of the specifed HandList to this HandList.
|
2874
|
+
* @param other A HandList object containing Hand objects
|
2875
|
+
* to append to the end of this HandList.
|
2876
|
+
*/
|
2877
|
+
LEAP_EXPORT HandList& append(const HandList& other);
|
2878
|
+
|
2879
|
+
/**
|
2880
|
+
* The member of the list that is farthest to the left within the standard
|
2881
|
+
* Leap Motion frame of reference (i.e has the smallest X coordinate).
|
2882
|
+
*
|
2883
|
+
* \include HandList_leftmost.txt
|
2884
|
+
*
|
2885
|
+
* @returns The leftmost hand, or invalid if list is empty.
|
2886
|
+
* @since 1.0
|
2887
|
+
*/
|
2888
|
+
LEAP_EXPORT Hand leftmost() const;
|
2889
|
+
|
2890
|
+
/**
|
2891
|
+
* The member of the list that is farthest to the right within the standard
|
2892
|
+
* Leap Motion frame of reference (i.e has the largest X coordinate).
|
2893
|
+
*
|
2894
|
+
* \include HandList_rightmost.txt
|
2895
|
+
*
|
2896
|
+
* @returns The rightmost hand, or invalid if list is empty.
|
2897
|
+
* @since 1.0
|
2898
|
+
*/
|
2899
|
+
LEAP_EXPORT Hand rightmost() const;
|
2900
|
+
|
2901
|
+
/**
|
2902
|
+
* The member of the list that is farthest to the front within the standard
|
2903
|
+
* Leap Motion frame of reference (i.e has the smallest Z coordinate).
|
2904
|
+
*
|
2905
|
+
* \include HandList_frontmost.txt
|
2906
|
+
*
|
2907
|
+
* @returns The frontmost hand, or invalid if list is empty.
|
2908
|
+
* @since 1.0
|
2909
|
+
*/
|
2910
|
+
LEAP_EXPORT Hand frontmost() const;
|
2911
|
+
|
2912
|
+
/**
|
2913
|
+
* A C++ iterator type for this HandList objects.
|
2914
|
+
*
|
2915
|
+
* \include HandList_iterator.txt
|
2916
|
+
*
|
2917
|
+
* @since 1.0
|
2918
|
+
*/
|
2919
|
+
typedef ConstListIterator<HandList, Hand> const_iterator;
|
2920
|
+
|
2921
|
+
/**
|
2922
|
+
* The C++ iterator set to the beginning of this HandList.
|
2923
|
+
*
|
2924
|
+
* \include HandList_begin.txt
|
2925
|
+
*
|
2926
|
+
* @since 1.0
|
2927
|
+
*/
|
2928
|
+
LEAP_EXPORT const_iterator begin() const;
|
2929
|
+
|
2930
|
+
/**
|
2931
|
+
* The C++ iterator set to the end of this HandList.
|
2932
|
+
*
|
2933
|
+
* \include HandList_end.txt
|
2934
|
+
*
|
2935
|
+
* @since 1.0
|
2936
|
+
*/
|
2937
|
+
LEAP_EXPORT const_iterator end() const;
|
2938
|
+
};
|
2939
|
+
|
2940
|
+
/**
|
2941
|
+
* The GestureList class represents a list of Gesture objects.
|
2942
|
+
*
|
2943
|
+
* Get a GestureList object from a Frame object.
|
2944
|
+
* @since 1.0
|
2945
|
+
*/
|
2946
|
+
class GestureList : public Interface {
|
2947
|
+
public:
|
2948
|
+
// For internal use only.
|
2949
|
+
GestureList(const ListBaseImplementation<Gesture>&);
|
2950
|
+
|
2951
|
+
/**
|
2952
|
+
* Constructs an empty gesture list.
|
2953
|
+
* @since 1.0
|
2954
|
+
*/
|
2955
|
+
LEAP_EXPORT GestureList();
|
2956
|
+
|
2957
|
+
/**
|
2958
|
+
* The length of this list.
|
2959
|
+
*
|
2960
|
+
* \include GestureList_count.txt
|
2961
|
+
*
|
2962
|
+
* @returns The number of gestures in this list.
|
2963
|
+
* @since 1.0
|
2964
|
+
*/
|
2965
|
+
LEAP_EXPORT int count() const;
|
2966
|
+
|
2967
|
+
/**
|
2968
|
+
* Reports whether the list is empty.
|
2969
|
+
*
|
2970
|
+
* \include GestureList_isEmpty.txt
|
2971
|
+
*
|
2972
|
+
* @returns True, if the list has no members.
|
2973
|
+
* @since 1.0
|
2974
|
+
*/
|
2975
|
+
LEAP_EXPORT bool isEmpty() const;
|
2976
|
+
|
2977
|
+
/**
|
2978
|
+
* Access a list member by its position in the list.
|
2979
|
+
*
|
2980
|
+
* \include GestureList_operator_index.txt
|
2981
|
+
*
|
2982
|
+
* @param index The zero-based list position index.
|
2983
|
+
* @returns The Gesture object at the specified index.
|
2984
|
+
* @since 1.0
|
2985
|
+
*/
|
2986
|
+
LEAP_EXPORT Gesture operator[](int index) const;
|
2987
|
+
|
2988
|
+
/**
|
2989
|
+
* Appends the members of the specified GestureList to this GestureList.
|
2990
|
+
* @param other A GestureList object containing Gesture objects
|
2991
|
+
* to append to the end of this GestureList.
|
2992
|
+
* @since 1.0
|
2993
|
+
*/
|
2994
|
+
LEAP_EXPORT GestureList& append(const GestureList& other);
|
2995
|
+
|
2996
|
+
/**
|
2997
|
+
* A C++ iterator type for GestureList objects.
|
2998
|
+
*
|
2999
|
+
* \include GestureList_iterator.txt
|
3000
|
+
* @since 1.0
|
3001
|
+
*/
|
3002
|
+
typedef ConstListIterator<GestureList, Gesture> const_iterator;
|
3003
|
+
|
3004
|
+
/**
|
3005
|
+
* The C++ iterator set to the beginning of this GestureList.
|
3006
|
+
*
|
3007
|
+
* \include GestureList_begin.txt
|
3008
|
+
*
|
3009
|
+
* @since 1.0
|
3010
|
+
*/
|
3011
|
+
LEAP_EXPORT const_iterator begin() const;
|
3012
|
+
|
3013
|
+
/**
|
3014
|
+
* The C++ iterator set to the end of this GestureList.
|
3015
|
+
*
|
3016
|
+
* \include GestureList_end.txt
|
3017
|
+
*
|
3018
|
+
* @since 1.0
|
3019
|
+
*/
|
3020
|
+
LEAP_EXPORT const_iterator end() const;
|
3021
|
+
};
|
3022
|
+
|
3023
|
+
/*
|
3024
|
+
* The ScreenList and Screen classes are currently unsupported.
|
3025
|
+
*
|
3026
|
+
* We are re-evaluating this feature due to the cumbersome location process
|
3027
|
+
* required to use it and the amount of confusion about the feature's purpose.
|
3028
|
+
*
|
3029
|
+
* The ScreenList class represents a list of Screen objects.
|
3030
|
+
*
|
3031
|
+
* The list always contains at least one entry representing the default
|
3032
|
+
* screen. If the user has not registered the location of this default
|
3033
|
+
* screen, then the coordinates, directions, and other values reported by
|
3034
|
+
* the functions in its Screen object will not be accurate. Other monitor
|
3035
|
+
* screens only appear in the list if their positions have been registered
|
3036
|
+
* using the Leap Motion Screen Locator.
|
3037
|
+
*
|
3038
|
+
* Get a ScreenList object by calling Controller::locatedScreens().
|
3039
|
+
*
|
3040
|
+
* \include Screen_Closest_1.txt
|
3041
|
+
* @since 1.0
|
3042
|
+
*/
|
3043
|
+
class ScreenList : public Interface {
|
3044
|
+
public:
|
3045
|
+
// For internal use only.
|
3046
|
+
ScreenList(const ListBaseImplementation<Screen>&);
|
3047
|
+
|
3048
|
+
/**
|
3049
|
+
* Constructs an empty list of screens.
|
3050
|
+
* @since 1.0
|
3051
|
+
*/
|
3052
|
+
LEAP_EXPORT ScreenList();
|
3053
|
+
|
3054
|
+
/**
|
3055
|
+
* Returns the number of screens in this list.
|
3056
|
+
* @returns The number of screens in this list.
|
3057
|
+
* @since 1.0
|
3058
|
+
*/
|
3059
|
+
LEAP_EXPORT int count() const;
|
3060
|
+
|
3061
|
+
/**
|
3062
|
+
* Reports whether the list is empty.
|
3063
|
+
* @returns True, if the list has no members.
|
3064
|
+
* @since 1.0
|
3065
|
+
*/
|
3066
|
+
LEAP_EXPORT bool isEmpty() const;
|
3067
|
+
|
3068
|
+
/**
|
3069
|
+
* Access a list member by its position in the list.
|
3070
|
+
* @param index The zero-based list position index.
|
3071
|
+
* @returns The Screen object at the specified index.
|
3072
|
+
* @since 1.0
|
3073
|
+
*/
|
3074
|
+
LEAP_EXPORT Screen operator[](int index) const;
|
3075
|
+
|
3076
|
+
/**
|
3077
|
+
* A C++ iterator type for this ScreenList objects.
|
3078
|
+
* @since 1.0
|
3079
|
+
*/
|
3080
|
+
typedef ConstListIterator<ScreenList, Screen> const_iterator;
|
3081
|
+
|
3082
|
+
/**
|
3083
|
+
* The C++ iterator set to the beginning of this ScreenList.
|
3084
|
+
* @since 1.0
|
3085
|
+
*/
|
3086
|
+
LEAP_EXPORT const_iterator begin() const;
|
3087
|
+
|
3088
|
+
/**
|
3089
|
+
* The C++ iterator set to the end of this ScreenList.
|
3090
|
+
* @since 1.0
|
3091
|
+
*/
|
3092
|
+
LEAP_EXPORT const_iterator end() const;
|
3093
|
+
|
3094
|
+
/**
|
3095
|
+
* Gets the closest Screen intercepting a ray projecting from the specified
|
3096
|
+
* Pointable object.
|
3097
|
+
*
|
3098
|
+
* The projected ray emanates from the Pointable tipPosition along the
|
3099
|
+
* Pointable's direction vector. If the projected ray does not intersect
|
3100
|
+
* any screen surface directly, then the Leap Motion software checks for intersection with
|
3101
|
+
* the planes extending from the surfaces of the known screens
|
3102
|
+
* and returns the Screen with the closest intersection.
|
3103
|
+
*
|
3104
|
+
* \include Screen_Closest_2.txt
|
3105
|
+
*
|
3106
|
+
* If no intersections are found (i.e. the ray is directed parallel to or
|
3107
|
+
* away from all known screens), then an invalid Screen object is returned.
|
3108
|
+
*
|
3109
|
+
* *Note:* Be sure to test whether the Screen object returned by this method
|
3110
|
+
* is valid. Attempting to use an invalid Screen object will lead to
|
3111
|
+
* incorrect results.
|
3112
|
+
*
|
3113
|
+
* @param pointable The Pointable object to check for screen intersection.
|
3114
|
+
* @returns The closest Screen toward which the specified Pointable object
|
3115
|
+
* is pointing, or, if the pointable is not pointing in the direction of
|
3116
|
+
* any known screen, an invalid Screen object.
|
3117
|
+
* @since 1.0
|
3118
|
+
*/
|
3119
|
+
LEAP_EXPORT Screen closestScreenHit(const Pointable& pointable) const;
|
3120
|
+
|
3121
|
+
/**
|
3122
|
+
* Gets the closest Screen intercepting a ray projecting from the specified
|
3123
|
+
* position in the specified direction.
|
3124
|
+
*
|
3125
|
+
* The projected ray emanates from the position along the direction vector.
|
3126
|
+
* If the projected ray does not intersect any screen surface directly,
|
3127
|
+
* then the Leap Motion software checks for intersection with the planes extending from the
|
3128
|
+
* surfaces of the known screens and returns the Screen with the closest
|
3129
|
+
* intersection.
|
3130
|
+
*
|
3131
|
+
* \include Screen_Closest_3.txt
|
3132
|
+
*
|
3133
|
+
* If no intersections are found (i.e. the ray is directed parallel to or
|
3134
|
+
* away from all known screens), then an invalid Screen object is returned.
|
3135
|
+
*
|
3136
|
+
* *Note:* Be sure to test whether the Screen object returned by this method
|
3137
|
+
* is valid. Attempting to use an invalid Screen object will lead to
|
3138
|
+
* incorrect results.
|
3139
|
+
*
|
3140
|
+
* @param position The position from which to check for screen intersection.
|
3141
|
+
* @param direction The direction in which to check for screen intersection.
|
3142
|
+
* @returns The closest Screen toward which the specified ray is pointing,
|
3143
|
+
* or, if the ray is not pointing in the direction of any known screen,
|
3144
|
+
* an invalid Screen object.
|
3145
|
+
* @since 1.0
|
3146
|
+
*/
|
3147
|
+
LEAP_EXPORT Screen closestScreenHit(const Vector& position, const Vector& direction) const;
|
3148
|
+
|
3149
|
+
/**
|
3150
|
+
* Gets the Screen closest to the specified position.
|
3151
|
+
*
|
3152
|
+
* The specified position is projected along each screen's normal vector
|
3153
|
+
* onto the screen's plane. The screen whose projected point is closest to
|
3154
|
+
* the specified position is returned. Call Screen::project(position)
|
3155
|
+
* on the returned Screen object to find the projected point.
|
3156
|
+
*
|
3157
|
+
* \include Screen_Closest_3.txt
|
3158
|
+
*
|
3159
|
+
* @param position The position from which to check for screen projection.
|
3160
|
+
* @returns The closest Screen onto which the specified position is projected.
|
3161
|
+
* @since 1.0
|
3162
|
+
*/
|
3163
|
+
LEAP_EXPORT Screen closestScreen(const Vector& position) const;
|
3164
|
+
};
|
3165
|
+
|
3166
|
+
/**
|
3167
|
+
* The DeviceList class represents a list of Device objects.
|
3168
|
+
*
|
3169
|
+
* Get a DeviceList object by calling Controller::devices().
|
3170
|
+
* @since 1.0
|
3171
|
+
*/
|
3172
|
+
class DeviceList : public Interface {
|
3173
|
+
public:
|
3174
|
+
// For internal use only.
|
3175
|
+
DeviceList(const ListBaseImplementation<Device>&);
|
3176
|
+
|
3177
|
+
/**
|
3178
|
+
* Constructs an empty list of devices.
|
3179
|
+
* @since 1.0
|
3180
|
+
*/
|
3181
|
+
LEAP_EXPORT DeviceList();
|
3182
|
+
|
3183
|
+
/**
|
3184
|
+
* Returns the number of devices in this list.
|
3185
|
+
* @returns The number of devices in this list.
|
3186
|
+
* @since 1.0
|
3187
|
+
*/
|
3188
|
+
LEAP_EXPORT int count() const;
|
3189
|
+
|
3190
|
+
/**
|
3191
|
+
* Reports whether the list is empty.
|
3192
|
+
*
|
3193
|
+
* \include DeviceList_isEmpty.txt
|
3194
|
+
*
|
3195
|
+
* @returns True, if the list has no members.
|
3196
|
+
* @since 1.0
|
3197
|
+
*/
|
3198
|
+
LEAP_EXPORT bool isEmpty() const;
|
3199
|
+
|
3200
|
+
/**
|
3201
|
+
* Access a list member by its position in the list.
|
3202
|
+
* @param index The zero-based list position index.
|
3203
|
+
* @returns The Device object at the specified index.
|
3204
|
+
* @since 1.0
|
3205
|
+
*/
|
3206
|
+
LEAP_EXPORT Device operator[](int index) const;
|
3207
|
+
|
3208
|
+
/**
|
3209
|
+
* Appends the members of the specifed DeviceList to this DeviceList.
|
3210
|
+
* @param other A DeviceList object containing Device objects
|
3211
|
+
* to append to the end of this DeviceList.
|
3212
|
+
* @since 1.0
|
3213
|
+
*/
|
3214
|
+
LEAP_EXPORT DeviceList& append(const DeviceList& other);
|
3215
|
+
|
3216
|
+
/**
|
3217
|
+
* A C++ iterator type for this DeviceList objects.
|
3218
|
+
* @since 1.0
|
3219
|
+
*/
|
3220
|
+
typedef ConstListIterator<DeviceList, Device> const_iterator;
|
3221
|
+
|
3222
|
+
/**
|
3223
|
+
* The C++ iterator set to the beginning of this DeviceList.
|
3224
|
+
* @since 1.0
|
3225
|
+
*/
|
3226
|
+
LEAP_EXPORT const_iterator begin() const;
|
3227
|
+
|
3228
|
+
/**
|
3229
|
+
* The C++ iterator set to the end of this DeviceList.
|
3230
|
+
* @since 1.0
|
3231
|
+
*/
|
3232
|
+
LEAP_EXPORT const_iterator end() const;
|
3233
|
+
};
|
3234
|
+
|
3235
|
+
/**
|
3236
|
+
* The InteractionBox class represents a box-shaped region completely
|
3237
|
+
* within the field of view of the Leap Motion controller.
|
3238
|
+
*
|
3239
|
+
* The interaction box is an axis-aligned rectangular prism and provides normalized
|
3240
|
+
* coordinates for hands, fingers, and tools within this box. The InteractionBox class
|
3241
|
+
* can make it easier to map positions in the Leap Motion coordinate system to 2D or
|
3242
|
+
* 3D coordinate systems used for application drawing.
|
3243
|
+
*
|
3244
|
+
* \image html images/Leap_InteractionBox.png
|
3245
|
+
*
|
3246
|
+
* The InteractionBox region is defined by a center and dimensions along the x, y,
|
3247
|
+
* and z axes.
|
3248
|
+
*
|
3249
|
+
* Get an InteractionBox object from a Frame object.
|
3250
|
+
* @since 1.0
|
3251
|
+
*/
|
3252
|
+
class InteractionBox : public Interface {
|
3253
|
+
public:
|
3254
|
+
// For internal use only.
|
3255
|
+
InteractionBox(InteractionBoxImplementation*);
|
3256
|
+
|
3257
|
+
LEAP_EXPORT InteractionBox();
|
3258
|
+
|
3259
|
+
/**
|
3260
|
+
* Normalizes the coordinates of a point using the interaction box.
|
3261
|
+
*
|
3262
|
+
* \include InteractionBox_normalizePoint.txt
|
3263
|
+
*
|
3264
|
+
* Coordinates from the Leap Motion frame of reference (millimeters) are converted
|
3265
|
+
* to a range of [0..1] such that the minimum value of the InteractionBox maps to 0
|
3266
|
+
* and the maximum value of the InteractionBox maps to 1.
|
3267
|
+
*
|
3268
|
+
* @param position The input position in device coordinates.
|
3269
|
+
* @param clamp Whether or not to limit the output value to the range [0,1] when the
|
3270
|
+
* input position is outside the InteractionBox. Defaults to true.
|
3271
|
+
* @returns The normalized position.
|
3272
|
+
* @since 1.0
|
3273
|
+
*/
|
3274
|
+
LEAP_EXPORT Vector normalizePoint(const Vector& position, bool clamp = true) const;
|
3275
|
+
|
3276
|
+
/**
|
3277
|
+
* Converts a position defined by normalized InteractionBox coordinates into device
|
3278
|
+
* coordinates in millimeters.
|
3279
|
+
*
|
3280
|
+
* \include InteractionBox_denormalizePoint.txt
|
3281
|
+
*
|
3282
|
+
* This function performs the inverse of normalizePoint().
|
3283
|
+
*
|
3284
|
+
* @param normalizedPosition The input position in InteractionBox coordinates.
|
3285
|
+
* @returns The corresponding denormalized position in device coordinates.
|
3286
|
+
* @since 1.0
|
3287
|
+
*/
|
3288
|
+
LEAP_EXPORT Vector denormalizePoint(const Vector& normalizedPosition) const;
|
3289
|
+
|
3290
|
+
/**
|
3291
|
+
* The center of the InteractionBox in device coordinates (millimeters). This point
|
3292
|
+
* is equidistant from all sides of the box.
|
3293
|
+
*
|
3294
|
+
* \include InteractionBox_center.txt
|
3295
|
+
*
|
3296
|
+
* @returns The InteractionBox center in device coordinates.
|
3297
|
+
* @since 1.0
|
3298
|
+
*/
|
3299
|
+
LEAP_EXPORT Vector center() const;
|
3300
|
+
|
3301
|
+
/**
|
3302
|
+
* The width of the InteractionBox in millimeters, measured along the x-axis.
|
3303
|
+
*
|
3304
|
+
* \include InteractionBox_width.txt
|
3305
|
+
*
|
3306
|
+
* @returns The InteractionBox width in millimeters.
|
3307
|
+
* @since 1.0
|
3308
|
+
*/
|
3309
|
+
LEAP_EXPORT float width() const;
|
3310
|
+
|
3311
|
+
/**
|
3312
|
+
* The height of the InteractionBox in millimeters, measured along the y-axis.
|
3313
|
+
*
|
3314
|
+
* \include InteractionBox_height.txt
|
3315
|
+
*
|
3316
|
+
* @returns The InteractionBox height in millimeters.
|
3317
|
+
* @since 1.0
|
3318
|
+
*/
|
3319
|
+
LEAP_EXPORT float height() const;
|
3320
|
+
|
3321
|
+
/**
|
3322
|
+
* The depth of the InteractionBox in millimeters, measured along the z-axis.
|
3323
|
+
*
|
3324
|
+
* \include InteractionBox_depth.txt
|
3325
|
+
*
|
3326
|
+
* @returns The InteractionBox depth in millimeters.
|
3327
|
+
* @since 1.0
|
3328
|
+
*/
|
3329
|
+
LEAP_EXPORT float depth() const;
|
3330
|
+
|
3331
|
+
/**
|
3332
|
+
* Reports whether this is a valid InteractionBox object.
|
3333
|
+
*
|
3334
|
+
* \include InteractionBox_isValid.txt
|
3335
|
+
*
|
3336
|
+
* @returns True, if this InteractionBox object contains valid data.
|
3337
|
+
* @since 1.0
|
3338
|
+
*/
|
3339
|
+
LEAP_EXPORT bool isValid() const;
|
3340
|
+
|
3341
|
+
/**
|
3342
|
+
* Returns an invalid InteractionBox object.
|
3343
|
+
*
|
3344
|
+
* You can use the instance returned by this function in comparisons testing
|
3345
|
+
* whether a given InteractionBox instance is valid or invalid. (You can also use the
|
3346
|
+
* InteractionBox::isValid() function.)
|
3347
|
+
*
|
3348
|
+
* \include InteractionBox_invalid.txt
|
3349
|
+
*
|
3350
|
+
* @returns The invalid InteractionBox instance.
|
3351
|
+
* @since 1.0
|
3352
|
+
*/
|
3353
|
+
LEAP_EXPORT static const InteractionBox& invalid();
|
3354
|
+
|
3355
|
+
/**
|
3356
|
+
* Compare InteractionBox object equality.
|
3357
|
+
*
|
3358
|
+
* \include InteractionBox_operator_equals.txt
|
3359
|
+
*
|
3360
|
+
* Two InteractionBox objects are equal if and only if both InteractionBox objects represent the
|
3361
|
+
* exact same InteractionBox and both InteractionBoxes are valid.
|
3362
|
+
* @since 1.0
|
3363
|
+
*/
|
3364
|
+
LEAP_EXPORT bool operator==(const InteractionBox&) const;
|
3365
|
+
|
3366
|
+
/**
|
3367
|
+
* Compare InteractionBox object inequality.
|
3368
|
+
*
|
3369
|
+
* \include InteractionBox_operator_not_equals.txt
|
3370
|
+
*
|
3371
|
+
* Two InteractionBox objects are equal if and only if both InteractionBox objects represent the
|
3372
|
+
* exact same InteractionBox and both InteractionBoxes are valid.
|
3373
|
+
* @since 1.0
|
3374
|
+
*/
|
3375
|
+
LEAP_EXPORT bool operator!=(const InteractionBox&) const;
|
3376
|
+
|
3377
|
+
/**
|
3378
|
+
* Writes a brief, human readable description of the InteractionBox object.
|
3379
|
+
*
|
3380
|
+
* \include InteractionBox_operator_stream.txt
|
3381
|
+
*
|
3382
|
+
* @since 1.0
|
3383
|
+
*/
|
3384
|
+
LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const InteractionBox&);
|
3385
|
+
|
3386
|
+
/**
|
3387
|
+
* A string containing a brief, human readable description of the InteractionBox object.
|
3388
|
+
*
|
3389
|
+
* @returns A description of the InteractionBox as a string.
|
3390
|
+
* @since 1.0
|
3391
|
+
*/
|
3392
|
+
LEAP_EXPORT std::string toString() const;
|
3393
|
+
};
|
3394
|
+
|
3395
|
+
/**
|
3396
|
+
* The Frame class represents a set of hand and finger tracking data detected
|
3397
|
+
* in a single frame.
|
3398
|
+
*
|
3399
|
+
* The Leap Motion software detects hands, fingers and tools within the tracking area, reporting
|
3400
|
+
* their positions, orientations, gestures, and motions in frames at the Leap Motion frame rate.
|
3401
|
+
*
|
3402
|
+
* Access Frame objects through an instance of the Controller class:
|
3403
|
+
*
|
3404
|
+
* \include Controller_Frame_1.txt
|
3405
|
+
*
|
3406
|
+
* Implement a Listener subclass to receive a callback event when a new Frame is available.
|
3407
|
+
* @since 1.0
|
3408
|
+
*/
|
3409
|
+
class Frame : public Interface {
|
3410
|
+
public:
|
3411
|
+
// For internal use only.
|
3412
|
+
Frame(FrameImplementation*);
|
3413
|
+
|
3414
|
+
/**
|
3415
|
+
* Constructs a Frame object.
|
3416
|
+
*
|
3417
|
+
* Frame instances created with this constructor are invalid.
|
3418
|
+
* Get valid Frame objects by calling the Controller::frame() function.
|
3419
|
+
*
|
3420
|
+
* \include Frame_Frame.txt
|
3421
|
+
*
|
3422
|
+
* @since 1.0
|
3423
|
+
*/
|
3424
|
+
LEAP_EXPORT Frame();
|
3425
|
+
|
3426
|
+
/**
|
3427
|
+
* A unique ID for this Frame.
|
3428
|
+
*
|
3429
|
+
* Consecutive frames processed by the Leap Motion software have consecutive
|
3430
|
+
* increasing values. You can use the frame ID to avoid processing the same
|
3431
|
+
* Frame object twice:
|
3432
|
+
*
|
3433
|
+
* \include Frame_Duplicate.txt
|
3434
|
+
*
|
3435
|
+
* As well as to make sure that your application processes every frame:
|
3436
|
+
*
|
3437
|
+
* \include Frame_Skipped.txt
|
3438
|
+
*
|
3439
|
+
* @returns The frame ID.
|
3440
|
+
* @since 1.0
|
3441
|
+
*/
|
3442
|
+
LEAP_EXPORT int64_t id() const;
|
3443
|
+
|
3444
|
+
/**
|
3445
|
+
* The frame capture time in microseconds elapsed since the Leap started.
|
3446
|
+
*
|
3447
|
+
* \include Frame_timestamp.txt
|
3448
|
+
*
|
3449
|
+
* @returns The timestamp in microseconds.
|
3450
|
+
* @since 1.0
|
3451
|
+
*/
|
3452
|
+
LEAP_EXPORT int64_t timestamp() const;
|
3453
|
+
|
3454
|
+
/**
|
3455
|
+
* The list of Hand objects detected in this frame, given in arbitrary order.
|
3456
|
+
* The list can be empty if no hands are detected.
|
3457
|
+
*
|
3458
|
+
* \include Frame_hands.txt
|
3459
|
+
*
|
3460
|
+
* @returns The HandList containing all Hand objects detected in this frame.
|
3461
|
+
* @since 1.0
|
3462
|
+
*/
|
3463
|
+
LEAP_EXPORT HandList hands() const;
|
3464
|
+
|
3465
|
+
/**
|
3466
|
+
* The Hand object with the specified ID in this frame.
|
3467
|
+
*
|
3468
|
+
* Use the Frame::hand() function to retrieve the Hand object from
|
3469
|
+
* this frame using an ID value obtained from a previous frame.
|
3470
|
+
* This function always returns a Hand object, but if no hand
|
3471
|
+
* with the specified ID is present, an invalid Hand object is returned.
|
3472
|
+
*
|
3473
|
+
* \include Frame_hand.txt
|
3474
|
+
*
|
3475
|
+
* Note that ID values persist across frames, but only until tracking of a
|
3476
|
+
* particular object is lost. If tracking of a hand is lost and subsequently
|
3477
|
+
* regained, the new Hand object representing that physical hand may have
|
3478
|
+
* a different ID than that representing the physical hand in an earlier frame.
|
3479
|
+
*
|
3480
|
+
* @param id The ID value of a Hand object from a previous frame.
|
3481
|
+
* @returns The Hand object with the matching ID if one exists in this frame;
|
3482
|
+
* otherwise, an invalid Hand object is returned.
|
3483
|
+
* @since 1.0
|
3484
|
+
*/
|
3485
|
+
LEAP_EXPORT Hand hand(int32_t id) const;
|
3486
|
+
|
3487
|
+
/**
|
3488
|
+
* The list of Pointable objects (fingers and tools) detected in this frame,
|
3489
|
+
* given in arbitrary order. The list can be empty if no fingers or tools are detected.
|
3490
|
+
*
|
3491
|
+
* \include Frame_pointables.txt
|
3492
|
+
*
|
3493
|
+
* @returns The PointableList containing all Pointable objects detected in this frame.
|
3494
|
+
* @since 1.0
|
3495
|
+
*/
|
3496
|
+
LEAP_EXPORT PointableList pointables() const;
|
3497
|
+
|
3498
|
+
/**
|
3499
|
+
* The Pointable object with the specified ID in this frame.
|
3500
|
+
*
|
3501
|
+
* Use the Frame::pointable() function to retrieve the Pointable object from
|
3502
|
+
* this frame using an ID value obtained from a previous frame.
|
3503
|
+
* This function always returns a Pointable object, but if no finger or tool
|
3504
|
+
* with the specified ID is present, an invalid Pointable object is returned.
|
3505
|
+
*
|
3506
|
+
* \include Frame_pointable.txt
|
3507
|
+
*
|
3508
|
+
* Note that ID values persist across frames, but only until tracking of a
|
3509
|
+
* particular object is lost. If tracking of a finger or tool is lost and subsequently
|
3510
|
+
* regained, the new Pointable object representing that finger or tool may have
|
3511
|
+
* a different ID than that representing the finger or tool in an earlier frame.
|
3512
|
+
*
|
3513
|
+
* @param id The ID value of a Pointable object from a previous frame.
|
3514
|
+
* @returns The Pointable object with the matching ID if one exists in this frame;
|
3515
|
+
* otherwise, an invalid Pointable object is returned.
|
3516
|
+
* @since 1.0
|
3517
|
+
*/
|
3518
|
+
LEAP_EXPORT Pointable pointable(int32_t id) const;
|
3519
|
+
|
3520
|
+
/**
|
3521
|
+
* The list of Finger objects detected in this frame, given in arbitrary order.
|
3522
|
+
* The list can be empty if no fingers are detected.
|
3523
|
+
*
|
3524
|
+
* \include Frame_fingers.txt
|
3525
|
+
*
|
3526
|
+
* @returns The FingerList containing all Finger objects detected in this frame.
|
3527
|
+
* @since 1.0
|
3528
|
+
*/
|
3529
|
+
LEAP_EXPORT FingerList fingers() const;
|
3530
|
+
|
3531
|
+
/**
|
3532
|
+
* The Finger object with the specified ID in this frame.
|
3533
|
+
*
|
3534
|
+
* Use the Frame::finger() function to retrieve the Finger object from
|
3535
|
+
* this frame using an ID value obtained from a previous frame.
|
3536
|
+
* This function always returns a Finger object, but if no finger
|
3537
|
+
* with the specified ID is present, an invalid Finger object is returned.
|
3538
|
+
*
|
3539
|
+
* \include Frame_finger.txt
|
3540
|
+
*
|
3541
|
+
* Note that ID values persist across frames, but only until tracking of a
|
3542
|
+
* particular object is lost. If tracking of a finger is lost and subsequently
|
3543
|
+
* regained, the new Finger object representing that physical finger may have
|
3544
|
+
* a different ID than that representing the finger in an earlier frame.
|
3545
|
+
*
|
3546
|
+
* @param id The ID value of a Finger object from a previous frame.
|
3547
|
+
* @returns The Finger object with the matching ID if one exists in this frame;
|
3548
|
+
* otherwise, an invalid Finger object is returned.
|
3549
|
+
* @since 1.0
|
3550
|
+
*/
|
3551
|
+
LEAP_EXPORT Finger finger(int32_t id) const;
|
3552
|
+
|
3553
|
+
/**
|
3554
|
+
* The list of Tool objects detected in this frame, given in arbitrary order.
|
3555
|
+
* The list can be empty if no tools are detected.
|
3556
|
+
*
|
3557
|
+
* \include Frame_tools.txt
|
3558
|
+
*
|
3559
|
+
* @returns The ToolList containing all Tool objects detected in this frame.
|
3560
|
+
* @since 1.0
|
3561
|
+
*/
|
3562
|
+
LEAP_EXPORT ToolList tools() const;
|
3563
|
+
|
3564
|
+
/**
|
3565
|
+
* The Tool object with the specified ID in this frame.
|
3566
|
+
*
|
3567
|
+
* Use the Frame::tool() function to retrieve the Tool object from
|
3568
|
+
* this frame using an ID value obtained from a previous frame.
|
3569
|
+
* This function always returns a Tool object, but if no tool
|
3570
|
+
* with the specified ID is present, an invalid Tool object is returned.
|
3571
|
+
*
|
3572
|
+
* \include Frame_tool.txt
|
3573
|
+
*
|
3574
|
+
* Note that ID values persist across frames, but only until tracking of a
|
3575
|
+
* particular object is lost. If tracking of a tool is lost and subsequently
|
3576
|
+
* regained, the new Tool object representing that tool may have a
|
3577
|
+
* different ID than that representing the tool in an earlier frame.
|
3578
|
+
*
|
3579
|
+
* @param id The ID value of a Tool object from a previous frame.
|
3580
|
+
* @returns The Tool object with the matching ID if one exists in this frame;
|
3581
|
+
* otherwise, an invalid Tool object is returned.
|
3582
|
+
* @since 1.0
|
3583
|
+
*/
|
3584
|
+
LEAP_EXPORT Tool tool(int32_t id) const;
|
3585
|
+
|
3586
|
+
/**
|
3587
|
+
* The Gesture object with the specified ID in this frame.
|
3588
|
+
*
|
3589
|
+
* Use the Frame::gesture() function to return a Gesture object in this
|
3590
|
+
* frame using an ID obtained in an earlier frame. The function always
|
3591
|
+
* returns a Gesture object, but if there was no update for the gesture in
|
3592
|
+
* this frame, then an invalid Gesture object is returned.
|
3593
|
+
*
|
3594
|
+
* \include Frame_gesture.txt
|
3595
|
+
*
|
3596
|
+
* All Gesture objects representing the same recognized movement share the
|
3597
|
+
* same ID.
|
3598
|
+
* @param id The ID of an Gesture object from a previous frame.
|
3599
|
+
* @returns The Gesture object in the frame with the specified ID if one
|
3600
|
+
* exists; Otherwise, an Invalid Gesture object.
|
3601
|
+
* @since 1.0
|
3602
|
+
*/
|
3603
|
+
LEAP_EXPORT Gesture gesture(int32_t id) const;
|
3604
|
+
|
3605
|
+
/**
|
3606
|
+
* The gestures recognized or continuing in this frame.
|
3607
|
+
*
|
3608
|
+
* \include Frame_gestures_now.txt
|
3609
|
+
*
|
3610
|
+
* Circle and swipe gestures are updated every frame. Tap gestures
|
3611
|
+
* only appear in the list for a single frame.
|
3612
|
+
*
|
3613
|
+
* @return GestureList the list of gestures.
|
3614
|
+
* @since 1.0
|
3615
|
+
*/
|
3616
|
+
LEAP_EXPORT GestureList gestures() const;
|
3617
|
+
|
3618
|
+
/**
|
3619
|
+
* Returns a GestureList containing all gestures that have occured since
|
3620
|
+
* the specified frame.
|
3621
|
+
*
|
3622
|
+
* \include Frame_gestures_since.txt
|
3623
|
+
*
|
3624
|
+
* @param sinceFrame An earlier Frame object. The starting frame must
|
3625
|
+
* still be in the frame history cache, which has a default length of
|
3626
|
+
* 60 frames.
|
3627
|
+
* @return GestureList The list of the Gesture objects that have occured
|
3628
|
+
* since the specified frame.
|
3629
|
+
* @since 1.0
|
3630
|
+
*/
|
3631
|
+
LEAP_EXPORT GestureList gestures(const Frame& sinceFrame) const;
|
3632
|
+
|
3633
|
+
/**
|
3634
|
+
* The change of position derived from the overall linear motion between
|
3635
|
+
* the current frame and the specified frame.
|
3636
|
+
*
|
3637
|
+
* The returned translation vector provides the magnitude and direction of
|
3638
|
+
* the movement in millimeters.
|
3639
|
+
*
|
3640
|
+
* \include Frame_translation.txt
|
3641
|
+
*
|
3642
|
+
* The Leap Motion software derives frame translation from the linear motion of
|
3643
|
+
* all objects detected in the field of view.
|
3644
|
+
*
|
3645
|
+
* If either this frame or sinceFrame is an invalid Frame object, then this
|
3646
|
+
* method returns a zero vector.
|
3647
|
+
*
|
3648
|
+
* @param sinceFrame The starting frame for computing the relative translation.
|
3649
|
+
* @returns A Vector representing the heuristically determined change in
|
3650
|
+
* position of all objects between the current frame and that specified
|
3651
|
+
* in the sinceFrame parameter.
|
3652
|
+
* @since 1.0
|
3653
|
+
*/
|
3654
|
+
LEAP_EXPORT Vector translation(const Frame& sinceFrame) const;
|
3655
|
+
|
3656
|
+
/**
|
3657
|
+
* The estimated probability that the overall motion between the current
|
3658
|
+
* frame and the specified frame is intended to be a translating motion.
|
3659
|
+
*
|
3660
|
+
* \include Frame_translationProbability.txt
|
3661
|
+
*
|
3662
|
+
* If either this frame or sinceFrame is an invalid Frame object, then this
|
3663
|
+
* method returns zero.
|
3664
|
+
*
|
3665
|
+
* @param sinceFrame The starting frame for computing the translation.
|
3666
|
+
* @returns A value between 0 and 1 representing the estimated probability
|
3667
|
+
* that the overall motion between the current frame and the specified frame
|
3668
|
+
* is intended to be a translating motion.
|
3669
|
+
* @since 1.0
|
3670
|
+
*/
|
3671
|
+
LEAP_EXPORT float translationProbability(const Frame& sinceFrame) const;
|
3672
|
+
|
3673
|
+
/**
|
3674
|
+
* The axis of rotation derived from the overall rotational motion between
|
3675
|
+
* the current frame and the specified frame.
|
3676
|
+
*
|
3677
|
+
* The returned direction vector is normalized.
|
3678
|
+
*
|
3679
|
+
* \include Frame_rotationAxis.txt
|
3680
|
+
*
|
3681
|
+
* The Leap Motion software derives frame rotation from the relative change in position and
|
3682
|
+
* orientation of all objects detected in the field of view.
|
3683
|
+
*
|
3684
|
+
* If either this frame or sinceFrame is an invalid Frame object, or if no
|
3685
|
+
* rotation is detected between the two frames, a zero vector is returned.
|
3686
|
+
*
|
3687
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
3688
|
+
* @returns A normalized direction Vector representing the axis of the
|
3689
|
+
* heuristically determined rotational change between the current frame
|
3690
|
+
* and that specified in the sinceFrame parameter.
|
3691
|
+
* @since 1.0
|
3692
|
+
*/
|
3693
|
+
LEAP_EXPORT Vector rotationAxis(const Frame& sinceFrame) const;
|
3694
|
+
|
3695
|
+
/**
|
3696
|
+
* The angle of rotation around the rotation axis derived from the overall
|
3697
|
+
* rotational motion between the current frame and the specified frame.
|
3698
|
+
*
|
3699
|
+
* The returned angle is expressed in radians measured clockwise around the
|
3700
|
+
* rotation axis (using the right-hand rule) between the start and end frames.
|
3701
|
+
* The value is always between 0 and pi radians (0 and 180 degrees).
|
3702
|
+
*
|
3703
|
+
* \include Frame_rotationAngle.txt
|
3704
|
+
*
|
3705
|
+
* The Leap Motion software derives frame rotation from the relative change in position and
|
3706
|
+
* orientation of all objects detected in the field of view.
|
3707
|
+
*
|
3708
|
+
* If either this frame or sinceFrame is an invalid Frame object, then the
|
3709
|
+
* angle of rotation is zero.
|
3710
|
+
*
|
3711
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
3712
|
+
* @returns A positive value containing the heuristically determined
|
3713
|
+
* rotational change between the current frame and that specified in the
|
3714
|
+
* sinceFrame parameter.
|
3715
|
+
* @since 1.0
|
3716
|
+
*/
|
3717
|
+
LEAP_EXPORT float rotationAngle(const Frame& sinceFrame) const;
|
3718
|
+
|
3719
|
+
/**
|
3720
|
+
* The angle of rotation around the specified axis derived from the overall
|
3721
|
+
* rotational motion between the current frame and the specified frame.
|
3722
|
+
*
|
3723
|
+
* The returned angle is expressed in radians measured clockwise around the
|
3724
|
+
* rotation axis (using the right-hand rule) between the start and end frames.
|
3725
|
+
* The value is always between -pi and pi radians (-180 and 180 degrees).
|
3726
|
+
*
|
3727
|
+
* \include Frame_rotationAngle_axis.txt
|
3728
|
+
*
|
3729
|
+
* The Leap Motion software derives frame rotation from the relative change in position and
|
3730
|
+
* orientation of all objects detected in the field of view.
|
3731
|
+
*
|
3732
|
+
* If either this frame or sinceFrame is an invalid Frame object, then the
|
3733
|
+
* angle of rotation is zero.
|
3734
|
+
*
|
3735
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
3736
|
+
* @param axis The axis to measure rotation around.
|
3737
|
+
* @returns A value containing the heuristically determined rotational
|
3738
|
+
* change between the current frame and that specified in the sinceFrame
|
3739
|
+
* parameter around the given axis.
|
3740
|
+
* @since 1.0
|
3741
|
+
*/
|
3742
|
+
LEAP_EXPORT float rotationAngle(const Frame& sinceFrame, const Vector& axis) const;
|
3743
|
+
|
3744
|
+
/**
|
3745
|
+
* The transform matrix expressing the rotation derived from the overall
|
3746
|
+
* rotational motion between the current frame and the specified frame.
|
3747
|
+
*
|
3748
|
+
* \include Frame_rotationMatrix.txt
|
3749
|
+
*
|
3750
|
+
* The Leap Motion software derives frame rotation from the relative change in position and
|
3751
|
+
* orientation of all objects detected in the field of view.
|
3752
|
+
*
|
3753
|
+
* If either this frame or sinceFrame is an invalid Frame object, then this
|
3754
|
+
* method returns an identity matrix.
|
3755
|
+
*
|
3756
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
3757
|
+
* @returns A transformation Matrix containing the heuristically determined
|
3758
|
+
* rotational change between the current frame and that specified in the
|
3759
|
+
* sinceFrame parameter.
|
3760
|
+
* @since 1.0
|
3761
|
+
*/
|
3762
|
+
LEAP_EXPORT Matrix rotationMatrix(const Frame& sinceFrame) const;
|
3763
|
+
|
3764
|
+
/**
|
3765
|
+
* The estimated probability that the overall motion between the current
|
3766
|
+
* frame and the specified frame is intended to be a rotating motion.
|
3767
|
+
*
|
3768
|
+
* \include Frame_rotationProbability.txt
|
3769
|
+
*
|
3770
|
+
* If either this frame or sinceFrame is an invalid Frame object, then this
|
3771
|
+
* method returns zero.
|
3772
|
+
*
|
3773
|
+
* @param sinceFrame The starting frame for computing the relative rotation.
|
3774
|
+
* @returns A value between 0 and 1 representing the estimated probability
|
3775
|
+
* that the overall motion between the current frame and the specified frame
|
3776
|
+
* is intended to be a rotating motion.
|
3777
|
+
* @since 1.0
|
3778
|
+
*/
|
3779
|
+
LEAP_EXPORT float rotationProbability(const Frame& sinceFrame) const;
|
3780
|
+
|
3781
|
+
/**
|
3782
|
+
* The scale factor derived from the overall motion between the current frame
|
3783
|
+
* and the specified frame.
|
3784
|
+
*
|
3785
|
+
* The scale factor is always positive. A value of 1.0 indicates no
|
3786
|
+
* scaling took place. Values between 0.0 and 1.0 indicate contraction
|
3787
|
+
* and values greater than 1.0 indicate expansion.
|
3788
|
+
*
|
3789
|
+
* \include Frame_scaleFactor.txt
|
3790
|
+
*
|
3791
|
+
* The Leap Motion software derives scaling from the relative inward or outward motion of
|
3792
|
+
* all objects detected in the field of view (independent of translation
|
3793
|
+
* and rotation).
|
3794
|
+
*
|
3795
|
+
* If either this frame or sinceFrame is an invalid Frame object, then this
|
3796
|
+
* method returns 1.0.
|
3797
|
+
*
|
3798
|
+
* @param sinceFrame The starting frame for computing the relative scaling.
|
3799
|
+
* @returns A positive value representing the heuristically determined
|
3800
|
+
* scaling change ratio between the current frame and that specified in the
|
3801
|
+
* sinceFrame parameter.
|
3802
|
+
* @since 1.0
|
3803
|
+
*/
|
3804
|
+
LEAP_EXPORT float scaleFactor(const Frame& sinceFrame) const;
|
3805
|
+
|
3806
|
+
/**
|
3807
|
+
* The estimated probability that the overall motion between the current
|
3808
|
+
* frame and the specified frame is intended to be a scaling motion.
|
3809
|
+
*
|
3810
|
+
* \include Frame_scaleProbability.txt
|
3811
|
+
*
|
3812
|
+
* If either this frame or sinceFrame is an invalid Frame object, then this
|
3813
|
+
* method returns zero.
|
3814
|
+
*
|
3815
|
+
* @param sinceFrame The starting frame for computing the relative scaling.
|
3816
|
+
* @returns A value between 0 and 1 representing the estimated probability
|
3817
|
+
* that the overall motion between the current frame and the specified frame
|
3818
|
+
* is intended to be a scaling motion.
|
3819
|
+
* @since 1.0
|
3820
|
+
*/
|
3821
|
+
LEAP_EXPORT float scaleProbability(const Frame& sinceFrame) const;
|
3822
|
+
|
3823
|
+
/**
|
3824
|
+
* The current InteractionBox for the frame. See the InteractionBox class
|
3825
|
+
* documentation for more details on how this class should be used.
|
3826
|
+
*
|
3827
|
+
* \include Frame_interactionBox.txt
|
3828
|
+
*
|
3829
|
+
* @returns The current InteractionBox object.
|
3830
|
+
* @since 1.0
|
3831
|
+
*/
|
3832
|
+
LEAP_EXPORT InteractionBox interactionBox() const;
|
3833
|
+
|
3834
|
+
/**
|
3835
|
+
* The instantaneous framerate.
|
3836
|
+
*
|
3837
|
+
* The rate at which the Leap Motion software is providing frames of data
|
3838
|
+
* (in frames per second). The framerate can fluctuate depending on available computing
|
3839
|
+
* resources, activity within the device field of view, software tracking settings,
|
3840
|
+
* and other factors.
|
3841
|
+
*
|
3842
|
+
* \include Frame_currentFramesPerSecond.txt
|
3843
|
+
*
|
3844
|
+
* @returns An estimate of frames per second of the Leap Motion Controller.
|
3845
|
+
* @since 1.0
|
3846
|
+
*/
|
3847
|
+
LEAP_EXPORT float currentFramesPerSecond() const;
|
3848
|
+
|
3849
|
+
/**
|
3850
|
+
* Reports whether this Frame instance is valid.
|
3851
|
+
*
|
3852
|
+
* A valid Frame is one generated by the Leap::Controller object that contains
|
3853
|
+
* tracking data for all detected entities. An invalid Frame contains no
|
3854
|
+
* actual tracking data, but you can call its functions without risk of a
|
3855
|
+
* null pointer exception. The invalid Frame mechanism makes it more
|
3856
|
+
* convenient to track individual data across the frame history. For example,
|
3857
|
+
* you can invoke:
|
3858
|
+
*
|
3859
|
+
* \include Frame_Valid_Chain.txt
|
3860
|
+
*
|
3861
|
+
* for an arbitrary Frame history value, "n", without first checking whether
|
3862
|
+
* frame(n) returned a null object. (You should still check that the
|
3863
|
+
* returned Finger instance is valid.)
|
3864
|
+
*
|
3865
|
+
* @returns True, if this is a valid Frame object; false otherwise.
|
3866
|
+
* @since 1.0
|
3867
|
+
*/
|
3868
|
+
LEAP_EXPORT bool isValid() const;
|
3869
|
+
|
3870
|
+
/**
|
3871
|
+
* Returns an invalid Frame object.
|
3872
|
+
*
|
3873
|
+
* You can use the instance returned by this function in comparisons testing
|
3874
|
+
* whether a given Frame instance is valid or invalid. (You can also use the
|
3875
|
+
* Frame::isValid() function.)
|
3876
|
+
*
|
3877
|
+
* \include Frame_Invalid_Demo.txt
|
3878
|
+
*
|
3879
|
+
* @returns The invalid Frame instance.
|
3880
|
+
* @since 1.0
|
3881
|
+
*/
|
3882
|
+
LEAP_EXPORT static const Frame& invalid();
|
3883
|
+
|
3884
|
+
/**
|
3885
|
+
* Compare Frame object equality.
|
3886
|
+
*
|
3887
|
+
* \include Frame_operator_equals.txt
|
3888
|
+
*
|
3889
|
+
* Two Frame objects are equal if and only if both Frame objects represent
|
3890
|
+
* the exact same frame of tracking data and both Frame objects are valid.
|
3891
|
+
* @since 1.0
|
3892
|
+
*/
|
3893
|
+
LEAP_EXPORT bool operator==(const Frame&) const;
|
3894
|
+
|
3895
|
+
/**
|
3896
|
+
* Compare Frame object inequality.
|
3897
|
+
*
|
3898
|
+
* \include Frame_operator_not_equals.txt
|
3899
|
+
*
|
3900
|
+
* Two Frame objects are equal if and only if both Frame objects represent
|
3901
|
+
* the exact same frame of tracking data and both Frame objects are valid.
|
3902
|
+
* @since 1.0
|
3903
|
+
*/
|
3904
|
+
LEAP_EXPORT bool operator!=(const Frame&) const;
|
3905
|
+
|
3906
|
+
/**
|
3907
|
+
* Writes a brief, human readable description of the Frame object to an output stream.
|
3908
|
+
*
|
3909
|
+
* \include Frame_operator_stream.txt
|
3910
|
+
*
|
3911
|
+
* @since 1.0
|
3912
|
+
*/
|
3913
|
+
LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Frame&);
|
3914
|
+
|
3915
|
+
/**
|
3916
|
+
* A string containing a brief, human readable description of the Frame object.
|
3917
|
+
*
|
3918
|
+
* @returns A description of the Frame as a string.
|
3919
|
+
* @since 1.0
|
3920
|
+
*/
|
3921
|
+
LEAP_EXPORT std::string toString() const;
|
3922
|
+
};
|
3923
|
+
|
3924
|
+
/**
|
3925
|
+
* The Config class provides access to Leap Motion system configuration information.
|
3926
|
+
*
|
3927
|
+
* You can get and set gesture configuration parameters using the Config object
|
3928
|
+
* obtained from a connected Controller object. The key strings required to
|
3929
|
+
* identify a configuration parameter include:
|
3930
|
+
*
|
3931
|
+
* Key string | Value type | Default value | Units
|
3932
|
+
* -----------|------------|---------------|------
|
3933
|
+
* Gesture.Circle.MinRadius | float | 5.0 | mm
|
3934
|
+
* Gesture.Circle.MinArc | float | 1.5*pi | radians
|
3935
|
+
* Gesture.Swipe.MinLength | float | 150 | mm
|
3936
|
+
* Gesture.Swipe.MinVelocity | float | 1000 | mm/s
|
3937
|
+
* Gesture.KeyTap.MinDownVelocity | float | 50 | mm/s
|
3938
|
+
* Gesture.KeyTap.HistorySeconds | float | 0.1 | s
|
3939
|
+
* Gesture.KeyTap.MinDistance | float | 3.0 | mm
|
3940
|
+
* Gesture.ScreenTap.MinForwardVelocity | float | 50 | mm/s
|
3941
|
+
* Gesture.ScreenTap.HistorySeconds | float | 0.1 | s
|
3942
|
+
* Gesture.ScreenTap.MinDistance | float | 5.0 | mm
|
3943
|
+
*
|
3944
|
+
* After setting a configuration value, you must call the Config::save method
|
3945
|
+
* to commit the changes. The configuration value changes are not persistent;
|
3946
|
+
* your application needs to set the values everytime it runs.
|
3947
|
+
*
|
3948
|
+
* @see CircleGesture
|
3949
|
+
* @see KeyTapGesture
|
3950
|
+
* @see ScreenTapGesture
|
3951
|
+
* @see SwipeGesture
|
3952
|
+
* @since 1.0
|
3953
|
+
*/
|
3954
|
+
class Config : public Interface {
|
3955
|
+
public:
|
3956
|
+
/**
|
3957
|
+
* Constructs a Config object.
|
3958
|
+
* Do not create your own Config objects. Get a Config object using
|
3959
|
+
* the Controller::config() function.
|
3960
|
+
*
|
3961
|
+
* \include Config_Constructor.txt
|
3962
|
+
*
|
3963
|
+
* @since 1.0
|
3964
|
+
*/
|
3965
|
+
LEAP_EXPORT Config();
|
3966
|
+
|
3967
|
+
/**
|
3968
|
+
* Enumerates the possible data types for configuration values.
|
3969
|
+
*
|
3970
|
+
* The Config::type() function returns an item from the ValueType enumeration.
|
3971
|
+
* @since 1.0
|
3972
|
+
*/
|
3973
|
+
enum ValueType {
|
3974
|
+
/**
|
3975
|
+
* The data type is unknown.
|
3976
|
+
* @since 1.0
|
3977
|
+
*/
|
3978
|
+
TYPE_UNKNOWN = 0,
|
3979
|
+
/**
|
3980
|
+
* A boolean value.
|
3981
|
+
* @since 1.0
|
3982
|
+
*/
|
3983
|
+
TYPE_BOOLEAN = 1,
|
3984
|
+
/**
|
3985
|
+
* A 32-bit integer.
|
3986
|
+
* @since 1.0
|
3987
|
+
*/
|
3988
|
+
TYPE_INT32 = 2,
|
3989
|
+
/**
|
3990
|
+
* A floating-point number.
|
3991
|
+
* @since 1.0
|
3992
|
+
*/
|
3993
|
+
TYPE_FLOAT = 6,
|
3994
|
+
/**
|
3995
|
+
* A string of characters.
|
3996
|
+
* @since 1.0
|
3997
|
+
*/
|
3998
|
+
TYPE_STRING = 8
|
3999
|
+
};
|
4000
|
+
|
4001
|
+
/**
|
4002
|
+
* Reports the natural data type for the value related to the specified key.
|
4003
|
+
*
|
4004
|
+
* \include Config_type.txt
|
4005
|
+
*
|
4006
|
+
* @param key The key for the looking up the value in the configuration dictionary.
|
4007
|
+
* @returns The native data type of the value, that is, the type that does not
|
4008
|
+
* require a data conversion.
|
4009
|
+
* @since 1.0
|
4010
|
+
*/
|
4011
|
+
LEAP_EXPORT ValueType type(const std::string& key) const;
|
4012
|
+
|
4013
|
+
/**
|
4014
|
+
* Gets the boolean representation for the specified key.
|
4015
|
+
*
|
4016
|
+
* \include Config_getBool.txt
|
4017
|
+
*
|
4018
|
+
* @since 1.0
|
4019
|
+
*/
|
4020
|
+
LEAP_EXPORT bool getBool(const std::string& key) const;
|
4021
|
+
|
4022
|
+
/** Sets the boolean representation for the specified key.
|
4023
|
+
*
|
4024
|
+
* \include Config_setBool.txt
|
4025
|
+
*
|
4026
|
+
* @returns true on success, false on failure.
|
4027
|
+
* @since 1.0
|
4028
|
+
*/
|
4029
|
+
LEAP_EXPORT bool setBool(const std::string& key, bool value);
|
4030
|
+
|
4031
|
+
/**
|
4032
|
+
* Gets the 32-bit integer representation for the specified key.
|
4033
|
+
*
|
4034
|
+
* \include Config_getInt32.txt
|
4035
|
+
*
|
4036
|
+
* @since 1.0
|
4037
|
+
*/
|
4038
|
+
LEAP_EXPORT int32_t getInt32(const std::string& key) const;
|
4039
|
+
|
4040
|
+
/** Sets the 32-bit integer representation for the specified key.
|
4041
|
+
*
|
4042
|
+
* \include Config_setInt32.txt
|
4043
|
+
*
|
4044
|
+
* @returns true on success, false on failure.
|
4045
|
+
* @since 1.0
|
4046
|
+
*/
|
4047
|
+
LEAP_EXPORT bool setInt32(const std::string& key, int32_t value);
|
4048
|
+
|
4049
|
+
/**
|
4050
|
+
* Gets the floating point representation for the specified key.
|
4051
|
+
*
|
4052
|
+
* \include Config_getFloat.txt
|
4053
|
+
*
|
4054
|
+
* @since 1.0
|
4055
|
+
*/
|
4056
|
+
LEAP_EXPORT float getFloat(const std::string& key) const;
|
4057
|
+
|
4058
|
+
/** Sets the floating point representation for the specified key.
|
4059
|
+
*
|
4060
|
+
* \include Config_setFloat.txt
|
4061
|
+
*
|
4062
|
+
* @returns true on success, false on failure.
|
4063
|
+
* @since 1.0
|
4064
|
+
*/
|
4065
|
+
LEAP_EXPORT bool setFloat(const std::string& key, float value);
|
4066
|
+
|
4067
|
+
/**
|
4068
|
+
* Gets the string representation for the specified key.
|
4069
|
+
*
|
4070
|
+
* \include Config_getString.txt
|
4071
|
+
*
|
4072
|
+
* @since 1.0
|
4073
|
+
*/
|
4074
|
+
LEAP_EXPORT std::string getString(const std::string& key) const;
|
4075
|
+
|
4076
|
+
/** Sets the string representation for the specified key.
|
4077
|
+
*
|
4078
|
+
* \include Config_setString.txt
|
4079
|
+
*
|
4080
|
+
* @returns true on success, false on failure.
|
4081
|
+
* @since 1.0
|
4082
|
+
*/
|
4083
|
+
LEAP_EXPORT bool setString(const std::string& key, const std::string& value);
|
4084
|
+
|
4085
|
+
/**
|
4086
|
+
* Saves the current state of the config.
|
4087
|
+
*
|
4088
|
+
* Call ``save()`` after making a set of configuration changes. The
|
4089
|
+
* ``save()`` function transfers the configuration changes to the Leap Motion
|
4090
|
+
* service. The configuration value changes are not persistent; your
|
4091
|
+
* application must set the values everytime it runs.
|
4092
|
+
*
|
4093
|
+
* \include Config_save.txt
|
4094
|
+
*
|
4095
|
+
* @returns true on success, false on failure.
|
4096
|
+
* @since 1.0
|
4097
|
+
*/
|
4098
|
+
LEAP_EXPORT bool save();
|
4099
|
+
};
|
4100
|
+
|
4101
|
+
/**
|
4102
|
+
* The Controller class is your main interface to the Leap Motion Controller.
|
4103
|
+
*
|
4104
|
+
* Create an instance of this Controller class to access frames of tracking
|
4105
|
+
* data and configuration information. Frame data can be polled at any time
|
4106
|
+
* using the Controller::frame() function. Call frame() or frame(0) to get the
|
4107
|
+
* most recent frame. Set the history parameter to a positive integer to access
|
4108
|
+
* previous frames. A controller stores up to 60 frames in its frame history.
|
4109
|
+
*
|
4110
|
+
* Polling is an appropriate strategy for applications which already have an
|
4111
|
+
* intrinsic update loop, such as a game. You can also add an instance of a
|
4112
|
+
* subclass of Leap::Listener to the controller to handle events as they occur.
|
4113
|
+
* The Controller dispatches events to the listener upon initialization and exiting,
|
4114
|
+
* on connection changes, when the application gains and loses the OS input focus,
|
4115
|
+
* and when a new frame of tracking data is available.
|
4116
|
+
* When these events occur, the controller object invokes the appropriate
|
4117
|
+
* callback function defined in your subclass of Listener.
|
4118
|
+
*
|
4119
|
+
* To access frames of tracking data as they become available:
|
4120
|
+
*
|
4121
|
+
* 1. Implement a subclass of the Listener class and override the
|
4122
|
+
* Listener::onFrame() function.
|
4123
|
+
* 2. In your Listener::onFrame() function, call the Controller::frame()
|
4124
|
+
* function to access the newest frame of tracking data.
|
4125
|
+
* 3. To start receiving frames, create a Controller object and add an instance
|
4126
|
+
* of the Listener subclass to the Controller::addListener() function.
|
4127
|
+
*
|
4128
|
+
* When an instance of a Listener subclass is added to a Controller object,
|
4129
|
+
* it calls the Listener::onInit() function when the listener is ready for use.
|
4130
|
+
* When a connection is established between the controller and the Leap Motion software,
|
4131
|
+
* the controller calls the Listener::onConnect() function. At this point, your
|
4132
|
+
* application will start receiving frames of data. The controller calls the
|
4133
|
+
* Listener::onFrame() function each time a new frame is available. If the
|
4134
|
+
* controller loses its connection with the Leap Motion software or device for any
|
4135
|
+
* reason, it calls the Listener::onDisconnect() function. If the listener is
|
4136
|
+
* removed from the controller or the controller is destroyed, it calls the
|
4137
|
+
* Listener::onExit() function. At that point, unless the listener is added to
|
4138
|
+
* another controller again, it will no longer receive frames of tracking data.
|
4139
|
+
*
|
4140
|
+
* The Controller object is multithreaded and calls the Listener functions on
|
4141
|
+
* its own thread, not on an application thread.
|
4142
|
+
* @since 1.0
|
4143
|
+
*/
|
4144
|
+
class Controller : public Interface {
|
4145
|
+
public:
|
4146
|
+
// For internal use only.
|
4147
|
+
Controller(ControllerImplementation*);
|
4148
|
+
|
4149
|
+
/**
|
4150
|
+
* Constructs a Controller object.
|
4151
|
+
*
|
4152
|
+
* When creating a Controller object, you may optionally pass in a
|
4153
|
+
* reference to an instance of a subclass of Leap::Listener. Alternatively,
|
4154
|
+
* you may add a listener using the Controller::addListener() function.
|
4155
|
+
*
|
4156
|
+
* @since 1.0
|
4157
|
+
*/
|
4158
|
+
LEAP_EXPORT Controller();
|
4159
|
+
LEAP_EXPORT virtual ~Controller();
|
4160
|
+
/**
|
4161
|
+
* Constructs a Controller object.
|
4162
|
+
*
|
4163
|
+
* When creating a Controller object, you may optionally pass in a
|
4164
|
+
* reference to an instance of a subclass of Leap::Listener. Alternatively,
|
4165
|
+
* you may add a listener using the Controller::addListener() function.
|
4166
|
+
*
|
4167
|
+
* \include Controller_Controller.txt
|
4168
|
+
*
|
4169
|
+
* @param listener An instance of Leap::Listener implementing the callback
|
4170
|
+
* functions for the Leap Motion events you want to handle in your application.
|
4171
|
+
* @since 1.0
|
4172
|
+
*/
|
4173
|
+
LEAP_EXPORT Controller(Listener& listener);
|
4174
|
+
|
4175
|
+
/**
|
4176
|
+
* Reports whether this Controller is connected to the Leap Motion service and
|
4177
|
+
* the Leap Motion hardware is plugged in.
|
4178
|
+
*
|
4179
|
+
* When you first create a Controller object, isConnected() returns false.
|
4180
|
+
* After the controller finishes initializing and connects to the Leap Motion
|
4181
|
+
* software and if the Leap Motion hardware is plugged in, isConnected() returns true.
|
4182
|
+
*
|
4183
|
+
* You can either handle the onConnect event using a Listener instance or
|
4184
|
+
* poll the isConnected() function if you need to wait for your
|
4185
|
+
* application to be connected to the Leap Motion software before performing some other
|
4186
|
+
* operation.
|
4187
|
+
*
|
4188
|
+
* \include Controller_isConnected.txt
|
4189
|
+
* @returns True, if connected; false otherwise.
|
4190
|
+
* @since 1.0
|
4191
|
+
*/
|
4192
|
+
LEAP_EXPORT bool isConnected() const;
|
4193
|
+
|
4194
|
+
/**
|
4195
|
+
* Reports whether this application is the focused, foreground application.
|
4196
|
+
*
|
4197
|
+
* By default, your application only receives tracking information from
|
4198
|
+
* the Leap Motion controller when it has the operating system input focus.
|
4199
|
+
* To receive tracking data when your application is in the background,
|
4200
|
+
* the background frames policy flag must be set.
|
4201
|
+
*
|
4202
|
+
* \include Controller_hasFocus.txt
|
4203
|
+
*
|
4204
|
+
* @returns True, if application has focus; false otherwise.
|
4205
|
+
*
|
4206
|
+
* @see Controller::setPolicyFlags()
|
4207
|
+
* @since 1.0
|
4208
|
+
*/
|
4209
|
+
LEAP_EXPORT bool hasFocus() const;
|
4210
|
+
|
4211
|
+
/**
|
4212
|
+
* The supported controller policies.
|
4213
|
+
*
|
4214
|
+
* Currently, the only supported policy is the background frames policy,
|
4215
|
+
* which determines whether your application receives frames of tracking
|
4216
|
+
* data when it is not the focused, foreground application.
|
4217
|
+
* @since 1.0
|
4218
|
+
*/
|
4219
|
+
enum PolicyFlag {
|
4220
|
+
/**
|
4221
|
+
* The default policy.
|
4222
|
+
* @since 1.0
|
4223
|
+
*/
|
4224
|
+
POLICY_DEFAULT = 0,
|
4225
|
+
/**
|
4226
|
+
* Receive background frames.
|
4227
|
+
* @since 1.0
|
4228
|
+
*/
|
4229
|
+
POLICY_BACKGROUND_FRAMES = (1 << 0)
|
4230
|
+
};
|
4231
|
+
|
4232
|
+
/**
|
4233
|
+
* Gets the active policy settings.
|
4234
|
+
*
|
4235
|
+
* Use this function to determine the current policy state.
|
4236
|
+
* Keep in mind that setting a policy flag is asynchronous, so changes are
|
4237
|
+
* not effective immediately after calling setPolicyFlag(). In addition, a
|
4238
|
+
* policy request can be declined by the user. You should always set the
|
4239
|
+
* policy flags required by your application at startup and check that the
|
4240
|
+
* policy change request was successful after an appropriate interval.
|
4241
|
+
*
|
4242
|
+
* If the controller object is not connected to the Leap Motion software, then the default
|
4243
|
+
* policy state is returned.
|
4244
|
+
*
|
4245
|
+
* \include Controller_policyFlags.txt
|
4246
|
+
*
|
4247
|
+
* @returns The current policy flags.
|
4248
|
+
* @since 1.0
|
4249
|
+
*/
|
4250
|
+
LEAP_EXPORT PolicyFlag policyFlags() const;
|
4251
|
+
|
4252
|
+
/**
|
4253
|
+
* Requests a change in policy.
|
4254
|
+
*
|
4255
|
+
* A request to change a policy is subject to user approval and a policy
|
4256
|
+
* can be changed by the user at any time (using the Leap Motion settings dialog).
|
4257
|
+
* The desired policy flags must be set every time an application runs.
|
4258
|
+
*
|
4259
|
+
* Policy changes are completed asynchronously and, because they are subject
|
4260
|
+
* to user approval, may not complete successfully. Call
|
4261
|
+
* Controller::policyFlags() after a suitable interval to test whether
|
4262
|
+
* the change was accepted.
|
4263
|
+
*
|
4264
|
+
* Currently, the background frames policy is the only policy supported.
|
4265
|
+
* The background frames policy determines whether an application
|
4266
|
+
* receives frames of tracking data while in the background. By
|
4267
|
+
* default, the Leap Motion software only sends tracking data to the foreground application.
|
4268
|
+
* Only applications that need this ability should request the background
|
4269
|
+
* frames policy.
|
4270
|
+
*
|
4271
|
+
* At this time, you can use the Leap Motion Settings dialog to
|
4272
|
+
* globally enable or disable the background frames policy. However,
|
4273
|
+
* each application that needs tracking data while in the background
|
4274
|
+
* must also set the policy flag using this function.
|
4275
|
+
*
|
4276
|
+
* This function can be called before the Controller object is connected,
|
4277
|
+
* but the request will be sent to the Leap Motion software after the Controller connects.
|
4278
|
+
*
|
4279
|
+
* \include Controller_setPolicyFlags.txt
|
4280
|
+
*
|
4281
|
+
* @param flags A PolicyFlag value indicating the policies to request.
|
4282
|
+
* @since 1.0
|
4283
|
+
*/
|
4284
|
+
LEAP_EXPORT void setPolicyFlags(PolicyFlag flags) const;
|
4285
|
+
|
4286
|
+
/**
|
4287
|
+
* Adds a listener to this Controller.
|
4288
|
+
*
|
4289
|
+
* The Controller dispatches Leap Motion events to each associated listener. The
|
4290
|
+
* order in which listener callback functions are invoked is arbitrary. If
|
4291
|
+
* you pass a listener to the Controller's constructor function, it is
|
4292
|
+
* automatically added to the list and can be removed with the
|
4293
|
+
* Controller::removeListener() function.
|
4294
|
+
*
|
4295
|
+
* \include Controller_addListener.txt
|
4296
|
+
*
|
4297
|
+
* @param listener A subclass of Leap::Listener implementing the callback
|
4298
|
+
* functions for the Leap Motion events you want to handle in your application.
|
4299
|
+
* @returns Whether or not the listener was successfully added to the list
|
4300
|
+
* of listeners.
|
4301
|
+
* @since 1.0
|
4302
|
+
*/
|
4303
|
+
LEAP_EXPORT bool addListener(Listener& listener);
|
4304
|
+
|
4305
|
+
/**
|
4306
|
+
* Remove a listener from the list of listeners that will receive Leap Motion
|
4307
|
+
* events. A listener must be removed if its lifetime is shorter than the
|
4308
|
+
* controller to which it is listening.
|
4309
|
+
*
|
4310
|
+
* \include Controller_removeListener.txt
|
4311
|
+
*
|
4312
|
+
* @param listener The listener to remove.
|
4313
|
+
* @returns Whether or not the listener was successfully removed from the
|
4314
|
+
* list of listeners.
|
4315
|
+
* @since 1.0
|
4316
|
+
*/
|
4317
|
+
LEAP_EXPORT bool removeListener(Listener& listener);
|
4318
|
+
|
4319
|
+
/**
|
4320
|
+
* Returns a frame of tracking data from the Leap Motion software. Use the optional
|
4321
|
+
* history parameter to specify which frame to retrieve. Call frame() or
|
4322
|
+
* frame(0) to access the most recent frame; call frame(1) to access the
|
4323
|
+
* previous frame, and so on. If you use a history value greater than the
|
4324
|
+
* number of stored frames, then the controller returns an invalid frame.
|
4325
|
+
*
|
4326
|
+
* \include Controller_Frame_1.txt
|
4327
|
+
*
|
4328
|
+
* You can call this function in your Listener implementation to get frames at the
|
4329
|
+
* Leap Motion frame rate:
|
4330
|
+
*
|
4331
|
+
* \include Controller_Listener_onFrame.txt
|
4332
|
+
|
4333
|
+
* @param history The age of the frame to return, counting backwards from
|
4334
|
+
* the most recent frame (0) into the past and up to the maximum age (59).
|
4335
|
+
* @returns The specified frame; or, if no history parameter is specified,
|
4336
|
+
* the newest frame. If a frame is not available at the specified history
|
4337
|
+
* position, an invalid Frame is returned.
|
4338
|
+
* @since 1.0
|
4339
|
+
*/
|
4340
|
+
LEAP_EXPORT Frame frame(int history = 0) const;
|
4341
|
+
|
4342
|
+
/**
|
4343
|
+
* Returns a Config object, which you can use to query the Leap Motion system for
|
4344
|
+
* configuration information.
|
4345
|
+
*
|
4346
|
+
* \include Controller_config.txt
|
4347
|
+
*
|
4348
|
+
* @since 1.0
|
4349
|
+
*/
|
4350
|
+
LEAP_EXPORT Config config() const;
|
4351
|
+
|
4352
|
+
/**
|
4353
|
+
* The list of currently attached and recognized Leap Motion controller devices.
|
4354
|
+
*
|
4355
|
+
* The Device objects in the list describe information such as the range and
|
4356
|
+
* tracking volume.
|
4357
|
+
*
|
4358
|
+
* \include Controller_devices.txt
|
4359
|
+
*
|
4360
|
+
* Currently, the Leap Motion Controller only recognizes a single device at a time.
|
4361
|
+
* @since 1.0
|
4362
|
+
*/
|
4363
|
+
LEAP_EXPORT DeviceList devices() const;
|
4364
|
+
|
4365
|
+
/*
|
4366
|
+
* The Screen and ScreenList classes are currently unsupported.
|
4367
|
+
*
|
4368
|
+
* We are re-evaluating this feature due to the cumbersome location process
|
4369
|
+
* required to use it and the amount of confusion about the feature's purpose.
|
4370
|
+
*
|
4371
|
+
* The list of screens whose positions have been identified by using the
|
4372
|
+
* Leap Motion Screen Locator.
|
4373
|
+
*
|
4374
|
+
* The list always contains at least one entry representing the default
|
4375
|
+
* screen. If the user has not registered the location of this default
|
4376
|
+
* screen, then the coordinates, directions, and other values reported by
|
4377
|
+
* the functions in its Screen object will not be accurate. Other monitor
|
4378
|
+
* screens only appear in the list if their positions have been registered
|
4379
|
+
* using the Leap Motion Screen Locator.
|
4380
|
+
*
|
4381
|
+
* A Screen object represents the position and orientation of a display
|
4382
|
+
* monitor screen within the Leap Motion coordinate system.
|
4383
|
+
* For example, if the screen location is known, you can get Leap Motion coordinates
|
4384
|
+
* for the bottom-left corner of the screen. Registering the screen
|
4385
|
+
* location also allows the Leap Motion software to calculate the point on the screen at
|
4386
|
+
* which a finger or tool is pointing.
|
4387
|
+
*
|
4388
|
+
* A user can run the Screen Locator tool from the Leap Motion
|
4389
|
+
* Settings dialog. Avoid assuming that a screen location is known or that
|
4390
|
+
* an existing position is still correct. The registered position is only
|
4391
|
+
* valid as long as the relative position of the Leap Motion Controller and the
|
4392
|
+
* monitor screen remain constant.
|
4393
|
+
*
|
4394
|
+
* \include Screen_Closest_1.txt
|
4395
|
+
*
|
4396
|
+
* @returns ScreenList A list containing the screens whose positions have
|
4397
|
+
* been registered by the user using the Screen Locator tool.
|
4398
|
+
* The list always contains at least one entry representing the default
|
4399
|
+
* monitor. If the user has not run the Screen Locator or has moved the Leap
|
4400
|
+
* Motion device or screen since running it, the Screen object for this entry
|
4401
|
+
* only contains default values.
|
4402
|
+
* @since 1.0
|
4403
|
+
*/
|
4404
|
+
LEAP_EXPORT ScreenList locatedScreens() const;
|
4405
|
+
|
4406
|
+
/**
|
4407
|
+
* Enables or disables reporting of a specified gesture type.
|
4408
|
+
*
|
4409
|
+
* By default, all gesture types are disabled. When disabled, gestures of the
|
4410
|
+
* disabled type are never reported and will not appear in the frame
|
4411
|
+
* gesture list.
|
4412
|
+
*
|
4413
|
+
* \include Controller_enableGesture.txt
|
4414
|
+
*
|
4415
|
+
* As a performance optimization, only enable recognition for the types
|
4416
|
+
* of movements that you use in your application.
|
4417
|
+
*
|
4418
|
+
* @param type The type of gesture to enable or disable. Must be a
|
4419
|
+
* member of the Gesture::Type enumeration.
|
4420
|
+
* @param enable True, to enable the specified gesture type; False,
|
4421
|
+
* to disable.
|
4422
|
+
* @see Controller::isGestureEnabled()
|
4423
|
+
* @since 1.0
|
4424
|
+
*/
|
4425
|
+
LEAP_EXPORT void enableGesture(Gesture::Type type, bool enable = true) const;
|
4426
|
+
|
4427
|
+
/**
|
4428
|
+
* Reports whether the specified gesture type is enabled.
|
4429
|
+
*
|
4430
|
+
* \include Controller_isGestureEnabled.txt
|
4431
|
+
*
|
4432
|
+
* @return True, if the specified type is enabled; false, otherwise.
|
4433
|
+
* @see Controller::enableGesture()
|
4434
|
+
* @since 1.0
|
4435
|
+
*/
|
4436
|
+
LEAP_EXPORT bool isGestureEnabled(Gesture::Type type) const;
|
4437
|
+
};
|
4438
|
+
|
4439
|
+
/**
|
4440
|
+
* The Listener class defines a set of callback functions that you can
|
4441
|
+
* override in a subclass to respond to events dispatched by the Controller object.
|
4442
|
+
*
|
4443
|
+
* To handle Leap Motion events, create an instance of a Listener subclass and assign
|
4444
|
+
* it to the Controller instance. The Controller calls the relevant Listener
|
4445
|
+
* callback function when an event occurs, passing in a reference to itself.
|
4446
|
+
* You do not have to implement callbacks for events you do not want to handle.
|
4447
|
+
*
|
4448
|
+
* The Controller object calls these Listener functions from a thread created
|
4449
|
+
* by the Leap Motion library, not the thread used to create or set the Listener instance.
|
4450
|
+
* @since 1.0
|
4451
|
+
*/
|
4452
|
+
class Listener {
|
4453
|
+
public:
|
4454
|
+
/**
|
4455
|
+
* Constructs a Listener object.
|
4456
|
+
* @since 1.0
|
4457
|
+
*/
|
4458
|
+
LEAP_EXPORT Listener() {}
|
4459
|
+
|
4460
|
+
/**
|
4461
|
+
* Destroys this Listener object.
|
4462
|
+
*/
|
4463
|
+
LEAP_EXPORT virtual ~Listener() {}
|
4464
|
+
|
4465
|
+
/**
|
4466
|
+
* Called once, when this Listener object is newly added to a Controller.
|
4467
|
+
*
|
4468
|
+
* \include Listener_onInit.txt
|
4469
|
+
*
|
4470
|
+
* @param controller The Controller object invoking this callback function.
|
4471
|
+
* @since 1.0
|
4472
|
+
*/
|
4473
|
+
LEAP_EXPORT virtual void onInit(const Controller&) {}
|
4474
|
+
|
4475
|
+
/**
|
4476
|
+
* Called when the Controller object connects to the Leap Motion software and
|
4477
|
+
* the Leap Motion hardware device is plugged in,
|
4478
|
+
* or when this Listener object is added to a Controller that is already connected.
|
4479
|
+
*
|
4480
|
+
* \include Listener_onConnect.txt
|
4481
|
+
*
|
4482
|
+
* @param controller The Controller object invoking this callback function.
|
4483
|
+
* @since 1.0
|
4484
|
+
*/
|
4485
|
+
LEAP_EXPORT virtual void onConnect(const Controller&) {}
|
4486
|
+
|
4487
|
+
/**
|
4488
|
+
* Called when the Controller object disconnects from the Leap Motion software or
|
4489
|
+
* the Leap Motion hardware is unplugged.
|
4490
|
+
* The controller can disconnect when the Leap Motion device is unplugged, the
|
4491
|
+
* user shuts the Leap Motion software down, or the Leap Motion software encounters an
|
4492
|
+
* unrecoverable error.
|
4493
|
+
*
|
4494
|
+
* \include Listener_onDisconnect.txt
|
4495
|
+
*
|
4496
|
+
* Note: When you launch a Leap-enabled application in a debugger, the
|
4497
|
+
* Leap Motion library does not disconnect from the application. This is to allow
|
4498
|
+
* you to step through code without losing the connection because of time outs.
|
4499
|
+
*
|
4500
|
+
* @param controller The Controller object invoking this callback function.
|
4501
|
+
* @since 1.0
|
4502
|
+
*/
|
4503
|
+
LEAP_EXPORT virtual void onDisconnect(const Controller&) {}
|
4504
|
+
|
4505
|
+
/**
|
4506
|
+
* Called when this Listener object is removed from the Controller
|
4507
|
+
* or the Controller instance is destroyed.
|
4508
|
+
*
|
4509
|
+
* \include Listener_onExit.txt
|
4510
|
+
*
|
4511
|
+
* @param controller The Controller object invoking this callback function.
|
4512
|
+
* @since 1.0
|
4513
|
+
*/
|
4514
|
+
LEAP_EXPORT virtual void onExit(const Controller&) {}
|
4515
|
+
|
4516
|
+
/**
|
4517
|
+
* Called when a new frame of hand and finger tracking data is available.
|
4518
|
+
* Access the new frame data using the Controller::frame() function.
|
4519
|
+
*
|
4520
|
+
* \include Listener_onFrame.txt
|
4521
|
+
*
|
4522
|
+
* Note, the Controller skips any pending onFrame events while your
|
4523
|
+
* onFrame handler executes. If your implementation takes too long to return,
|
4524
|
+
* one or more frames can be skipped. The Controller still inserts the skipped
|
4525
|
+
* frames into the frame history. You can access recent frames by setting
|
4526
|
+
* the history parameter when calling the Controller::frame() function.
|
4527
|
+
* You can determine if any pending onFrame events were skipped by comparing
|
4528
|
+
* the ID of the most recent frame with the ID of the last received frame.
|
4529
|
+
*
|
4530
|
+
* @param controller The Controller object invoking this callback function.
|
4531
|
+
* @since 1.0
|
4532
|
+
*/
|
4533
|
+
LEAP_EXPORT virtual void onFrame(const Controller&) {}
|
4534
|
+
|
4535
|
+
/**
|
4536
|
+
* Called when this application becomes the foreground application.
|
4537
|
+
*
|
4538
|
+
* Only the foreground application receives tracking data from the Leap
|
4539
|
+
* Motion Controller. This function is only called when the controller
|
4540
|
+
* object is in a connected state.
|
4541
|
+
*
|
4542
|
+
* \include Listener_onFocusGained.txt
|
4543
|
+
*
|
4544
|
+
* @param controller The Controller object invoking this callback function.
|
4545
|
+
* @since 1.0
|
4546
|
+
*/
|
4547
|
+
LEAP_EXPORT virtual void onFocusGained(const Controller&) {}
|
4548
|
+
|
4549
|
+
/**
|
4550
|
+
* Called when this application loses the foreground focus.
|
4551
|
+
*
|
4552
|
+
* Only the foreground application receives tracking data from the Leap
|
4553
|
+
* Motion Controller. This function is only called when the controller
|
4554
|
+
* object is in a connected state.
|
4555
|
+
*
|
4556
|
+
* \include Listener_onFocusLost.txt
|
4557
|
+
*
|
4558
|
+
* @param controller The Controller object invoking this callback function.
|
4559
|
+
* @since 1.0
|
4560
|
+
*/
|
4561
|
+
LEAP_EXPORT virtual void onFocusLost(const Controller&) {}
|
4562
|
+
};
|
4563
|
+
|
4564
|
+
}
|
4565
|
+
|
4566
|
+
#endif // __Leap_h__
|