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


Java Vector.getX方法代码示例

本文整理汇总了Java中com.leapmotion.leap.Vector.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.getX方法的具体用法?Java Vector.getX怎么用?Java Vector.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.leapmotion.leap.Vector的用法示例。


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

示例1: calculateProjectionOfFinger

import com.leapmotion.leap.Vector; //导入方法依赖的package包/类
private Vector calculateProjectionOfFinger(Vector fingerPoint, AppScreenPlan screenPlan) {
    //TODO: Verify and test the equation
    Vector p1 = screenPlan.getP1();
    float d = -(planNormalVector.getX() * p1.getX()
            + planNormalVector.getY() * p1.getY()
            + planNormalVector.getZ() * p1.getZ());
    float k = -(planNormalVector.getX() * fingerPoint.getX()
                + planNormalVector.getY() * fingerPoint.getY()
                + planNormalVector.getZ() * fingerPoint.getZ()+ d)
            / (planNormalVector.getX()* planNormalVector.getX()
                + planNormalVector.getY()* planNormalVector.getY()
                + planNormalVector.getZ()* planNormalVector.getZ()
            );
    Vector PF = new Vector(fingerPoint.getX()
            -(k* planNormalVector.getX()), fingerPoint.getY()
            -(k* planNormalVector.getY()), fingerPoint.getZ()
            -(k* planNormalVector.getZ()));
    return PF;
}
 
开发者ID:francoiscabrol,项目名称:LoCALISM,代码行数:20,代码来源:FingerRelativeToScreen.java

示例2: mapLeapHandData

import com.leapmotion.leap.Vector; //导入方法依赖的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

示例3: vAverage

import com.leapmotion.leap.Vector; //导入方法依赖的package包/类
private Vector vAverage(LimitQueue<Vector> vectors){
    float vx=0f, vy=0f, vz=0f;
    for(Vector v:vectors){
        vx=vx+v.getX(); 
        vy=vy+v.getY(); 
        vz=vz+v.getZ();
    }
    return new Vector(vx/vectors.size(), vy/vectors.size(), vz/vectors.size());
}
 
开发者ID:jperedadnr,项目名称:Leap3DFX,代码行数:10,代码来源:SimpleLeapListener.java

示例4: mapLeapHandData

import com.leapmotion.leap.Vector; //导入方法依赖的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

示例5: calculateProjectionOfFingerWithDirection

import com.leapmotion.leap.Vector; //导入方法依赖的package包/类
private Vector calculateProjectionOfFingerWithDirection(Pointable pointable, AppScreenPlan screenPlan) {
    //TODO: Verify and test the equation
    //plane equation defined as  a.x + b.y + c.z + d = 0 ( 0 )
    //x0 is the project on the vector pointable.direction() on the plane
    Vector a = pointable.tipPosition();
    Vector b = pointable.direction().opposite().times(pointable.length());
    b = b.plus(pointable.tipPosition());
    Vector u = pointable.direction().times(pointable.length() * 1000);

    //calculation of d from the plane equation
    Vector p1 = screenPlan.getP2();
    Vector n = screenPlan.getNormalVector();
    float d = -(n.getX() * p1.getX()
                + n.getY() * p1.getY()
                + n.getZ() * p1.getZ());

    //calculation of k from the plane equation
    float k = -(u.getX() * a.getX()
                + u.getY() * a.getY()
                + u.getZ() * a.getZ()
                + d)
            / (u.getX() * u.getX()
                + u.getY()* u.getY()
                + u.getZ()* u.getZ());

    //calculation of x0
    float x1 = a.getX()-(k * u.getX());
    float x2 = a.getY()-(k * u.getY());
    float x3 = a.getZ()-(k * u.getZ());
    Vector x0 = new Vector(x1, x2, x3);
    return x0;
}
 
开发者ID:francoiscabrol,项目名称:LoCALISM,代码行数:33,代码来源:FingerRelativeToScreen.java

示例6: calculateIsTouching

import com.leapmotion.leap.Vector; //导入方法依赖的package包/类
private boolean calculateIsTouching() {
    //TODO: Find the best offset
    int offset = 100000;
    Vector p1 = screenPlan.getP1();
    Vector p1M = new Vector(getFrontFingerVector().getX()-p1.getX(), getFrontFingerVector().getY()-p1.getY(), getFrontFingerVector().getZ()-p1.getZ());
    float p = p1M.dot(planNormalVector);
    return (p > -offset) ? true : false;
}
 
开发者ID:francoiscabrol,项目名称:LoCALISM,代码行数:9,代码来源:FingerRelativeToScreen.java

示例7: delta

import com.leapmotion.leap.Vector; //导入方法依赖的package包/类
/**
 * Gets the delta between two vectors.
 *
 * @param newVector new vector
 * @param oldVector old vector
 * @return delta
 */
public static Vector delta(Vector newVector, Vector oldVector) {
    return new Vector(newVector.getX() - oldVector.getX(),
            newVector.getY() - oldVector.getY(),
            newVector.getZ() - oldVector.getZ());
}
 
开发者ID:forairan,项目名称:Leapcraft,代码行数:13,代码来源:LeapUtil.java


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