Leap Motion API类库:Bone

1. Bone   

    骨类代表一个被跟踪的手指骨,

    (1)属性有:

    Bone.basis:正交向量,骨头的指向。basis[0],    basis[1],basis[2],代表x,y,z

var basis = bone.basis;

    Bone.length:骨头长,

var length = bone.length;

    Bone.nextJoint:指尖

var bone_end = bone.nextJoint;

    Bone.prevJoint:骨头近端

var bone_start = bone.prevJoint;

    Bone.type:骨头类型,解剖结构,0,1,2,3,4。代表:掌,近指骨,中指骨,远指骨,手臂

var bone_names = ["metacarpal", "proximal phalange", "intermediate phalange", "distal phalange"];var type = bone.type;var name = bone_names[type];

    Bone.width:宽

var average_width = bone.width;

    (2)方法:

    Bone.center():坐标系,骨头中点

var center = bone.center();

    Bone.direction():方向,向量

var direction = bone.direction();

    Bone.left():boolean,辨别是不是左手

if(bone.left){
    var right_hand_basis = [Leap.vec3.negate(Leap.vec3.create(), bone.basis[0]),
                            Leap.vec3.negate(Leap.vec3.create(), bone.basis[1]),
                            Leap.vec3.negate(Leap.vec3.create(), bone.basis[2])];}

    Bone.lerp(out, t):number[],计算骨头两端点值,0,1。代表prevJoint和nextJoint

var quarter_point = Leap.vec3.create();
bone.lerp(quarter_point, .25);

    Bone.matrix():number[],在跳跃运动坐标系中描述骨方向和位置的转化,三维场景运用

var bone_transform = bone.matrix();


你可能感兴趣的:(Leap Motion API类库:Bone)