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

step/stepcore

  • sources
  • kde-4.12
  • kdeedu
  • step
  • stepcore
motor.h
Go to the documentation of this file.
1 /* This file is part of StepCore library.
2  Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
3 
4  StepCore library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  StepCore library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with StepCore; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
23 #ifndef STEPCORE_MOTOR_H
24 #define STEPCORE_MOTOR_H
25 
26 #include "world.h"
27 #include "object.h"
28 #include "constants.h"
29 #include "types.h"
30 
31 
32 namespace StepCore
33 {
34 
35 class Particle;
36 class RigidBody;
37 
41 class LinearMotor: public Item, public Force
42 {
43  STEPCORE_OBJECT(LinearMotor)
44 
45 public:
47  explicit LinearMotor(Object* body = 0, const Vector2d& localPosition = Vector2d::Zero(),
48  Vector2d forceValue = Vector2d::Zero());
49 
50  void calcForce(bool calcVariances);
51 
53  Object* body() const { return _body; }
55  void setBody(Object* body);
56 
59  const Vector2d& localPosition() const { return _localPosition; }
62  void setLocalPosition(const Vector2d& localPosition) { _localPosition = localPosition; }
63 
65  Vector2d position() const;
66 
68  const Vector2d& forceValue() const { return _forceValue; }
70  void setForceValue(const Vector2d& forceValue) { _forceValue = forceValue; }
71 
72  //void worldItemRemoved(Item* item);
73  //void setWorld(World* world);
74 
75 protected:
76  Object* _body;
77  Vector2d _localPosition;
78  Vector2d _forceValue;
79 
80  Particle* _p;
81  RigidBody* _r;
82 };
83 
87 class CircularMotor: public Item, public Force
88 {
89  STEPCORE_OBJECT(CircularMotor)
90 
91 public:
93  explicit CircularMotor(Object* body = 0, const Vector2d& localPosition = Vector2d::Zero(),
94  double torqueValue = 0);
95 
96  void calcForce(bool calcVariances);
97 
99  Object* body() const { return _body; }
101  void setBody(Object* body);
102 
105  Vector2d localPosition() const;
108  void setLocalPosition(const Vector2d& localPosition) {
109  _localPosition = localPosition;
110  }
111 
113  Vector2d position() const;
114 
116  double torqueValue() const { return _torqueValue; }
118  void setTorqueValue(const double torqueValue) { _torqueValue = torqueValue; }
119 
120  //void worldItemRemoved(Item* item);
121  //void setWorld(World* world);
122 
123 protected:
124  Object* _body;
125  Vector2d _localPosition;
126  double _torqueValue;
127 
128  RigidBody* _r;
129 };
130 
131 
132 } // namespace StepCore
133 
134 #endif
135 
StepCore::LinearMotor::position
Vector2d position() const
Position of the motor.
Definition: motor.cc:76
StepCore::CircularMotor
Circular motor: applies a torque to the body.
Definition: motor.h:87
types.h
Type to and from string convertion helpers.
StepCore::LinearMotor::_p
Particle * _p
Definition: motor.h:80
StepCore::CircularMotor::CircularMotor
CircularMotor(Object *body=0, const Vector2d &localPosition=Vector2d::Zero(), double torqueValue=0)
Constructs CircularMotor.
Definition: motor.cc:102
StepCore::CircularMotor::_r
RigidBody * _r
Definition: motor.h:128
StepCore::LinearMotor::localPosition
const Vector2d & localPosition() const
Local position of the motor on the body or in the world (if the motor is not connected) ...
Definition: motor.h:59
StepCore::Vector2d
Eigen::Vector2d Vector2d
Two-dimensional vector with double components.
Definition: vector.h:29
StepCore::Object
Root of the StepCore classes hierarchy.
Definition: object.h:57
constants.h
Constants class.
StepCore::CircularMotor::localPosition
Vector2d localPosition() const
Local position of the motor on the body or in the world (if the motor is not connected) ...
Definition: motor.cc:127
StepCore::LinearMotor::_r
RigidBody * _r
Definition: motor.h:81
StepCore::RigidBody
Rigid body.
Definition: rigidbody.h:144
StepCore::CircularMotor::_torqueValue
double _torqueValue
Definition: motor.h:126
world.h
Item, Body, Force and Tool interfaces, World class.
StepCore::LinearMotor::_forceValue
Vector2d _forceValue
Definition: motor.h:78
StepCore::LinearMotor::calcForce
void calcForce(bool calcVariances)
Calculate force.
Definition: motor.cc:48
StepCore::CircularMotor::setTorqueValue
void setTorqueValue(const double torqueValue)
Set torque value.
Definition: motor.h:118
StepCore::Item
The root class for any world items (bodies and forces)
Definition: world.h:69
StepCore::CircularMotor::torqueValue
double torqueValue() const
Get torque value.
Definition: motor.h:116
StepCore::CircularMotor::_localPosition
Vector2d _localPosition
Definition: motor.h:125
StepCore::LinearMotor::LinearMotor
LinearMotor(Object *body=0, const Vector2d &localPosition=Vector2d::Zero(), Vector2d forceValue=Vector2d::Zero())
Constructs LinearMotor.
StepCore::CircularMotor::calcForce
void calcForce(bool calcVariances)
Calculate force.
Definition: motor.cc:109
StepCore::CircularMotor::setLocalPosition
void setLocalPosition(const Vector2d &localPosition)
Set local position of the motor on the body or in the world (if the motor is not connected) ...
Definition: motor.h:108
StepCore::Force
Interface for forces.
Definition: world.h:199
StepCore::LinearMotor::setForceValue
void setForceValue(const Vector2d &forceValue)
Set force value.
Definition: motor.h:70
StepCore::CircularMotor::_body
Object * _body
Definition: motor.h:124
StepCore::Particle
Particle with mass.
Definition: particle.h:103
StepCore::LinearMotor::body
Object * body() const
Get pointer to the body.
Definition: motor.h:53
object.h
Object, MetaObject and MetaProperty classes.
StepCore::LinearMotor::_body
Object * _body
Definition: motor.h:76
StepCore::LinearMotor
Linear motor: applies a force at given position on the body.
Definition: motor.h:41
StepCore::LinearMotor::_localPosition
Vector2d _localPosition
Definition: motor.h:77
StepCore::CircularMotor::setBody
void setBody(Object *body)
Set pointer to the connected body.
Definition: motor.cc:114
StepCore::LinearMotor::setLocalPosition
void setLocalPosition(const Vector2d &localPosition)
Set local position of the motor on the body or in the world (if the motor is not connected) ...
Definition: motor.h:62
STEPCORE_OBJECT
#define STEPCORE_OBJECT(_className)
Definition: object.h:49
StepCore::CircularMotor::position
Vector2d position() const
Position of the motor.
Definition: motor.cc:133
StepCore::CircularMotor::body
Object * body() const
Get pointer to the body.
Definition: motor.h:99
StepCore::LinearMotor::setBody
void setBody(Object *body)
Set pointer to the connected body.
Definition: motor.cc:56
StepCore::LinearMotor::forceValue
const Vector2d & forceValue() const
Get force value.
Definition: motor.h:68
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:43:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

step/stepcore

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

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal