Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofxLeapMotion - SetMapping...()

$
0
0

@rjlwest wrote:

I can't quite figure these functions out. I'd like to be able to change the range the simpleHands operate over so I need to call SetMappingx/y/z every time I want to change it, I just don't understand exactly how each parameter is used in getMappedofPoint().

//--------------------------------------------------------------
void ofxLeapMotion::setMappingZ(float minZ, float maxZ, float outputMinZ, float outputMaxZ){
zOffsetIn = minZ;
zOffsetOut = outputMinZ;
zScale = (outputMaxZ - outputMinZ) / (maxZ - minZ);
}

//--------------------------------------------------------------
ofPoint ofxLeapMotion::getMappedofPoint(Vector v){
ofPoint p = getofPoint(v);
p.x = xOffsetOut + (p.x - xOffsetIn) * xScale;
p.y = yOffsetOut + (p.y - yOffsetIn) * yScale;
p.z = zOffsetOut + (p.z - zOffsetIn) * zScale;
return p;
}

I had thought the first 2 parameters were for the actual size of the hand and the last 2 were for area they map to, but it isn't.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles