本文整理汇总了Java中com.leapmotion.leap.Vector.getZ方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.getZ方法的具体用法?Java Vector.getZ怎么用?Java Vector.getZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.leapmotion.leap.Vector
的用法示例。
在下文中一共展示了Vector.getZ方法的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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}