Go to the documentation of this file.00001 #ifndef SPRING_H
00002 #define SPRING_H
00003
00004 #include "Mass.h"
00005 #include <ngl/TransformStack.h>
00006
00007 class Mass;
00008
00009
00010
00018
00022
00023
00024 class Spring
00025 {
00026 public:
00027
00029 Mass* mass1;
00031 Mass* mass2;
00032
00033 Spring(Mass* mass1, Mass* mass2, ngl::TransformStack *_transform);
00034 ~Spring();
00035
00037 void draw();
00038
00041 void correctSpringLength();
00042
00045 void setStiffeness(float _stiffeness) {STIFFENESS = _stiffeness;}
00046
00048 float getStiffeness() {return STIFFENESS;}
00049
00052 void setDamping(float _damping) {DAMPING = _damping;}
00053
00055 float getDamping() {return DAMPING;}
00056
00057
00059 void UpdateSpring();
00060
00061
00062 private:
00064 float m_rest_distance;
00065
00067 float STIFFENESS;
00068
00070 float DAMPING;
00071
00072 ngl::Vector m_velocity;
00073
00074 protected:
00075
00077 ngl::TransformStack *m_transform;
00078
00079
00080 };
00081
00082 #endif //SPRING_H
00083
00084