Exemplo n.º 1
0
void ofxMtPhoto::tuioRemoved(ofxTuioCursor &tuioCursor){
	ofVec2f loc = ofVec2f(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
	
	for (int i = 0; i < cursorsOnBorder.size(); i++ )
		if (cursorsOnBorder[i].idN == tuioCursor.getSessionId())
			cursorsOnBorder.erase(cursorsOnBorder.begin()+i);
}
Exemplo n.º 2
0
void testApp::tuioAdded(ofxTuioCursor& tuioCursor)
{
    log  = " new cursor: ";
	log += ofToString(tuioCursor.getFingerId());
	log += " X: " + ofToString(tuioCursor.getX());
	log += " Y: " + ofToString(tuioCursor.getY());
}
Exemplo n.º 3
0
void testApp::tuioUpdated(ofxTuioCursor& tuioCursor)
{
    log =  " cursor updated: ";
	log += ofToString(tuioCursor.getFingerId());
	log += " X: " + ofToString(tuioCursor.getX());
	log += " Y: " + ofToString(tuioCursor.getY());
}
Exemplo n.º 4
0
void FractalTreeApp::tuioUpdated(ofxTuioCursor &tuioCursor){
                ofPoint addedCursor(tuioCursor.getX()*ofGetWidth(), tuioCursor.getY()*ofGetHeight());
            addedCursor = toLocalAxisSystem(addedCursor);
            IC = addedCursor;


}
Exemplo n.º 5
0
void ofApp::tuioAdded(ofxTuioCursor &tuioCursor)
{
    tuioPoints.push_back(tuioContainer());
    tuioPoints.back().sid = tuioCursor.getSessionId();
    tuioPoints.back().location.set(tuioCursor.getX(), tuioCursor.getY());
    tuioPoints.back().setLastLocation();
}
Exemplo n.º 6
0
//--------------------------------------------------------------
void ofApp::tuioUpdated(ofxTuioCursor &cursor){
    Finger& f = finger[cursor.getFingerId()];
    
    ofPoint loc = ofPoint(cursor.getX()*ofGetWidth(),cursor.getY()*ofGetHeight());
    
    // save the active value because it will be overwritten after the update
    bool wasActive = f.isActive();

    f.update(loc);
    
    // make a new ray if the speed is high enough, the finger was active and if the finger hasn't triggered anything lately
    if(f.getDirection().length() > triggerSpeed && wasActive && f.getTimeSinceLastTriggered() > triggerTimeout){
        f.triggered();
        ParticleRay r = ParticleRay(f.getPosition(), f.getDirection().scale(particleSpeed));
        
        // check if we need to create a new ray or if an old one can be reused
        // this could very well be coded more efficiently...
        int i = 0;
        for(i = 0; i< rays.size(); i++){
            if(rays[i].isDead()){
                break;
            }
        }
        if(i < rays.size()){
            rays[i] = r;
        } else{
            rays.push_back(r);
        }
    }
    
//    ledFrame.stopPulsing();
    ledFrame.updateLastPointsTime();
}
Exemplo n.º 7
0
ofPoint menu::transf_PosTUIO(ofxTuioCursor & tuioCursor) {

    int mx = W_WIDTH*tuioCursor.getX() + (ofGetScreenWidth()-W_WIDTH)/2.0;
    int my = W_HEIGHT*tuioCursor.getY();
//	ofPoint loc = ofPoint(mx,my);

	return ofPoint(mx,my);
}
Exemplo n.º 8
0
void testApp::tuioUpdated(ofxTuioCursor & tuioCursor) {
    //TODO add linemake function and update object
#ifdef DEBUG
    log="Cursor Updated: "+ofToString(tuioCursor.getFingerId())+
        " X: "+ofToString(tuioCursor.getX())+
        " Y: "+ofToString(tuioCursor.getY());
    ofLog()<<log;
#endif
}
Exemplo n.º 9
0
//call when finger is moved
void testApp::tuioAdded(ofxTuioCursor & tuioCursor) {
    //TODO add function that runs when finger added
#ifdef DEBUG
    log="New Cursor: "+ofToString(tuioCursor.getFingerId())+
        " X: "+ofToString(tuioCursor.getX())+
        " Y: "+ofToString(tuioCursor.getY());
    ofLog()<<log;
#endif
}
Exemplo n.º 10
0
void FractalTreeApp::tuioAdded(ofxTuioCursor &tuioCursor){
	//TODO: Check Menu Items
            ofPoint addedCursor(tuioCursor.getX()*ofGetWidth(), tuioCursor.getY()*ofGetHeight());
            addedCursor = toLocalAxisSystem(addedCursor);




}
Exemplo n.º 11
0
void ofApp::tuioUpdated(ofxTuioCursor &tuioCursor)
{
    //    ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
    int cursorIndex = getTuioPointIndex(tuioCursor.getSessionId());
    if (cursorIndex < 0)
    {
        return;
    }
    tuioPoints.at(cursorIndex).setLastLocation();
    tuioPoints.at(cursorIndex).location.set(tuioCursor.getX(), tuioCursor.getY());
}
Exemplo n.º 12
0
void menu::tuioUpdated(ofxTuioCursor &tuioCursor){
	//    int mx = W_WIDTH*tuioCursor.getX();
	////    int mx = W_WIDTH*(tuioCursor.getX()+0.5);
	//    int my = W_HEIGHT*tuioCursor.getY();
	//	ofPoint loc = ofPoint(mx,my);
	
	ofPoint loc = transf_PosTUIO(tuioCursor);
//	cout << "Point n" << tuioCursor.getSessionId() << " updated at " << loc << endl;
    
    hands.notifySlide(loc.x, loc.y, tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
 //   touchElements.notifySlide(loc.x, loc.y,tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
}
Exemplo n.º 13
0
//call when finger is removed from Ideatable
void testApp::tuioRemoved(ofxTuioCursor & tuioCursor) {
    //remove line which is related to the finger
    for(line_itr=lines.begin(); line_itr!=lines.end(); line_itr++) {
        if((*line_itr).getCursorID()==tuioCursor.getFingerId())
            lines.erase(line_itr);
    }
    prevStatus.erase(tuioCursor.getFingerId());
#ifdef DEBUG
    log="Cursor Removed: "+ofToString(tuioCursor.getFingerId())+
        " X: "+ofToString(tuioCursor.getX())+
        " Y: "+ofToString(tuioCursor.getY());
    ofLog()<<log;
#endif
}
Exemplo n.º 14
0
void ofxLayout::tuioUpdated(ofxTuioCursor &tuioCursor)
{
    if(tuioCursor.getFingerId() == 0){
        if (touchReady){
            ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
            mouseDraggedPt = ofPoint(loc)*mouseTransformation;
            ofxLayoutElement* mouseDraggedElement = hittest(mouseDraggedPt);
            mouseDraggedElement->fingerDragged(loc);
            string evtStr = "mouseDragged";
            ofNotifyEvent(mouseDraggedEvt, evtStr, mouseDraggedElement);
            ofNotifyEvent(tuioCursorUpdatedEvt, tuioCursor, mouseDraggedElement);
        }
    }
}
Exemplo n.º 15
0
void electromagnetica::tuioRemoved(ofxTuioCursor &tuioCursor){
	ofPoint loc = ofPoint(tuioCursor.getX()*W_WIDTH,tuioCursor.getY()*W_HEIGHT);
    //cout << "Point n" << tuioCursor.getSessionId() << " remove at " << loc << endl;
    /*
     if(id_slider1==tuioCursor.getSessionId()) id_slider1=NULL;
     if(id_jumpingRect==tuioCursor.getSessionId()) id_jumpingRect=NULL;
     if(id_moverect==tuioCursor.getSessionId()) id_moverect=NULL;*/
    
    
    hands.removeObjectByTuioID(tuioCursor.getSessionId() );
    wavesm.touchUp(tuioCursor.getSessionId());
    cheapComm::getInstance()->sendAudio0("/audio/electromagnetism/hand_off_event");
    
}
Exemplo n.º 16
0
// FINGER ADDED ////////////////////////////////////////////////////////
void testApp::cursorAdded(ofxTuioCursor & tuioCursor)
{
	int finger_id = tuioCursor.getFingerId();
	pos.x = wQuadro * tuioCursor.getX();
	pos.y = hQuadro * tuioCursor.getY();
	
	dito = new Finger(finger_id);
	dito_list.push_back(dito);
	dito_list.back()->setup(&pos, blue);
	dito_list.back()->added();
	
	
	
	
}
Exemplo n.º 17
0
void testApp::tuioRemoved(ofxTuioCursor &tuioCursor){
        ofLog()<< "tuioRemoved" << endl;
	ofPoint loc = ofPoint(tuioCursor.getX()*W_WIDTH,tuioCursor.getY()*W_HEIGHT);
    //cout << "Point n" << tuioCursor.getSessionId() << " remove at " << loc << endl;
   /*
    if(id_slider1==tuioCursor.getSessionId()) id_slider1=NULL;
    if(id_jumpingRect==tuioCursor.getSessionId()) id_jumpingRect=NULL;
    if(id_moverect==tuioCursor.getSessionId()) id_moverect=NULL;*/

    
    touchElements.removeObjectByTuioID(tuioCursor.getSessionId() );
    
    touchElements.notifyTouchUp( tuioCursor.getSessionId() );

}
Exemplo n.º 18
0
void testApp::tuioAdded(ofxTuioCursor &tuioCursor){
    ofLog()<< "tuioAdded" << endl;
	ofPoint loc = ofPoint(tuioCursor.getX()*W_WIDTH,tuioCursor.getY()*W_HEIGHT);
	cout << "Point n" << tuioCursor.getSessionId() << " add at " << tuioCursor.getX() << " " << tuioCursor.getY()<< endl;

    
   // o1.touch(loc.x, loc.y,tuioCursor.getSessionId());
   // h1.touch(loc.x, loc.y,tuioCursor.getSessionId());

    handShadow *h1 = new handShadow();
    h1->setup();
    touchElements.addObject(*h1);
    
    touchElements.notifyTouch(loc.x, loc.y,tuioCursor.getSessionId());
}
Exemplo n.º 19
0
void ofxLayout::tuioRemoved(ofxTuioCursor &tuioCursor)
{
    if(tuioCursor.getFingerId() == 0)
    {
        ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
        mouseDraggedPt.set(ofPoint());
        mouseReleasedPt = loc*mouseTransformation;
        ofxLayoutElement* mouseReleasedElement = hittest(mouseReleasedPt);
        mouseReleasedElement->fingerReleased(loc);
        string evtStr = "mouseReleased";
        ofNotifyEvent(mouseReleasedEvt, evtStr, mouseReleasedElement);
        ofNotifyEvent(tuioCursorRemovedEvt, tuioCursor, mouseReleasedElement);
        
        touchReadyCheck();
    }
}
Exemplo n.º 20
0
//--------------------------------------------------------------
void gFrameApp::tuioRemoved(ofxTuioCursor & cursor)
{
    if(input_tuio)
    {
        finger_positions[cursor.getFingerId()] = ofVec2f(0, 0);
    }
}
Exemplo n.º 21
0
// FINGER REMOVED //////////////////////////////////////////////////////
void testApp::cursorRemoved(ofxTuioCursor & tuioCursor)
{
	int finger_id = tuioCursor.getFingerId();
	pos.x = wQuadro * tuioCursor.getX();
	pos.y = hQuadro * tuioCursor.getY();
	
	list<Finger*>::iterator it;
	for (it=dito_list.begin(); it !=dito_list.end(); ++it) 
	{
		if ( (*it)->get_finger_id() == finger_id) 
		{
			(*it)->removed();
			break;
		}
	}
	dito_list.erase(it);
}
Exemplo n.º 22
0
void menu::tuioAdded(ofxTuioCursor &tuioCursor){
//    int mx = W_WIDTH*tuioCursor.getX();
////    int mx = W_WIDTH*(tuioCursor.getX()+0.5);
//    int my = W_HEIGHT*tuioCursor.getY();
//	ofPoint loc = ofPoint(mx,my);

	ofPoint loc = transf_PosTUIO(tuioCursor);

	
	cout << "Point n" << tuioCursor.getSessionId() << " add at " << loc << endl;
    
    handShadow *h1 = new handShadow();
    h1->setup();
    hands.addObject(*h1);
    hands.notifyTouch(loc.x, loc.y,tuioCursor.getSessionId());
   // touchElements.notifyTouch(loc.x, loc.y,tuioCursor.getSessionId());
}
Exemplo n.º 23
0
void ofApp::tuioRemoved(ofxTuioCursor &tuioCursor)
{
    int cursorIndex = getTuioPointIndex(tuioCursor.getSessionId());
    if (cursorIndex >= 0)
    {
        tuioPoints.erase(tuioPoints.begin() + cursorIndex);
    }
}
Exemplo n.º 24
0
//--------------------------------------------------------------
void gFrameApp::tuioUpdated(ofxTuioCursor &cursor)
{
    if(input_tuio)
    {
        GPoint the_point;
        float x,y;
        x = cursor.getX();
        y = cursor.getY();
        
        the_point.setLocation(ofVec2f(x, y));
        the_point.setId(cursor.getFingerId());
        the_point.setStrokeId(cursor.getSessionId());
        the_point.setColor(localBrushColor);
        the_point.setType(TUIO);
        the_point.setStyle(current_style);
        stroke_list.add(the_point);
        
        finger_positions[cursor.getFingerId()] = ofVec2f(x, y);
        //flowfield
        simple_flow.inputUpdate(x, y, cursor.getFingerId());
        simple_flow_2.inputUpdate(x, y, cursor.getFingerId());
        
        ledFrame.stopPulsing();
        ledFrame.updateLastPointsTime();
    }
}
Exemplo n.º 25
0
void menu::tuioRemoved(ofxTuioCursor &tuioCursor){
	//    int mx = W_WIDTH*tuioCursor.getX();
	////    int mx = W_WIDTH*(tuioCursor.getX()+0.5);
	//    int my = W_HEIGHT*tuioCursor.getY();
	//	ofPoint loc = ofPoint(mx,my);
	
	ofPoint loc = transf_PosTUIO(tuioCursor);
    cout << "Point n" << tuioCursor.getSessionId() << " remove at " << loc << endl;
    /*
     if(id_slider1==tuioCursor.getSessionId()) id_slider1=NULL;
     if(id_jumpingRect==tuioCursor.getSessionId()) id_jumpingRect=NULL;
     if(id_moverect==tuioCursor.getSessionId()) id_moverect=NULL;
	 */
    
	//    
    hands.removeObjectByTuioID(tuioCursor.getSessionId() );
   // touchElements.notifyTouchUp( tuioCursor.getSessionId() );
    
}
Exemplo n.º 26
0
void testApp::tuioUpdated(ofxTuioCursor &tuioCursor){
        ofLog()<< "tuioUpdated" << endl;
    int mx = W_WIDTH*tuioCursor.getX();
    int my =    W_HEIGHT*tuioCursor.getY();
	ofPoint loc = ofPoint(tuioCursor.getX()*W_WIDTH,tuioCursor.getY()*W_HEIGHT);
	//cout << "Point n" << tuioCursor.getSessionId() << " updated at " << loc << endl;
    

    //o1.slide(loc.x, loc.y,tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
   // h1.slide(loc.x, loc.y,tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
    touchElements.notifySlide(loc.x, loc.y,tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
    puntoX=tuioCursor.getX();
    puntoY=tuioCursor.getY();
    cout << tuioCursor.getX() << endl;
       
}
Exemplo n.º 27
0
void electromagnetica::tuioAdded(ofxTuioCursor &tuioCursor){
	ofPoint loc = ofPoint(tuioCursor.getX()*W_WIDTH,tuioCursor.getY()*W_HEIGHT);
	//cout << "Point n" << tuioCursor.getSessionId() << " add at " << loc << endl;
    
    
    // o1.touch(loc.x, loc.y,tuioCursor.getSessionId());
    // h1.touch(loc.x, loc.y,tuioCursor.getSessionId());
    
    noiseShadow *h1 = new noiseShadow();
    h1->setup();
    //h1->setColor(colours[(int)( tuioCursor.getSessionId() % colours.size()-1) ]);
   // h1->setColor(ofColor::black);
    hands.addObject(*h1);
    hands.notifyTouch(loc.x, loc.y,tuioCursor.getSessionId());
    //mwave.addPoint(loc.x,loc.y,tuioCursor.getSessionId());
    wavesm.touch(loc.x, loc.y,tuioCursor.getSessionId());
      //  updateMagneticField(100,loc.x,loc.y);

    cheapComm::getInstance()->sendAudio0("/audio/electromagnetism/hand_on_event");
}
Exemplo n.º 28
0
void ofxMtPhoto::tuioAdded(ofxTuioCursor &tuioCursor){
	ofVec2f loc = ofVec2f(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
	
	if (isOver(loc)){
		tCursor c;
		c.idN = tuioCursor.getSessionId();
		c.loc = loc;
		
		// PRIMER dedo sobre la imagen
		if (cursorsOnBorder.size() == 0){	
			cursorsOnBorder.push_back(c);
			
		} // SEGUNDO dedo sobre la imagen
		else if (cursorsOnBorder.size() == 1){
			cursorsOnBorder.push_back(c);
			
			oldLoc[0] = cursorsOnBorder[0].loc;
			oldLoc[1] = cursorsOnBorder[1].loc;
		}
		
	}
}
Exemplo n.º 29
0
void electromagnetica::tuioUpdated(ofxTuioCursor &tuioCursor){
    int mx = W_WIDTH*tuioCursor.getX();
    int my = W_HEIGHT*tuioCursor.getY();

    hands.notifySlide(mx, my,tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
    wavesm.slide(mx,  my,tuioCursor.getSessionId(),tuioCursor.getMotionAccel());
  //  updateMagneticField(100,mx,my);
    
}
Exemplo n.º 30
0
// FINGER UPDATED //////////////////////////////////////////////////////
void testApp::cursorUpdated(ofxTuioCursor & tuioCursor)
{
	int finger_id = tuioCursor.getFingerId();
	pos.x = wFbo * tuioCursor.getX();
	pos.y = hFbo * tuioCursor.getY();
	int x_speed = tuioCursor.getXSpeed();
	int y_speed = tuioCursor.getYSpeed();
	int motion_speed = tuioCursor.getMotionSpeed();
	int motion_accel = tuioCursor.getMotionAccel();
	
	for (list<Finger*>::iterator it=dito_list.begin(); it !=dito_list.end(); ++it) 
	{
		if ( (*it)->get_finger_id() == finger_id) 
		{
			(*it)->update_interrupt(&pos);	
			break;
		}
	}
}