示例#1
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);
    
}
示例#2
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");
    
}
示例#3
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() );

}
示例#4
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());
}
示例#5
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);
}
示例#6
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();
}
示例#7
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();
    }
}
示例#8
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());
}
示例#9
0
void ofApp::tuioRemoved(ofxTuioCursor &tuioCursor)
{
    int cursorIndex = getTuioPointIndex(tuioCursor.getSessionId());
    if (cursorIndex >= 0)
    {
        tuioPoints.erase(tuioPoints.begin() + cursorIndex);
    }
}
示例#10
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() );
    
}
示例#11
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");
}
示例#12
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());
}
示例#13
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());
}
示例#14
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;
       
}
示例#15
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;
		}
		
	}
}
示例#16
0
void Touch::tuioRemoved(ofxTuioCursor &tuioCursor){
    ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
    ofLog(OF_LOG_VERBOSE) << "Point n" << tuioCursor.getSessionId() << " remove at " << loc << endl;
     ofNotifyMouseReleased(loc.x, loc.y, 0);
   lastMoved = ofGetUnixTime();
}
示例#17
0
void testApp::tuioRemoved(ofxTuioCursor &tuioCursor){
	ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
	cout << "Point n" << tuioCursor.getSessionId() << " remove at " << loc << endl;
}
示例#18
0
void testApp::tuioUpdated(ofxTuioCursor &tuioCursor){
	addParticle(tuioCursor.getX()*screenWidth,tuioCursor.getY()*screenHeight,tuioCursor.getSessionId());
}
示例#19
0
void ofxMtPhoto::tuioUpdated(ofxTuioCursor &tuioCursor){
	ofVec2f loc = ofVec2f(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
	
	if ( isOver(loc) ){
		
		// ACTUALIZA la LOCacion de los dedos grabados
		for ( int i = 0; i < cursorsOnBorder.size(); i++)
			if (cursorsOnBorder[i].idN == tuioCursor.getSessionId())
				cursorsOnBorder[i].loc = loc;
		
		// Si hay un sólo dedo -> mueve la imagen
		if (cursorsOnBorder.size() == 1 )
		{
//			ofVec2f newForce = cursorsOnBorder[0].loc - oldLoc[0];
//			newForce.normalize();	// Lo normalizo para q la velocidad no se dispare
//			acc += newForce;

//			oldLoc[0] = cursorsOnBorder[0].loc;
			pos = loc;						
		} // Si hay dos Dedos -> gira, escala y mueve
		else if (cursorsOnBorder.size() == 2)
		{
			vel *= 0.5;	// Si lo agarra con dos dedos frena la velocidad que tenía de forma dramática
			
			int sta = -1;	// algo como un NULL parameter
			int din = -1;	// algo como un NULL parameter
			
			// encuentra cual es el estático y el dinámico
			for ( int i = 0; i < cursorsOnBorder.size(); i++)
				if (cursorsOnBorder[i].loc == oldLoc[i]) 
					sta = i;
				else 
					din = i;
			
			// una vez encontrados, calcula las transformaciones
			if ((sta != -1) && (din != -1) && (din != sta)){
				// Recupera la Direccion, distancia y rotacion VIEJA
				ofVec2f Di = oldLoc[sta] - oldLoc[din];
				float di = Di.length();
				float ri = -1*atan2(Di.x,Di.y)+(PI/2);
				
				// Obtiene la Direccion, distancia y rotacion NUEVA
				ofVec2f Dii = oldLoc[sta] - cursorsOnBorder[din].loc;
				float dii = Dii.length();
				float rii = -1*atan2(Dii.x,Dii.y)+(PI/2);
				
				// Calcula el porcentaje ( de 0 a 1) de re-escalamiento
				float scaleF = dii / di; // (<#float value#>, , <#float inputMax#>, <#float outputMin#>, <#float outputMax#>, <#bool clamp#>) ;
				
				// Calcula los grados de rotación
				float rotateF = rii - ri;
				
				// Calcula el desplazamiento a partir de coordenadas polares.
				ofVec2f oldStaCursorToCenter = pos - oldLoc[sta] ;
				float oldAngleToCenter = -1*atan2(oldStaCursorToCenter.x,oldStaCursorToCenter.y)+(PI/2);
				float oldRadioToCenter = oldStaCursorToCenter.length();	
				
				float newRadioToCenter = oldRadioToCenter * scaleF;
				float newAngleToCenter = oldAngleToCenter + rotateF;
				ofVec2f newStaCursorToCenter = ofVec2f(newRadioToCenter*cos(newAngleToCenter),newRadioToCenter*sin(newAngleToCenter));
				
				// Actualiza los valores
				resize(scaleF);							
				rotate(rotateF);
				
				pos = oldLoc[sta] + newStaCursorToCenter;
			}
			
			oldLoc[0] = cursorsOnBorder[0].loc;
			oldLoc[1] = cursorsOnBorder[1].loc;
		}
	}
}