Recently, I tried to create a LEAPMOTION program in c++, but I don't know how to extract each element, such as the y coordinate of the index finger Middlebone. I can read from the sample how to display all x, y, z at the same time, but I don't know how to focus on one thing.
for(intb=0;b<4;++b){
Bone::Type boneType=static_cast<Bone::Type>(b);
Bone bone = finger.bone(boneType);
std::cout<<std::string(6, '')<boneNames [boneType]
<<"bone, start:"<bone.prevJoint()
<<", end:"<bone.nextJoint()
<<", direction:"<bone.direction()<std::endl;}
This is part of the sample program, and the starting point, ending point, angle, etc. of each bone on each finger are returned in the form of (x, y, z).I don't know how to get only this y value.
c++ leap-motion
Can't I use this?
The return type Leap::Bone::prevJoint()
is Leap::Vector
, and each element seemed to be of type float
.
for(intb=0;b<4;++b){
Bone::Type boneType=static_cast<Bone::Type>(b);
Bone bone = finger.bone(boneType);
float startPointY=bone.prevJoint().y
float endPointY=bone.nextJoint().y
float directionY=bone.direction().y
// Display Processing, etc.
std::cout<<"start.y"<<startPointY<<std::endl;
std::cout<<"end.y"<<endPointY<<std::endl;
std::cout<<"direction.y"<<directionY<<std::endl;
}
Reference URL:
Leap::Bone class
Leap::Vector Class
578 Understanding How to Configure Google API Key
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.