Mercurial > hg > wabletios
view spring.h @ 1:1d1bf0aac99e
This version was the first submitted to the app store.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Thu, 22 Nov 2012 12:15:19 +0000 |
parents | c667dfe12d47 |
children | d346ddc50f70 |
line wrap: on
line source
/* * spring.h * simplespring * * Created by Robert Tubb on 02/06/2011. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef _SPRINGH #define _SPRINGH #include "2dvector.h" #include "ofMain.h" class Lump; class Spring{ protected: double restLength; double springConst; static double maxForce; static double minForce; static int numSprings; int myIndex; double csquared; TwoVector startPoint; TwoVector endPoint; TwoVector force; Lump * startLumpPtr; Lump * endLumpPtr; bool isInScanPath; public: static bool forcesOn; Spring(); Spring(double aStartx, double aStarty, double aEndx, double aEndy, double aK); void updateEndPoints(); void attachLump(Lump * aLump); void calculateForce(); virtual TwoVector getForce(Lump * aLump); void draw(); void setRestLength(); void setRestLength(double aLength); void setSpringConstant(double aK); double getLength(); void addToScanPath(); void removeFromScanPath(); Lump * getLumpOnOtherEnd(Lump * alump); //void checkStuff(); // interface for scanner double getForceMag(); }; class PressureSpring : public Spring{ public: PressureSpring(); TwoVector getForce(Lump * aLump); }; #endif