• 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
joint.cc
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 
19 #include "joint.h"
20 #include "particle.h"
21 #include "rigidbody.h"
22 #include <cstring>
23 #include <QtGlobal>
24 
25 namespace StepCore {
26 
27 STEPCORE_META_OBJECT(Anchor, QT_TRANSLATE_NOOP("ObjectClass", "Anchor"), QT_TR_NOOP("Anchor: fixes position of the body"), 0,
28  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Joint),
29  STEPCORE_PROPERTY_RW(Object*, body, QT_TRANSLATE_NOOP("PropertyName", "body"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Body"), body, setBody)
30  STEPCORE_PROPERTY_RW(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position"), position, setPosition)
31  STEPCORE_PROPERTY_RW(double, angle, QT_TRANSLATE_NOOP("PropertyName", "angle"), QT_TRANSLATE_NOOP("Units", "rad"), QT_TR_NOOP("Angle"), angle, setAngle))
32 
33 STEPCORE_META_OBJECT(Pin, QT_TRANSLATE_NOOP("ObjectClass", "Pin"), QT_TR_NOOP("Pin: fixes position of a given point on the body"), 0,
34  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Joint),
35  STEPCORE_PROPERTY_RW(Object*, body, QT_TRANSLATE_NOOP("PropertyName", "body"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Body"), body, setBody)
36  STEPCORE_PROPERTY_RW(StepCore::Vector2d, localPosition, QT_TRANSLATE_NOOP("PropertyName", "localPosition"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position on the body"), localPosition, setLocalPosition)
37  STEPCORE_PROPERTY_RW(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position in the world"), position, setPosition))
38 
39 STEPCORE_META_OBJECT(Stick, QT_TRANSLATE_NOOP("ObjectClass", "Stick"), QT_TR_NOOP("Massless stick which can be connected to bodies"), 0,
40  STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Joint),
41  STEPCORE_PROPERTY_RW(double, restLength, QT_TRANSLATE_NOOP("PropertyName", "restLength"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Rest length of the stick"), restLength, setRestLength)
42  STEPCORE_PROPERTY_RW(Object*, body1, QT_TRANSLATE_NOOP("PropertyName", "body1"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Body1"), body1, setBody1)
43  STEPCORE_PROPERTY_RW(Object*, body2, QT_TRANSLATE_NOOP("PropertyName", "body2"), STEPCORE_UNITS_NULL, QT_TR_NOOP("Body2"), body2, setBody2)
44  STEPCORE_PROPERTY_RW(StepCore::Vector2d, localPosition1, QT_TRANSLATE_NOOP("PropertyName", "localPosition1"), QT_TRANSLATE_NOOP("Units", "m"),
45  QT_TR_NOOP("Local position 1"), localPosition1, setLocalPosition1)
46  STEPCORE_PROPERTY_RW(StepCore::Vector2d, localPosition2, QT_TRANSLATE_NOOP("PropertyName", "localPosition2"), QT_TRANSLATE_NOOP("Units", "m"),
47  QT_TR_NOOP("Local position 2"), localPosition2, setLocalPosition2)
48  STEPCORE_PROPERTY_R_D(StepCore::Vector2d, position1, QT_TRANSLATE_NOOP("PropertyName", "position1"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position1"), position1)
49  STEPCORE_PROPERTY_R_D(StepCore::Vector2d, position2, QT_TRANSLATE_NOOP("PropertyName", "position2"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position2"), position2)
50  )
51 
52 STEPCORE_META_OBJECT(Rope, QT_TRANSLATE_NOOP("ObjectClass", "Rope"), QT_TR_NOOP("Massless rope which can be connected to bodies"), 0,
53  STEPCORE_SUPER_CLASS(Stick),)
54 
55 Anchor::Anchor(Object* body, const Vector2d& position, double angle)
56  : _position(position), _angle(angle)
57 {
58  setBody(body);
59  setColor(0xffff0000);
60 }
61 
62 void Anchor::setBody(Object* body)
63 {
64  if(body) {
65  if(body->metaObject()->inherits<Particle>()) {
66  _body = body;
67  _p = static_cast<Particle*>(body);
68  _r = NULL;
69  return;
70  } else if(body->metaObject()->inherits<RigidBody>()) {
71  _body = body;
72  _p = NULL;
73  _r = static_cast<RigidBody*>(body);
74  return;
75  }
76  }
77  _body = NULL;
78  _p = NULL;
79  _r = NULL;
80 }
81 
82 int Anchor::constraintsCount()
83 {
84  if(_p) return 2;
85  else if(_r) return 3;
86  else return 0;
87 }
88 
89 void Anchor::getConstraintsInfo(ConstraintsInfo* info, int offset)
90 {
91  if(_p) {
92  info->value[offset ] = _p->position()[0] - _position[0];
93  info->value[offset+1] = _p->position()[1] - _position[1];
94 
95  info->derivative[offset ] = _p->velocity()[0];
96  info->derivative[offset+1] = _p->velocity()[1];
97 
98  info->jacobian.coeffRef(offset, _p->variablesOffset()+Particle::PositionOffset) = 1;
99  info->jacobian.coeffRef(offset+1, _p->variablesOffset()+Particle::PositionOffset+1) = 1;
100 
101  } else if(_r) {
102  info->value[offset ] = _r->position()[0] - _position[0];
103  info->value[offset+1] = _r->position()[1] - _position[1];
104  info->value[offset+2] = _r->angle() - _angle;
105 
106  info->derivative[offset ] = _r->velocity()[0];
107  info->derivative[offset+1] = _r->velocity()[1];
108  info->derivative[offset+2] = _r->angularVelocity();
109 
110  info->jacobian.coeffRef(offset, _r->variablesOffset()+RigidBody::PositionOffset) = 1;
111  info->jacobian.coeffRef(offset+1, _r->variablesOffset()+RigidBody::PositionOffset+1) = 1;
112  info->jacobian.coeffRef(offset+2, _r->variablesOffset()+RigidBody::AngleOffset) = 1;
113  }
114 }
115 
116 Pin::Pin(Object* body, const Vector2d& localPosition, const Vector2d& position)
117  : _localPosition(localPosition), _position(position)
118 {
119  setBody(body);
120  setColor(0xffff0000);
121 }
122 
123 void Pin::setBody(Object* body)
124 {
125  if(body) {
126  if(body->metaObject()->inherits<Particle>()) {
127  _body = body;
128  _p = static_cast<Particle*>(body);
129  _r = NULL;
130  return;
131  } else if(body->metaObject()->inherits<RigidBody>()) {
132  _body = body;
133  _p = NULL;
134  _r = static_cast<RigidBody*>(body);
135  return;
136  }
137  }
138  _body = NULL;
139  _p = NULL;
140  _r = NULL;
141 }
142 
143 int Pin::constraintsCount()
144 {
145  if(_p) {
146  if(_localPosition.squaredNorm() != 0) return 1; // XXX: add some epsilon here
147  else return 2;
148  } else if(_r) return 2;
149  else return 0;
150 }
151 
152 void Pin::getConstraintsInfo(ConstraintsInfo* info, int offset)
153 {
154  if(_p) {
155  Vector2d r = _p->position() - _position;
156  double lnorm2 = _localPosition.squaredNorm();
157 
158  if(lnorm2 != 0) { // XXX: add some epsilon here
159  info->value[offset] = (r.squaredNorm() - lnorm2)*0.5;
160  info->derivative[offset] = _p->velocity().dot(r);
161 
162  info->jacobian.coeffRef(offset, _p->variablesOffset()+Particle::PositionOffset) = r[0];
163  info->jacobian.coeffRef(offset, _p->variablesOffset()+Particle::PositionOffset+1) = r[1];
164 
165  info->jacobianDerivative.coeffRef(offset,
166  _p->variablesOffset()+Particle::PositionOffset) = _p->velocity()[0];
167  info->jacobianDerivative.coeffRef(offset,
168  _p->variablesOffset()+Particle::PositionOffset+1) = _p->velocity()[1];
169  } else {
170  info->value[offset ] = r[0];
171  info->value[offset+1] = r[1];
172  info->derivative[offset ] = _p->velocity()[0];
173  info->derivative[offset+1] = _p->velocity()[1];
174 
175  info->jacobian.coeffRef(offset, _p->variablesOffset()+Particle::PositionOffset) = 1;
176  info->jacobian.coeffRef(offset+1, _p->variablesOffset()+Particle::PositionOffset+1) = 1;
177  }
178  } else if(_r) {
179  Vector2d r1 = _r->vectorLocalToWorld(_localPosition);
180  Vector2d p1 = _r->position() + r1;
181  Vector2d v1 = _r->velocityWorld(p1);
182  double av = _r->angularVelocity();
183 
184  info->value[offset ] = p1[0] - _position[0];
185  info->value[offset+1] = p1[1] - _position[1];
186  info->derivative[offset ] = v1[0];
187  info->derivative[offset+1] = v1[1];
188 
189  info->jacobian.coeffRef(offset , _r->variablesOffset()+RigidBody::PositionOffset) = 1;
190  info->jacobian.coeffRef(offset , _r->variablesOffset()+RigidBody::AngleOffset) = -r1[1];
191  info->jacobianDerivative.coeffRef(offset , _r->variablesOffset()+RigidBody::AngleOffset) = -av*r1[0];
192  info->jacobian.coeffRef(offset+1, _r->variablesOffset()+RigidBody::PositionOffset+1) = 1;
193  info->jacobian.coeffRef(offset+1, _r->variablesOffset()+RigidBody::AngleOffset) = r1[0];
194  info->jacobianDerivative.coeffRef(offset+1, _r->variablesOffset()+RigidBody::AngleOffset) = -av*r1[1];
195  }
196 
197 }
198 
199 Stick::Stick(double restLength, Object* body1, Object* body2,
200  const Vector2d& localPosition1, const Vector2d& localPosition2)
201  : _restLength(restLength), _localPosition1(localPosition1), _localPosition2(localPosition2)
202 {
203  setColor(0xffff0000);
204  setBody1(body1);
205  setBody2(body2);
206 }
207 
208 void Stick::setBody1(Object* body1)
209 {
210  if(body1) {
211  if(body1->metaObject()->inherits<Particle>()) {
212  _body1 = body1;
213  _p1 = static_cast<Particle*>(body1);
214  _r1 = NULL;
215  return;
216  } else if(body1->metaObject()->inherits<RigidBody>()) {
217  _body1 = body1;
218  _p1 = NULL;
219  _r1 = static_cast<RigidBody*>(body1);
220  return;
221  }
222  }
223  _body1 = NULL;
224  _p1 = NULL;
225  _r1 = NULL;
226 }
227 
228 void Stick::setBody2(Object* body2)
229 {
230  if(body2) {
231  if(body2->metaObject()->inherits<Particle>()) {
232  _body2 = body2;
233  _p2 = static_cast<Particle*>(body2);
234  _r2 = NULL;
235  return;
236  } else if(body2->metaObject()->inherits<RigidBody>()) {
237  _body2 = body2;
238  _p2 = NULL;
239  _r2 = static_cast<RigidBody*>(body2);
240  return;
241  }
242  }
243  _body2 = NULL;
244  _p2 = NULL;
245  _r2 = NULL;
246 }
247 
248 Vector2d Stick::position1() const
249 {
250  if(_p1) return _p1->position() + _localPosition1;
251  else if(_r1) return _r1->pointLocalToWorld(_localPosition1);
252  else return _localPosition1;
253 }
254 
255 Vector2d Stick::position2() const
256 {
257  if(_p2) return _p2->position() + _localPosition2;
258  else if(_r2) return _r2->pointLocalToWorld(_localPosition2);
259  else return _localPosition2;
260 }
261 
262 Vector2d Stick::velocity1() const
263 {
264  if(_p1) return _p1->velocity();
265  else if(_r1) return _r1->velocityLocal(_localPosition1);
266  else return Vector2d::Zero();
267 }
268 
269 Vector2d Stick::velocity2() const
270 {
271  if(_p2) return _p2->velocity();
272  else if(_r2) return _r2->velocityLocal(_localPosition2);
273  else return Vector2d::Zero();
274 }
275 
276 int Stick::constraintsCount()
277 {
278  if(!_body1 && !_body2) return 0;
279 
280  if(_restLength != 0) return 1; // XXX: add some epsilon here
281  else return 2;
282 }
283 
284 void Stick::getConstraintsInfo(ConstraintsInfo* info, int offset)
285 {
286  if(!_body1 && !_body2) return;
287 
288  Vector2d p = position2() - position1();
289  Vector2d v = velocity2() - velocity1();
290 
291  //qDebug("_restLength=%f", _restLength);
292  if(_restLength != 0) {
293  info->value[offset] = (p.squaredNorm() - _restLength*_restLength)*0.5;
294  info->derivative[offset] = p.dot(v);
295 
296  if(p[0] == 0 && p[1] == 0) p[0] = 0.1; //XXX: add epsilon
297 
298  if(_p1) {
299  info->jacobian.coeffRef(offset, _p1->variablesOffset() + Particle::PositionOffset) = ( -p[0]);
300  info->jacobian.coeffRef(offset, _p1->variablesOffset() + Particle::PositionOffset+1) =( -p[1]);
301 
302  info->jacobianDerivative.coeffRef(offset, _p1->variablesOffset() + Particle::PositionOffset) =( -v[0]);
303  info->jacobianDerivative.coeffRef(offset, _p1->variablesOffset() + Particle::PositionOffset+1) =( -v[1]);
304 
305  } else if(_r1) {
306  Vector2d r1 = _r1->vectorLocalToWorld(_localPosition1);
307 
308  info->jacobian.coeffRef(offset, _r1->variablesOffset() + RigidBody::PositionOffset) =( -p[0]);
309  info->jacobian.coeffRef(offset, _r1->variablesOffset() + RigidBody::PositionOffset+1) =( -p[1]);
310  info->jacobian.coeffRef(offset, _r1->variablesOffset() + RigidBody::AngleOffset) =( +p[0]*r1[1] - p[1]*r1[0]);
311 
312  info->jacobianDerivative.coeffRef(offset, _r1->variablesOffset() + RigidBody::PositionOffset) =( -v[0]);
313  info->jacobianDerivative.coeffRef(offset, _r1->variablesOffset() + RigidBody::PositionOffset+1) =( -v[1]);
314  info->jacobianDerivative.coeffRef(offset, _r1->variablesOffset() + RigidBody::AngleOffset) =(
315  + v[0]*r1[1] - v[1]*r1[0] + _r1->angularVelocity()*p.dot(r1));
316  }
317 
318  if(_p2) {
319  info->jacobian.coeffRef(offset, _p2->variablesOffset() + Particle::PositionOffset) =( p[0]);
320  info->jacobian.coeffRef(offset, _p2->variablesOffset() + Particle::PositionOffset+1) =( p[1]);
321 
322  info->jacobianDerivative.coeffRef(offset, _p2->variablesOffset() + Particle::PositionOffset) =( v[0]);
323  info->jacobianDerivative.coeffRef(offset, _p2->variablesOffset() + Particle::PositionOffset+1) =( v[1]);
324 
325  } else if(_r2) {
326  Vector2d r2 = _r2->vectorLocalToWorld(_localPosition2);
327 
328  info->jacobian.coeffRef(offset, _r2->variablesOffset() + RigidBody::PositionOffset) =( p[0]);
329  info->jacobian.coeffRef(offset, _r2->variablesOffset() + RigidBody::PositionOffset+1) =( p[1]);
330  info->jacobian.coeffRef(offset, _r2->variablesOffset() + RigidBody::AngleOffset) =( -p[0]*r2[1] + p[1]*r2[0]);
331 
332  info->jacobianDerivative.coeffRef(offset, _r2->variablesOffset() + RigidBody::PositionOffset) =( v[0]);
333  info->jacobianDerivative.coeffRef(offset, _r2->variablesOffset() + RigidBody::PositionOffset+1) =( v[1]);
334  info->jacobianDerivative.coeffRef(offset, _r2->variablesOffset() + RigidBody::AngleOffset) =(
335  - v[0]*r2[1] + v[1]*r2[0] - _r2->angularVelocity()*p.dot(r2));
336  }
337 
338  } else {
339  info->value[offset ] = p[0];
340  info->value[offset+1] = p[1];
341 
342  info->derivative[offset ] = v[0];
343  info->derivative[offset+1] = v[1];
344 
345  if(_p1) {
346  info->jacobian.coeffRef(offset , _p1->variablesOffset() + Particle::PositionOffset) = -1;
347  info->jacobian.coeffRef(offset+1, _p1->variablesOffset() + Particle::PositionOffset+1) = -1;
348 
349  } else if(_r1) {
350  Vector2d r1 = _r1->vectorLocalToWorld(_localPosition1);
351  double av = _r1->angularVelocity();
352 
353  info->jacobian.coeffRef(offset , _r1->variablesOffset() + Particle::PositionOffset) =( -1);
354  info->jacobian.coeffRef(offset+1, _r1->variablesOffset() + Particle::PositionOffset+1) =( -1);
355 
356  info->jacobian.coeffRef(offset , _r1->variablesOffset()+RigidBody::AngleOffset) =( +r1[1]);
357  info->jacobian.coeffRef(offset+1, _r1->variablesOffset()+RigidBody::AngleOffset) =( -r1[0]);
358  info->jacobianDerivative.coeffRef(offset , _r1->variablesOffset()+RigidBody::AngleOffset) =( +av*r1[0]);
359  info->jacobianDerivative.coeffRef(offset+1, _r1->variablesOffset()+RigidBody::AngleOffset) =( +av*r1[1]);
360  }
361 
362  if(_p2) {
363  info->jacobian.coeffRef(offset , _p2->variablesOffset() + Particle::PositionOffset) =( 1);
364  info->jacobian.coeffRef(offset+1, _p2->variablesOffset() + Particle::PositionOffset+1) =( 1);
365 
366  } else if(_r2) {
367  Vector2d r2 = _r2->vectorLocalToWorld(_localPosition2);
368  double av = _r2->angularVelocity();
369 
370  info->jacobian.coeffRef(offset , _r2->variablesOffset() + Particle::PositionOffset) =( 1);
371  info->jacobian.coeffRef(offset+1, _r2->variablesOffset() + Particle::PositionOffset+1) =( 1);
372 
373  info->jacobian.coeffRef(offset , _r2->variablesOffset()+RigidBody::AngleOffset) =( -r2[1]);
374  info->jacobian.coeffRef(offset+1, _r2->variablesOffset()+RigidBody::AngleOffset) =( +r2[0]);
375  info->jacobianDerivative.coeffRef(offset , _r2->variablesOffset()+RigidBody::AngleOffset) =( -av*r2[0]);
376  info->jacobianDerivative.coeffRef(offset+1, _r2->variablesOffset()+RigidBody::AngleOffset) =( -av*r2[1]);
377  }
378  }
379 }
380 
381 void Rope::getConstraintsInfo(ConstraintsInfo* info, int offset)
382 {
383  if(!_body1 && !_body2) return;
384 
385  Vector2d p = position2() - position1();
386  Vector2d v = velocity2() - velocity1();
387 
388  if(_restLength != 0) {
389  if(p.norm() >= _restLength) { // rope is in tension
390  Stick::getConstraintsInfo(info, offset);
391  info->forceMax[offset] = 0;
392  } else { // rope is free
393  info->value[offset] = 0;
394  info->derivative[offset] = 0;
395  }
396  } else {
397  Stick::getConstraintsInfo(info, offset);
398  }
399 }
400 
401 } // namespace StepCore
402 
403 
StepCore::Anchor::_r
RigidBody * _r
Definition: joint.h:72
StepCore::ConstraintsInfo::jacobianDerivative
DynSparseRowMatrix jacobianDerivative
Time-derivative of constraintsJacobian.
Definition: world.h:226
rigidbody.h
RigidBody class.
StepCore::Body
Interface for bodies.
Definition: world.h:138
StepCore::Anchor::_position
Vector2d _position
Definition: joint.h:68
StepCore::ConstraintsInfo::value
VectorXd value
Current constarints values (amount of brokenness)
Definition: world.h:223
StepCore::RigidBody::velocityWorld
Vector2d velocityWorld(const Vector2d &worldPoint) const
Get velocity of given (world) point on the body.
Definition: rigidbody.cc:189
StepCore::RigidBody::AngleOffset
Offset of body angle in variables array.
Definition: rigidbody.h:151
StepCore::Stick::velocity2
Vector2d velocity2() const
Velocity of the second end of the stick.
Definition: joint.cc:269
StepCore::RigidBody::PositionOffset
Offset of body position in variables array.
Definition: rigidbody.h:150
StepCore::Anchor::_p
Particle * _p
Definition: joint.h:71
StepCore::Vector2d
Eigen::Vector2d Vector2d
Two-dimensional vector with double components.
Definition: vector.h:29
StepCore::Pin::getConstraintsInfo
void getConstraintsInfo(ConstraintsInfo *info, int offset)
Fill the part of constraints information structure starting at offset.
Definition: joint.cc:152
StepCore::RigidBody::angularVelocity
double angularVelocity() const
Get angular velocity of the body.
Definition: rigidbody.h:179
StepCore::Anchor
Fixes position of the body.
Definition: joint.h:37
StepCore::Object
Root of the StepCore classes hierarchy.
Definition: object.h:57
StepCore::Stick::velocity1
Vector2d velocity1() const
Velocity of the first end of the stick.
Definition: joint.cc:262
StepCore::Stick::setBody2
void setBody2(Object *body2)
Set pointer to the second connected body.
Definition: joint.cc:228
StepCore::Stick::_localPosition1
Vector2d _localPosition1
Definition: joint.h:186
StepCore::RigidBody::position
const Vector2d & position() const
Get position of the center of mass of the body.
Definition: rigidbody.h:160
StepCore::Pin::body
Object * body() const
Get pointer to the body.
Definition: joint.h:88
StepCore::Stick::getConstraintsInfo
void getConstraintsInfo(ConstraintsInfo *info, int offset)
Fill the part of constraints information structure starting at offset.
Definition: joint.cc:284
StepCore::STEPCORE_SUPER_CLASS
STEPCORE_SUPER_CLASS(CollisionSolver)
StepCore::Stick::position1
Vector2d position1() const
Position of the first end of the stick.
Definition: joint.cc:248
StepCore::RigidBody::vectorLocalToWorld
Vector2d vectorLocalToWorld(const Vector2d &v) const
Translate local vector on body to world vector.
Definition: rigidbody.cc:217
StepCore::RigidBody
Rigid body.
Definition: rigidbody.h:144
StepCore::Stick::body1
Object * body1() const
Get pointer to the first connected body.
Definition: joint.h:137
StepCore::Anchor::_body
Object * _body
Definition: joint.h:67
StepCore::ConstraintsInfo::jacobian
DynSparseRowMatrix jacobian
Position-derivative of constraints values.
Definition: world.h:225
StepCore::QT_TRANSLATE_NOOP
QT_TRANSLATE_NOOP("ObjectClass","GJKCollisionSolver")
StepCore::Pin::Pin
Pin(Object *body=0, const Vector2d &localPosition=Vector2d::Zero(), const Vector2d &position=Vector2d::Zero())
Constructs Pin.
Definition: joint.cc:116
StepCore::Item::setColor
void setColor(Color color)
Set item color (for use in GUI)
Definition: world.h:112
StepCore::Stick::Stick
Stick(double restLength=1, Object *body1=0, Object *body2=0, const Vector2d &localPosition1=Vector2d::Zero(), const Vector2d &localPosition2=Vector2d::Zero())
Constructs Stick.
Definition: joint.cc:199
StepCore::Stick::_r2
RigidBody * _r2
Definition: joint.h:192
StepCore::ConstraintsInfo::forceMax
VectorXd forceMax
Constraints force upper limit.
Definition: world.h:234
StepCore::Stick::body2
Object * body2() const
Get pointer to the second connected body.
Definition: joint.h:142
StepCore::Rope::getConstraintsInfo
void getConstraintsInfo(ConstraintsInfo *info, int offset)
Fill the part of constraints information structure starting at offset.
Definition: joint.cc:381
StepCore::Stick::_p1
Particle * _p1
Definition: joint.h:189
StepCore::Item
The root class for any world items (bodies and forces)
Definition: world.h:69
StepCore::RigidBody::pointLocalToWorld
Vector2d pointLocalToWorld(const Vector2d &p) const
Translate local coordinates on body to world coordinates.
Definition: rigidbody.cc:201
joint.h
Joint classes.
StepCore::Particle::PositionOffset
Offset of particle position in variables array.
Definition: particle.h:109
StepCore::ConstraintsInfo::derivative
VectorXd derivative
Time-derivative of constraints values.
Definition: world.h:224
StepCore::Anchor::constraintsCount
int constraintsCount()
Get count of constraints.
Definition: joint.cc:82
StepCore::Pin::_r
RigidBody * _r
Definition: joint.h:114
StepCore::Anchor::getConstraintsInfo
void getConstraintsInfo(ConstraintsInfo *info, int offset)
Fill the part of constraints information structure starting at offset.
Definition: joint.cc:89
StepCore::RigidBody::velocity
const Vector2d & velocity() const
Get velocity of the center of mass of the body.
Definition: rigidbody.h:170
StepCore::RigidBody::velocityLocal
Vector2d velocityLocal(const Vector2d &localPoint) const
Get velocity of given (local) point on the body.
Definition: rigidbody.cc:195
StepCore::QT_TR_NOOP
QT_TR_NOOP("Errors class for CoulombForce")
StepCore::Pin::_p
Particle * _p
Definition: joint.h:113
StepCore::STEPCORE_PROPERTY_RW
STEPCORE_PROPERTY_RW(double, depth, QT_TRANSLATE_NOOP("PropertyName","depth"), QT_TRANSLATE_NOOP("Units","J"), QT_TR_NOOP("Potential depth"), depth, setDepth) STEPCORE_PROPERTY_RW(double
StepCore::Stick::setBody1
void setBody1(Object *body1)
Set pointer to the first connected body.
Definition: joint.cc:208
StepCore::Stick::_localPosition2
Vector2d _localPosition2
Definition: joint.h:187
StepCore::Pin::_body
Object * _body
Definition: joint.h:109
StepCore::Pin::constraintsCount
int constraintsCount()
Get count of constraints.
Definition: joint.cc:143
StepCore::Stick::_body2
Object * _body2
Definition: joint.h:185
StepCore::Stick::_restLength
double _restLength
Definition: joint.h:183
StepCore::Anchor::_angle
double _angle
Definition: joint.h:69
StepCore::Anchor::body
Object * body() const
Get pointer to the body.
Definition: joint.h:46
StepCore::Particle
Particle with mass.
Definition: particle.h:103
STEPCORE_UNITS_NULL
#define STEPCORE_UNITS_NULL
Definition: object.h:365
StepCore::Anchor::setBody
void setBody(Object *body)
Set pointer to the body.
Definition: joint.cc:62
StepCore::STEPCORE_PROPERTY_R_D
setRmin setRminVariance STEPCORE_PROPERTY_R_D(double, rectPressureVariance, QT_TRANSLATE_NOOP("PropertyName","rectPressureVariance"), QT_TRANSLATE_NOOP("Units","Pa"), QT_TR_NOOP("Variance of pressure of particles in the measureRect"), rectPressureVariance) STEPCORE_PROPERTY_R_D(double
StepCore::Stick::_body1
Object * _body1
Definition: joint.h:184
StepCore::Rope
Massless rope: maximal distance between two points on particles or rigid bodies.
Definition: joint.h:198
particle.h
Particle and ChargedParticle classes.
StepCore::RigidBody::angle
double angle() const
Get angle of the body.
Definition: rigidbody.h:165
StepCore::Particle::position
const Vector2d & position() const
Get position of the particle.
Definition: particle.h:117
StepCore::STEPCORE_META_OBJECT
STEPCORE_META_OBJECT(CollisionSolver, QT_TRANSLATE_NOOP("ObjectClass","CollisionSolver"),"CollisionSolver", MetaObject::ABSTRACT, STEPCORE_SUPER_CLASS(Object), STEPCORE_PROPERTY_RW(double, toleranceAbs, QT_TRANSLATE_NOOP("PropertyName","toleranceAbs"), STEPCORE_UNITS_1, QT_TR_NOOP("Allowed absolute tolerance"), toleranceAbs, setToleranceAbs) STEPCORE_PROPERTY_R_D(double, localError, QT_TRANSLATE_NOOP("PropertyName","localError"), STEPCORE_UNITS_1, QT_TR_NOOP("Maximal local error during last step"), localError)) STEPCORE_META_OBJECT(GJKCollisionSolver
StepCore::Pin::_localPosition
Vector2d _localPosition
Definition: joint.h:110
StepCore::Stick::position2
Vector2d position2() const
Position of the second end of the stick.
Definition: joint.cc:255
StepCore::Body::variablesOffset
int variablesOffset() const
Offset of body's variables in global arrays (meaningless if the body is not a part of the world) ...
Definition: world.h:181
StepCore::Particle::velocity
const Vector2d & velocity() const
Get velocity of the particle.
Definition: particle.h:122
StepCore::Pin::setBody
void setBody(Object *body)
Set pointer to the body.
Definition: joint.cc:123
StepCore::ConstraintsInfo
Constraints information structure XXX: Move it to constraintsolver.h.
Definition: world.h:216
StepCore::Pin::_position
Vector2d _position
Definition: joint.h:111
StepCore::Stick::_p2
Particle * _p2
Definition: joint.h:190
StepCore::Stick::constraintsCount
int constraintsCount()
Get count of constraints.
Definition: joint.cc:276
StepCore::Stick::_r1
RigidBody * _r1
Definition: joint.h:191
StepCore::Stick
Massless stick: fixed distance between two points on particles or rigid bodies.
Definition: joint.h:120
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