step/stepcore
rigidbody.cc
Go to the documentation of this file.
27 STEPCORE_META_OBJECT(RigidBody, QT_TRANSLATE_NOOP("ObjectClass", "RigidBody"), QT_TR_NOOP("Generic rigid body"), 0, STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Body),
28 STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, position, QT_TRANSLATE_NOOP("PropertyName", "position"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Position of the center of mass"), position, setPosition)
29 STEPCORE_PROPERTY_RW_D(double, angle, QT_TRANSLATE_NOOP("PropertyName", "angle"), QT_TRANSLATE_NOOP("Units", "rad"), QT_TR_NOOP("Rotation angle"), angle, setAngle)
31 STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, velocity, QT_TRANSLATE_NOOP("PropertyName", "velocity"), QT_TRANSLATE_NOOP("Units", "m/s"), QT_TR_NOOP("Velocity of the center of mass"), velocity, setVelocity)
32 STEPCORE_PROPERTY_RW_D(double, angularVelocity, QT_TRANSLATE_NOOP("PropertyName", "angularVelocity"), QT_TRANSLATE_NOOP("Units", "rad/s"), QT_TR_NOOP("Angular velocity of the body"), angularVelocity, setAngularVelocity)
34 STEPCORE_PROPERTY_R_D(StepCore::Vector2d, acceleration, QT_TRANSLATE_NOOP("PropertyName", "acceleration"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "m/s²")),
36 STEPCORE_PROPERTY_R_D(double, angularAcceleration, QT_TRANSLATE_NOOP("PropertyName", "angularAcceleration"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "rad/s²")),
39 STEPCORE_PROPERTY_R_D(StepCore::Vector2d, force, QT_TRANSLATE_NOOP("PropertyName", "force"), QT_TRANSLATE_NOOP("Units", "N"), QT_TR_NOOP("Force that acts upon the body"), force)
40 STEPCORE_PROPERTY_R_D(double, torque, QT_TRANSLATE_NOOP("PropertyName", "torque"), QT_TRANSLATE_NOOP("Units", "N m"), QT_TR_NOOP("Torque that acts upon the body"), torque)
42 STEPCORE_PROPERTY_RW(double, mass, QT_TRANSLATE_NOOP("PropertyName", "mass"), QT_TRANSLATE_NOOP("Units", "kg"), QT_TR_NOOP("Total mass of the body"), mass, setMass)
43 STEPCORE_PROPERTY_RW(double, inertia, QT_TRANSLATE_NOOP("PropertyName", "inertia"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "kg m²")),
45 STEPCORE_PROPERTY_RWF(StepCore::Vector2d, momentum, QT_TRANSLATE_NOOP("PropertyName", "momentum"), QT_TRANSLATE_NOOP("Units", "kg m/s"), QT_TR_NOOP("momentum"),
47 STEPCORE_PROPERTY_RWF(double, angularMomentum, QT_TRANSLATE_NOOP("PropertyName", "angularMomentum"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "kg m² rad/s")), QT_TR_NOOP("angular momentum"),
49 STEPCORE_PROPERTY_RWF(double, kineticEnergy, QT_TRANSLATE_NOOP("PropertyName", "kineticEnergy"), QT_TRANSLATE_NOOP("Units", "J"), QT_TR_NOOP("kinetic energy"),
52 STEPCORE_META_OBJECT(RigidBodyErrors, QT_TRANSLATE_NOOP("ObjectClass", "RigidBodyErrors"), QT_TR_NOOP("Errors class for RigidBody"), 0, STEPCORE_SUPER_CLASS(ObjectErrors),
53 STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, positionVariance, QT_TRANSLATE_NOOP("PropertyName", "positionVariance"), QT_TRANSLATE_NOOP("Units", "m"),
55 STEPCORE_PROPERTY_RW_D(double, angleVariance, QT_TRANSLATE_NOOP("PropertyName", "angleVariance"), QT_TRANSLATE_NOOP("Units", "rad"),
58 STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, velocityVariance, QT_TRANSLATE_NOOP("PropertyName", "velocityVariance"), QT_TRANSLATE_NOOP("Units", "m/s"),
60 STEPCORE_PROPERTY_RW_D(double, angularVelocityVariance, QT_TRANSLATE_NOOP("PropertyName", "angularVelocityVariance"), QT_TRANSLATE_NOOP("Units", "rad/s"),
63 STEPCORE_PROPERTY_R_D(StepCore::Vector2d, accelerationVariance, QT_TRANSLATE_NOOP("PropertyName", "accelerationVariance"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "m/s²")),
65 STEPCORE_PROPERTY_R_D(double, angularAccelerationVariance, QT_TRANSLATE_NOOP("PropertyName", "angularAccelerationVariance"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "rad/s²")),
68 STEPCORE_PROPERTY_R_D(StepCore::Vector2d, forceVariance, QT_TRANSLATE_NOOP("PropertyName", "forceVariance"), QT_TRANSLATE_NOOP("Units", "N"), QT_TR_NOOP("force variance"), forceVariance)
69 STEPCORE_PROPERTY_R_D(double, torqueVariance, QT_TRANSLATE_NOOP("PropertyName", "torqueVariance"), QT_TRANSLATE_NOOP("Units", "N m"), QT_TR_NOOP("torque variance"), torqueVariance)
71 STEPCORE_PROPERTY_RW(double, massVariance, QT_TRANSLATE_NOOP("PropertyName", "massVariance"), QT_TRANSLATE_NOOP("Units", "kg"),
73 STEPCORE_PROPERTY_RW(double, inertiaVariance, QT_TRANSLATE_NOOP("PropertyName", "inertiaVariance"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "kg m²")),
75 STEPCORE_PROPERTY_RWF(StepCore::Vector2d, momentumVariance, QT_TRANSLATE_NOOP("PropertyName", "momentumVariance"), QT_TRANSLATE_NOOP("Units", "kg m/s"),
76 QT_TR_NOOP("momentum variance"), StepCore::MetaProperty::DYNAMIC, momentumVariance, setMomentumVariance)
77 STEPCORE_PROPERTY_RWF(double, angularMomentumVariance, QT_TRANSLATE_NOOP("PropertyName", "angularMomentumVariance"), STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units", "kg m² rad/s")),
80 STEPCORE_PROPERTY_RWF(double, kineticEnergyVariance, QT_TRANSLATE_NOOP("PropertyName", "kineticEnergyVariance"), QT_TRANSLATE_NOOP("Units", "J"),
81 QT_TR_NOOP("kinetic energy variance"), StepCore::MetaProperty::DYNAMIC, kineticEnergyVariance, setKineticEnergyVariance))
83 STEPCORE_META_OBJECT(Disk, QT_TRANSLATE_NOOP("ObjectClass", "Disk"), QT_TR_NOOP("Rigid disk"), 0, STEPCORE_SUPER_CLASS(RigidBody),
84 STEPCORE_PROPERTY_RW(double, radius, QT_TRANSLATE_NOOP("PropertyName", "radius"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Radius of the disk"), radius, setRadius))
86 STEPCORE_META_OBJECT(BasePolygon, QT_TRANSLATE_NOOP("ObjectClass", "BasePolygon"), QT_TR_NOOP("Base polygon body"), 0, STEPCORE_SUPER_CLASS(RigidBody),)
88 STEPCORE_META_OBJECT(Box, QT_TRANSLATE_NOOP("ObjectClass", "Box"), QT_TR_NOOP("Rigid box"), 0, STEPCORE_SUPER_CLASS(BasePolygon),
89 STEPCORE_PROPERTY_RW(StepCore::Vector2d, size, QT_TRANSLATE_NOOP("PropertyName", "size"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Size of the box"), size, setSize))
91 STEPCORE_META_OBJECT(Polygon, QT_TRANSLATE_NOOP("ObjectClass", "Polygon"), QT_TR_NOOP("Rigid polygon body"), 0, STEPCORE_SUPER_CLASS(BasePolygon),
92 STEPCORE_PROPERTY_RW(Vector2dList, vertexes, QT_TRANSLATE_NOOP("PropertyName", "vertices"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Vertex list"), vertexes, setVertexes))
95 STEPCORE_META_OBJECT(Plane, QT_TRANSLATE_NOOP("ObjectClass", "Plane"), QT_TR_NOOP("Unmovable rigid plane"), 0, STEPCORE_SUPER_CLASS(Item) STEPCORE_SUPER_CLASS(Body),
96 STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, point1, QT_TRANSLATE_NOOP("PropertyName", "point1"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("First point which defines the plane"), point1, setPoint1),
97 STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, point2, QT_TRANSLATE_NOOP("PropertyName", "point2"), QT_TRANSLATE_NOOP("Units", "m"), QT_TR_NOOP("Second point which defines the plane"), point2, setPoint2))
125 _velocityVariance = (momentumVariance - rigidBody()->velocity().cwise().square() * _massVariance) /
144 return _velocityVariance.dot(rigidBody()->velocity().cwise().square()) * square(rigidBody()->mass()) +
void applyForce(const Vector2d &force, const Vector2d &position)
Apply force (and torque) to the body at given position (in World coordinates)
Definition: rigidbody.cc:170
RigidBody class.
setAngleVariance setAngularVelocityVariance angularAccelerationVariance torqueVariance setInertiaVariance STEPCORE_PROPERTY_RWF(StepCore::Vector2d, momentumVariance, QT_TRANSLATE_NOOP("PropertyName","momentumVariance"), QT_TRANSLATE_NOOP("Units","kg m/s"), QT_TR_NOOP("momentum variance"), StepCore::MetaProperty::DYNAMIC, momentumVariance, setMomentumVariance) STEPCORE_PROPERTY_RWF(double
void setVariables(const double *position, const double *velocity, const double *positionVariance, const double *velocityVariance)
Set positions, velocities and (possibly) its variances using values in arrays and also reset accelera...
Definition: rigidbody.cc:250
setAngleVariance setAngularVelocityVariance angularAccelerationVariance
Definition: rigidbody.cc:65
Type to and from string convertion helpers.
Vector2d velocityWorld(const Vector2d &worldPoint) const
Get velocity of given (world) point on the body.
Definition: rigidbody.cc:189
Definition: rigidbody.h:325
void setMomentumVariance(const Vector2d &momentumVariance)
Set momentum variance (will modify velocity variance)
Definition: rigidbody.cc:123
void setAngularMomentumVariance(double angularMomentumVariance)
Set angular momentum variance (will modify angularVelocity variance)
Definition: rigidbody.cc:135
void applyForceVariance(const Vector2d &force, const Vector2d &position, const Vector2d &forceVariance, const Vector2d &positionVariance)
Apply force (and torque) variance to the body at given position (in World coordinates) ...
Definition: rigidbody.cc:177
STEPCORE_SUPER_CLASS(CollisionSolver)
Vector2d pointWorldToLocal(const Vector2d &p) const
Translate world coordinates to local coordinates on body.
Definition: rigidbody.cc:209
Vector2d vectorLocalToWorld(const Vector2d &v) const
Translate local vector on body to world vector.
Definition: rigidbody.cc:217
setAngleVariance setAngularVelocityVariance STEPCORE_FROM_UTF8(QT_TRANSLATE_NOOP("Units","rad/s²"))
setAngleVariance setAngularVelocityVariance angularAccelerationVariance torqueVariance setInertiaVariance angularMomentumVariance
Definition: rigidbody.cc:77
QT_TRANSLATE_NOOP("ObjectClass","GJKCollisionSolver")
double angularAccelerationVariance() const
Get angularAcceleration variance.
Definition: rigidbody.cc:111
void resetForce(bool resetVariance)
Reset force accomulator and (possibly) its variance to zero.
Definition: rigidbody.cc:302
setAngleVariance setAngularVelocityVariance angularAccelerationVariance torqueVariance inertiaVariance
Definition: rigidbody.cc:73
Vector2d pointLocalToWorld(const Vector2d &p) const
Translate local coordinates on body to world coordinates.
Definition: rigidbody.cc:201
void getVariables(double *position, double *velocity, double *positionVariance, double *velocityVariance)
Copy positions, velocities and (possibly) its variances to arrays.
Definition: rigidbody.cc:233
void addForce(const double *force, const double *forceVariance)
Add force and (possibly) its variance to force accomulator.
Definition: rigidbody.cc:289
Vector2d accelerationVariance() const
Get acceleration variance.
double _angularVelocityVariance
Definition: rigidbody.h:130
const Vector2d & velocity() const
Get velocity of the center of mass of the body.
Definition: rigidbody.h:170
Vector2d velocityLocal(const Vector2d &localPoint) const
Get velocity of given (local) point on the body.
Definition: rigidbody.cc:195
QT_TR_NOOP("Errors class for CoulombForce")
setAngleVariance setAngularVelocityVariance angularAccelerationVariance torqueVariance
Definition: rigidbody.cc:69
void getAccelerations(double *acceleration, double *accelerationVariance)
Copy acceleration (forces left-multiplied by inverse mass) and (possibly) its variances to arrays...
Definition: rigidbody.cc:273
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
Variable changes during simulation or changes of other properties.
Definition: object.h:84
STEPCORE_PROPERTY_RW_D(StepCore::Vector2d, positionVariance, QT_TRANSLATE_NOOP("PropertyName","positionVariance"), QT_TRANSLATE_NOOP("Units","m"), QT_TR_NOOP("position variance"), positionVariance, setPositionVariance) STEPCORE_PROPERTY_RW_D(double
void setKineticEnergyVariance(double kineticEnergyVariance)
Set kinetic energy variance (will modify velocity variance)
Definition: rigidbody.cc:150
setAngleVariance angularVelocityVariance
Definition: rigidbody.cc:60
RigidBody(Vector2d position=Vector2d::Zero(), double angle=0, Vector2d velocity=Vector2d::Zero(), double angularVelocity=0, double mass=1, double inertia=1)
Constructs RigidBody.
Definition: rigidbody.cc:163
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
Eigen::DynamicSparseMatrix< double, Eigen::RowMajor > DynSparseRowMatrix
Definition: types.h:38
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
std::vector< Vector2d, Eigen::aligned_allocator< Vector2d > > Vector2dList
Definition: types.h:117
void setKineticEnergy(double kineticEnergy)
Set kinetic energy of the body (will modify only velocity and (possibly) angularVelocity) ...
Definition: rigidbody.cc:329
Vector2d vectorWorldToLocal(const Vector2d &v) const
Translate world vector to local vector on body.
Definition: rigidbody.cc:225
Box(Vector2d position=Vector2d::Zero(), double angle=0, Vector2d velocity=Vector2d::Zero(), double angularVelocity=0, double mass=1, double inertia=1, Vector2d size=Vector2d(1, 1))
Constructs Box.
Definition: rigidbody.cc:341
void getInverseMass(VectorXd *inverseMass, DynSparseRowMatrix *variance, int offset)
Get inverse mass and (possibly) its variance matrixes.
Definition: rigidbody.cc:313
RigidBodyErrors * rigidBodyErrors()
Get (and possibly create) RigidBodyErrors object.
Definition: rigidbody.h:261
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.