Tanoda
Bone.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
9namespace Leap {
10 using System;
11
25 [Serializable]
26 public class Bone : IEquatable<Bone> {
27
33 public Bone() {
34 Type = BoneType.TYPE_INVALID;
35 }
36
41 public Bone(Vector prevJoint,
42 Vector nextJoint,
43 Vector center,
44 Vector direction,
45 float length,
46 float width,
47 Bone.BoneType type,
48 LeapQuaternion rotation) {
49 PrevJoint = prevJoint;
50 NextJoint = nextJoint;
51 Center = center;
52 Direction = direction;
53 Rotation = rotation;
54 Length = length;
55 Width = width;
56 Type = type;
57 }
58
66 public bool Equals(Bone other) {
67 return Center == other.Center && Direction == other.Direction && Length == other.Length;
68 }
69
74 public override string ToString() {
75 return Enum.GetName(typeof(BoneType), this.Type) + " bone";
76 }
77
84
91
96 public Vector Center;
97
103
108 public float Length;
109
114 public float Width;
115
121
127
159 public LeapTransform Basis { get { return new LeapTransform(PrevJoint, Rotation); } }
160
168 public enum BoneType {
169 TYPE_INVALID = -1,
170 TYPE_METACARPAL = 0,
171 TYPE_PROXIMAL = 1,
172 TYPE_INTERMEDIATE = 2,
173 TYPE_DISTAL = 3
174 }
175 }
176}
The Bone class represents a tracked bone.
Definition: Bone.cs:26
bool Equals(Bone other)
Compare Bone object equality.
Definition: Bone.cs:66
LeapQuaternion Rotation
The orientation of this Bone as a Quaternion.
Definition: Bone.cs:126
Vector Direction
The normalized direction of the bone from base to tip.
Definition: Bone.cs:102
float Width
The average width of the flesh around the bone.
Definition: Bone.cs:114
BoneType
Enumerates the type of bones.
Definition: Bone.cs:168
LeapTransform Basis
The orthonormal basis vectors for this Bone as a Matrix. The orientation of this Bone as a Quaternion...
Definition: Bone.cs:159
BoneType Type
The type of this bone.
Definition: Bone.cs:120
Vector Center
The midpoint of the bone.
Definition: Bone.cs:96
override string ToString()
A string containing a brief, human readable description of the Bone object.
Definition: Bone.cs:74
Vector PrevJoint
The base of the bone, closest to the wrist. In anatomical terms, this is the proximal end of the bone...
Definition: Bone.cs:83
Bone()
Constructs a default invalid Bone object.
Definition: Bone.cs:33
float Length
The estimated length of the bone.
Definition: Bone.cs:108
Vector NextJoint
The end of the bone, closest to the finger tip. In anatomical terms, this is the distal end of the bo...
Definition: Bone.cs:90
Bone(Vector prevJoint, Vector nextJoint, Vector center, Vector direction, float length, float width, Bone.BoneType type, LeapQuaternion rotation)
Constructs a new Bone object.
Definition: Bone.cs:41
The LeapQuaternion struct represents a rotation in three-dimensional space.
The LeapTransform class represents a transform in three dimensional space.
The Vector struct represents a three-component mathematical vector or point such as a direction or po...
Definition: Vector.cs:36