view globalForces.h @ 15:d5758530a039 tip

oF0.84 Retina, and iPhone support
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 12 May 2015 15:48:52 +0100
parents 0e03760cf2d9
children
line wrap: on
line source
//
//  globalForces.h
//  wablet
//
//  Created by Robert Tubb on 18/07/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//
#ifndef _GLOBALFORCES
#define _GLOBALFORCES

#include "2dvector.h"
#include "ofMain.h"
#include "json.h"
#include "ofxiPhone.h"
#include "ofxiPhoneExtras.h"
#include <list>

struct forceTouchPoint{
    double x, y;
    int tid;

    //forceTouchPoint(double ax,double ay,int atid): x(ax),y(ay),tid(atid){};
    
};

class GlobalForces{

public: 

    enum excitationTypes {POSITION,VELOCITY};
    enum excitationShapes {NOISE,GAUSS,SINE};

    excitationTypes excitationType;
    excitationShapes excitationShape;
    
    bool gravityOn, forceTouchOn, pressureOn;
    // params for adjusting stuff
    double pressureAmt, gravityAmt, touchStrength, excitationStrength, homingAmt, avFilterAmt;
    int exciteShapeX, exciteShapeY;
    // general params
    double speedLimit, wallBounce;
    double delt; // time step between frames not used really
    double volume;
    
    forceTouchPoint* forceTouchPoints;
    TwoVector grav;
    double pressure;
    
    int maxForcePoints;
    
    GlobalForces();
    ~GlobalForces();
    void update();
    void setPressure(double aP);
    void createForceTouchPoint(double ax,double ay, int touchId);
    void moveForceTouchPoint(double ax,double ay, int touchId);
    void removeForceTouchPoint(int touchId);
    TwoVector getAllForceAt(double ax, double ay);
    
    Json::Value convertToJsonForSaving();
    void setFromJson(Json::Value jgf);
};


#endif