Tanoda
AttachmentPointFlags.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
using
UnityEngine
;
10
11
namespace
Leap.Unity.Attachments
{
12
16
[System.Flags]
17
public
enum
AttachmentPointFlags
{
18
None = 0,
19
20
Wrist
= 1 << 1,
21
Palm
= 1 << 2,
22
23
ThumbProximalJoint
= 1 << 3,
24
ThumbDistalJoint
= 1 << 4,
25
ThumbTip
= 1 << 5,
26
27
IndexKnuckle
= 1 << 6,
28
IndexMiddleJoint
= 1 << 7,
29
IndexDistalJoint
= 1 << 8,
30
IndexTip
= 1 << 9,
31
32
MiddleKnuckle
= 1 << 10,
33
MiddleMiddleJoint
= 1 << 11,
34
MiddleDistalJoint
= 1 << 12,
35
MiddleTip
= 1 << 13,
36
37
RingKnuckle
= 1 << 14,
38
RingMiddleJoint
= 1 << 15,
39
RingDistalJoint
= 1 << 16,
40
RingTip
= 1 << 17,
41
42
PinkyKnuckle
= 1 << 18,
43
PinkyMiddleJoint
= 1 << 19,
44
PinkyDistalJoint
= 1 << 20,
45
PinkyTip
= 1 << 21
46
}
47
48
public
static
class
AttachmentPointFlagsExtensions {
49
50
// Takes advantage of two's complement representation for negative integers
51
// to check whether the bit field has a single bit set.
52
// https://en.wikipedia.org/wiki/Two%27s_complement
53
public
static
bool
IsSinglePoint(
this
AttachmentPointFlags
points) {
54
int
mask = (int)points;
55
bool
isSingleBitSet = mask != 0 && mask == (mask & -mask);
56
return
isSingleBitSet;
57
}
58
63
public
static
bool
ContainsPoint(
this
AttachmentPointFlags
points,
AttachmentPointFlags
singlePoint) {
64
#if UNITY_EDITOR
65
// Validation for ensuring singlePoint is really a single point.
66
if
(!singlePoint.IsSinglePoint()) {
67
Debug
.LogWarning(
"'ContainsPoint' called with an argument that contains more than one attachment point flag set."
);
68
}
69
#endif
70
return
points.Contains(singlePoint);
71
}
72
79
public
static
bool
Contains(
this
AttachmentPointFlags
points,
AttachmentPointFlags
otherPoints) {
80
if
(points ==
AttachmentPointFlags
.None || otherPoints ==
AttachmentPointFlags
.None)
return
false
;
81
return
(points & otherPoints) == otherPoints;
82
}
83
84
}
85
86
}
Debug
UnityEngine.Debug Debug
Definition:
TanodaServer.cs:19
Leap.Unity.Attachments
Definition:
AttachmentHandsEditor.cs:14
Leap.Unity.Attachments.AttachmentPointFlags
AttachmentPointFlags
Flags for attachment points on the hand.
Definition:
AttachmentPointFlags.cs:17
Leap.Unity.Attachments.AttachmentPointFlags.IndexKnuckle
@ IndexKnuckle
Leap.Unity.Attachments.AttachmentPointFlags.RingDistalJoint
@ RingDistalJoint
Leap.Unity.Attachments.AttachmentPointFlags.PinkyMiddleJoint
@ PinkyMiddleJoint
Leap.Unity.Attachments.AttachmentPointFlags.RingMiddleJoint
@ RingMiddleJoint
Leap.Unity.Attachments.AttachmentPointFlags.Wrist
@ Wrist
Leap.Unity.Attachments.AttachmentPointFlags.MiddleDistalJoint
@ MiddleDistalJoint
Leap.Unity.Attachments.AttachmentPointFlags.Palm
@ Palm
Leap.Unity.Attachments.AttachmentPointFlags.ThumbTip
@ ThumbTip
Leap.Unity.Attachments.AttachmentPointFlags.ThumbDistalJoint
@ ThumbDistalJoint
Leap.Unity.Attachments.AttachmentPointFlags.RingTip
@ RingTip
Leap.Unity.Attachments.AttachmentPointFlags.PinkyTip
@ PinkyTip
Leap.Unity.Attachments.AttachmentPointFlags.PinkyKnuckle
@ PinkyKnuckle
Leap.Unity.Attachments.AttachmentPointFlags.ThumbProximalJoint
@ ThumbProximalJoint
Leap.Unity.Attachments.AttachmentPointFlags.RingKnuckle
@ RingKnuckle
Leap.Unity.Attachments.AttachmentPointFlags.MiddleTip
@ MiddleTip
Leap.Unity.Attachments.AttachmentPointFlags.MiddleKnuckle
@ MiddleKnuckle
Leap.Unity.Attachments.AttachmentPointFlags.IndexTip
@ IndexTip
Leap.Unity.Attachments.AttachmentPointFlags.PinkyDistalJoint
@ PinkyDistalJoint
Leap.Unity.Attachments.AttachmentPointFlags.IndexMiddleJoint
@ IndexMiddleJoint
Leap.Unity.Attachments.AttachmentPointFlags.IndexDistalJoint
@ IndexDistalJoint
Leap.Unity.Attachments.AttachmentPointFlags.MiddleMiddleJoint
@ MiddleMiddleJoint
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Core
Scripts
Attachments
AttachmentPointFlags.cs
Generated by
1.9.3