Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

MassSpringSystem.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_MASSSPRINGSYSTEM_H 00012 #define OPENCAL_MASSSPRINGSYSTEM_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 #include <OpenCAL/PhysicsSystem.h> 00017 #include <OpenCAL/TriangleMesh.h> 00018 00019 namespace OpenCAL 00020 { 00021 // Forward declarations 00022 class PointMass; 00023 class Spring; 00024 00025 00032 class OPENCAL_API MassSpringSystem: public PhysicsSystem 00033 { 00034 protected: 00035 // Member variables 00036 TriangleMesh m_surface; 00037 00038 public: 00039 // Constructors and destructor 00040 MassSpringSystem(System *parent); 00041 virtual ~MassSpringSystem(); 00042 00043 // Get functions 00044 PointMass *getPoint(unsigned int i) { return (PointMass *) m_objects[i]; } 00045 const PointMass *getPoint(unsigned int i) const { return (const PointMass *) m_objects[i]; } 00046 Spring *getSpring(unsigned int i) { return (Spring *) m_actors[i]; } 00047 const Spring *getSpring(unsigned int i) const { return (const Spring *) m_actors[i]; } 00048 const TriangleMesh &getSurface() const { return m_surface; } 00049 TriangleMesh *getSurfaceP() { return &m_surface; } 00050 00051 // Set functions 00052 void setMass(float mass); 00053 void setMassEach(float mass); 00054 void setStiffness(float stiffness); 00055 void setDamping(float damping); 00056 00057 // Step functions 00058 virtual void step(float deltaSeconds); 00059 00060 // Other functions 00061 virtual void initialize(); 00062 virtual void render(); 00063 virtual void renderPicking(); 00064 /* 00065 #ifdef USE_OPENGL 00066 virtual void drawPickGL(); 00067 #endif // USE_OPENGL 00068 */ 00069 00070 protected: 00071 // Protected functions 00072 void integrate(float deltaSeconds); 00073 }; 00074 } 00075 00076 #endif // OPENCAL_MASSSPRINGSYSTEM_H

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8