[4de1c7]: / app / resources / LeapSDK / v3_python27 / src / CopyFromOtherExtensions.cs

Download this file

119 lines (103 with data), 4.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/******************************************************************************\
* Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. *
* Leap Motion proprietary and confidential. Not for distribution. *
* Use subject to the terms of the Leap Motion SDK Agreement available at *
* https://developer.leapmotion.com/sdk_agreement, or another agreement *
* between Leap Motion and you, your company or other organization. *
\******************************************************************************/
namespace Leap {
public static class CopyFromOtherExtensions {
/**
* Copies the data from a source frame into a frame. After the operation is
* complete, the frame will be identical to the source frame.
*
* @param source The source frame that is copied into a frame.
*/
public static Frame CopyFrom(this Frame frame, Frame source)
{
frame.Id = source.Id;
frame.Timestamp = source.Timestamp;
frame.CurrentFramesPerSecond = source.CurrentFramesPerSecond;
frame.InteractionBox = source.InteractionBox;
frame.ResizeHandList(source.Hands.Count);
for (int i = frame.Hands.Count; i-- != 0; )
{
frame.Hands[i].CopyFrom(source.Hands[i]);
}
return frame;
}
/*
* Copies the data from a source hand into a hand. After the operation is
* complete, the hand will be identical to the source hand.
*
* @param source The source hand that is copied into a hand.
*/
public static Hand CopyFrom(this Hand hand, Hand source)
{
hand.Id = source.Id;
hand.Confidence = source.Confidence;
hand.GrabStrength = source.GrabStrength;
hand.GrabAngle = source.GrabAngle;
hand.Rotation = source.Rotation;
hand.PinchStrength = source.PinchStrength;
hand.PinchDistance = source.PinchDistance;
hand.PalmWidth = source.PalmWidth;
hand.IsLeft = source.IsLeft;
hand.TimeVisible = source.TimeVisible;
hand.PalmPosition = source.PalmPosition;
hand.StabilizedPalmPosition = source.StabilizedPalmPosition;
hand.PalmVelocity = source.PalmVelocity;
hand.PalmNormal = source.PalmNormal;
hand.Direction = source.Direction;
hand.WristPosition = source.WristPosition;
hand.Arm.CopyFrom(source.Arm);
for (int i = 5; i-- != 0; )
{
hand.Fingers[i].CopyFrom(source.Fingers[i]);
}
return hand;
}
/**
* Copies the data from a source finger into a finger. After the operation is
* complete, the finger will be identical to the source finger.
*
* @param source The source finger that is copied into a finger.
*/
public static Finger CopyFrom(this Finger finger, Finger source)
{
for (int i = 4; i-- != 0; )
{
finger.bones[i].CopyFrom(source.bones[i]);
}
finger.Id = source.Id;
finger.HandId = source.HandId;
finger.TimeVisible = source.TimeVisible;
finger.TipPosition = source.TipPosition;
finger.TipVelocity = source.TipVelocity;
finger.Direction = source.Direction;
finger.StabilizedTipPosition = source.StabilizedTipPosition;
finger.Width = source.Width;
finger.Length = source.Length;
finger.IsExtended = source.IsExtended;
finger.Type = source.Type;
return finger;
}
/**
* Copies the data from a source bone into a bone. After the operation is
* complete, the bone will be identical to the source bone.
*
* @param source The source bone that is copied into a bone.
*/
public static Bone CopyFrom(this Bone bone, Bone source) {
bone.PrevJoint = source.PrevJoint;
bone.NextJoint = source.NextJoint;
bone.Direction = source.Direction;
bone.Center = source.Center;
bone.Length = source.Length;
bone.Width = source.Width;
bone.Rotation = source.Rotation;
bone.Type = source.Type;
return bone;
}
}
}