当前位置: 首页>>代码示例>>Java>>正文


Java Finger类代码示例

本文整理汇总了Java中com.leapmotion.leap.Finger的典型用法代码示例。如果您正苦于以下问题:Java Finger类的具体用法?Java Finger怎么用?Java Finger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Finger类属于com.leapmotion.leap包,在下文中一共展示了Finger类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJointAngle

import com.leapmotion.leap.Finger; //导入依赖的package包/类
/**
 * Return the angle of the finger for the hand specified This computes the
 * angle based on the dot product of the palmNormal and the fingerDirection
 * Theta = arccos( (V1.V2) / ( |V1| * |V2| )
 * 
 * @param hand
 *            - "left" or "right"
 * @param tip
 *            - 0 (thumb) / 1 (index) .. etc..
 * @return angle in degrees
 */
public double getJointAngle(String hand, Integer tip) {
	com.leapmotion.leap.Hand h = null;
	if ("left".equalsIgnoreCase(hand)) {
		// left hand
		h = controller.frame().hands().leftmost();
	} else {
		// right hand
		h = controller.frame().hands().rightmost();
	}
	// TODO: does this return the correct finger?
	Finger f = h.fingers().get(tip);
	Vector palmNormal = h.palmNormal();
	Vector fDir = f.direction();
	// TODO: validate that this is what we actually want.
	// otherwise we can directly compute the angleTo in java.
	float angleInRadians = palmNormal.angleTo(fDir);
	// convert to degrees so it's easy to pass to servos
	double angle = Math.toDegrees(angleInRadians);
	return angle;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:32,代码来源:LeapMotion2.java

示例2: getJointAngle

import com.leapmotion.leap.Finger; //导入依赖的package包/类
/**
 * Return the angle of the finger for the hand specified This computes the
 * angle based on the dot product of the palmNormal and the fingerDirection
 * Theta = arccos( (V1.V2) / ( |V1| * |V2| )
 * 
 * @param hand
 *          - "left" or "right"
 * @param tip
 *          - 0 (thumb) / 1 (index) .. etc..
 * @return angle in degrees
 */
public double getJointAngle(String hand, Integer tip) {
  com.leapmotion.leap.Hand h = null;
  if ("left".equalsIgnoreCase(hand)) {
    // left hand
    h = controller.frame().hands().leftmost();
  } else {
    // right hand
    h = controller.frame().hands().rightmost();
  }
  // TODO: does this return the correct finger?
  Finger f = h.fingers().get(tip);
  Vector palmNormal = h.palmNormal();
  Vector fDir = f.direction();
  // TODO: validate that this is what we actually want.
  // otherwise we can directly compute the angleTo in java.
  float angleInRadians = palmNormal.angleTo(fDir);
  // convert to degrees so it's easy to pass to servos
  double angle = Math.toDegrees(angleInRadians);
  return angle;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:32,代码来源:LeapMotion.java

示例3: computeAngleDegrees

import com.leapmotion.leap.Finger; //导入依赖的package包/类
private double computeAngleDegrees(Finger f, Vector palmNormal) {
	Vector fDir = f.direction();
	// TODO: validate that this is what we actually want.
	// otherwise we can directly compute the angleTo in java.
	double angleInRadians = palmNormal.angleTo(fDir);
	// convert to degrees so it's easy to pass to servos
	double angle = Math.toDegrees(angleInRadians);
	return angle;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:10,代码来源:LeapMotionListener.java

示例4: mapLeapHandData

import com.leapmotion.leap.Finger; //导入依赖的package包/类
private LeapMotion2.Hand mapLeapHandData(Hand lh) {
	LeapMotion2.Hand mrlHand = new LeapMotion2.Hand();
	// process the normal
	Vector palmNormal = lh.palmNormal();
	mrlHand.palmNormalX = palmNormal.getX();
	mrlHand.palmNormalY = palmNormal.getY();
	mrlHand.palmNormalZ = palmNormal.getZ();

	// handle the fingers.
	for (Finger.Type t : Finger.Type.values()) {
		Finger f = lh.fingers().get(t.ordinal());
		double angle = computeAngleDegrees(f, palmNormal);
		if (t.equals(Finger.Type.TYPE_INDEX))
			mrlHand.index = angle;
		else if (t.equals(Finger.Type.TYPE_MIDDLE))
			mrlHand.middle = angle;
		else if (t.equals(Finger.Type.TYPE_RING))
			mrlHand.ring = angle;
		else if (t.equals(Finger.Type.TYPE_PINKY))
			mrlHand.pinky = angle;
		else if (t.equals(Finger.Type.TYPE_THUMB))
			mrlHand.thumb = angle;
		else
			log.warn("Unknown finger! eek..");
	}
	return mrlHand;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:28,代码来源:LeapMotionListener.java

示例5: FingerObj

import com.leapmotion.leap.Finger; //导入依赖的package包/类
public FingerObj(Finger f, FrameObj frame, ControllerObj controller) {
	super(controller);
	
	copy(f, frame);
	//bases = f.bases;
	//btipPosition = f.btipPosition;
	//carpPosition = f.carpPosition;
	//dipPosition = f.dipPosition;
	//mcpPosition = f.mcpPosition;
	//pipPosition = f.pipPosition;
	type = f.type();
}
 
开发者ID:paluka,项目名称:Multi-Leap,代码行数:13,代码来源:FingerObj.java

示例6: FingerListObj

import com.leapmotion.leap.Finger; //导入依赖的package包/类
public FingerListObj(FingerList list, FrameObj frame, ControllerObj controller) {
	this.controller = controller;
	fingers = new ArrayList<FingerObj>();
	
	for (Finger f : list) {
		fingers.add(new FingerObj(f, frame, controller));
	}
}
 
开发者ID:paluka,项目名称:Multi-Leap,代码行数:9,代码来源:FingerListObj.java

示例7: fingerType

import com.leapmotion.leap.Finger; //导入依赖的package包/类
/**
 * Returns a list containing fingers from the current list of a given finger type by modifying the existing list.
 * @param type
 * @return
 */
public FingerListObj fingerType(Finger.Type type) {
	
	FingerListObj list = new FingerListObj(controller);
	
	for (FingerObj f : fingers) {
		
		if (f.type == type) {
			list.fingers.add(f);
		}
	}
	return list;
}
 
开发者ID:paluka,项目名称:Multi-Leap,代码行数:18,代码来源:FingerListObj.java

示例8: computeAngleDegrees

import com.leapmotion.leap.Finger; //导入依赖的package包/类
private double computeAngleDegrees(Finger f, Vector palmNormal) {
  Vector fDir = f.direction();
  // TODO: validate that this is what we actually want.
  // otherwise we can directly compute the angleTo in java.
  double angleInRadians = palmNormal.angleTo(fDir);
  // convert to degrees so it's easy to pass to servos
  double angle = Math.toDegrees(angleInRadians);
  return angle;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:10,代码来源:LeapMotionListener.java

示例9: mapLeapHandData

import com.leapmotion.leap.Finger; //导入依赖的package包/类
private LeapHand mapLeapHandData(Hand lh) {
  LeapHand mrlHand = new LeapHand();
  // process the normal
  Vector palmNormal = lh.palmNormal();
  mrlHand.palmNormalX = palmNormal.getX();
  mrlHand.palmNormalY = palmNormal.getY();
  mrlHand.palmNormalZ = palmNormal.getZ();

  mrlHand.posX = lh.arm().center().getX();
  mrlHand.posY = lh.arm().center().getY();
  mrlHand.posZ = lh.arm().center().getZ();

  // handle the fingers.
  for (Finger.Type t : Finger.Type.values()) {
    Finger f = lh.fingers().get(t.ordinal());
    int angle = (int) computeAngleDegrees(f, palmNormal);
    if (t.equals(Finger.Type.TYPE_INDEX))
      mrlHand.index = angle;
    else if (t.equals(Finger.Type.TYPE_MIDDLE))
      mrlHand.middle = angle;
    else if (t.equals(Finger.Type.TYPE_RING))
      mrlHand.ring = angle;
    else if (t.equals(Finger.Type.TYPE_PINKY))
      mrlHand.pinky = angle;
    else if (t.equals(Finger.Type.TYPE_THUMB))
      mrlHand.thumb = angle;
    else
      log.warn("Unknown finger! eek..");
  }
  return mrlHand;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:32,代码来源:LeapMotionListener.java

示例10: onInit

import com.leapmotion.leap.Finger; //导入依赖的package包/类
public void onInit(Controller controller) {
	// Initialize arrays
	for (int i = 0; i < hands.length; i++)
		hands[i] = new Hand();
	for (int i = 0; i < tools.length; i++)
		tools[i] = new Tool();
	for (int i = 0; i < fingers.length; i++)
		fingers[i] = new Finger();
}
 
开发者ID:khanning,项目名称:LeapScratch,代码行数:10,代码来源:LeapListener.java

示例11: getFingersRight

import com.leapmotion.leap.Finger; //导入依赖的package包/类
public List<Finger> getFingersRight(){ 
    return fingersRight.stream().collect(Collectors.toList());
}
 
开发者ID:jperedadnr,项目名称:RiggedHand,代码行数:4,代码来源:LeapListener.java

示例12: getFingersLeft

import com.leapmotion.leap.Finger; //导入依赖的package包/类
public List<Finger> getFingersLeft(){ 
    return fingersLeft.stream().collect(Collectors.toList());
}
 
开发者ID:jperedadnr,项目名称:RiggedHand,代码行数:4,代码来源:LeapListener.java

示例13: type

import com.leapmotion.leap.Finger; //导入依赖的package包/类
/**
 * The name of this finger.
 * @return
 */
public Finger.Type type() {
	return type;
}
 
开发者ID:paluka,项目名称:Multi-Leap,代码行数:8,代码来源:FingerObj.java


注:本文中的com.leapmotion.leap.Finger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。