• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

step/stepcore

motor.h

Go to the documentation of this file.
00001 /* This file is part of StepCore library.
00002    Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
00003 
00004    StepCore library is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2 of the License, or
00007    (at your option) any later version.
00008 
00009    StepCore library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with StepCore; if not, write to the Free Software
00016    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 */
00018 
00023 #ifndef STEPCORE_MOTOR_H
00024 #define STEPCORE_MOTOR_H
00025 
00026 #include "world.h"
00027 #include "object.h"
00028 #include "constants.h"
00029 #include "types.h"
00030 
00031 
00032 namespace StepCore
00033 {
00034 
00035 class Particle;
00036 class RigidBody;
00037 
00041 class LinearMotor: public Item, public Force
00042 {
00043     STEPCORE_OBJECT(LinearMotor)
00044 
00045 public:
00047     explicit LinearMotor(Object* body = 0, const Vector2d& localPosition = Vector2d(0),
00048                         Vector2d forceValue = Vector2d(0));
00049 
00050     void calcForce(bool calcVariances);
00051 
00053     Object* body() const { return _body; }
00055     void setBody(Object* body);
00056 
00059     const Vector2d& localPosition() const { return _localPosition; }
00062     void setLocalPosition(const Vector2d& localPosition) { _localPosition = localPosition; }
00063 
00065     Vector2d position() const;
00066 
00068     const Vector2d& forceValue() const { return _forceValue; }
00070     void setForceValue(const Vector2d& forceValue) { _forceValue = forceValue; }
00071 
00072     //void worldItemRemoved(Item* item);
00073     //void setWorld(World* world);
00074         
00075 protected:
00076     Object*  _body;
00077     Vector2d _localPosition;
00078     Vector2d _forceValue;
00079 
00080     Particle*  _p;
00081     RigidBody* _r;
00082 };
00083 
00087 class CircularMotor: public Item, public Force
00088 {
00089     STEPCORE_OBJECT(CircularMotor)
00090 
00091 public:
00093     explicit CircularMotor(Object* body = 0, const Vector2d& localPosition = Vector2d(0),
00094                                             double torqueValue = 0);
00095 
00096     void calcForce(bool calcVariances);
00097 
00099     Object* body() const { return _body; }
00101     void setBody(Object* body);
00102 
00105     Vector2d localPosition() const;
00108     void setLocalPosition(const Vector2d& localPosition) {
00109         _localPosition = localPosition;
00110     }
00111 
00113     Vector2d position() const;
00114 
00116     double torqueValue() const { return _torqueValue; }
00118     void setTorqueValue(const double torqueValue) { _torqueValue = torqueValue; }
00119 
00120     //void worldItemRemoved(Item* item);
00121     //void setWorld(World* world);
00122         
00123 protected:
00124     Object*  _body;
00125     Vector2d _localPosition;
00126     double   _torqueValue;
00127 
00128     RigidBody* _r;
00129 };
00130 
00131 
00132 } // namespace StepCore
00133 
00134 #endif
00135 

step/stepcore

Skip menu "step/stepcore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal