Skip to content

Commit

Permalink
- added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
janbender committed Sep 17, 2015
1 parent cc74933 commit 0742530
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 244 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1.3.0
- added some documentation
- cleaned up project
- added new Joint demo
Expand Down
235 changes: 0 additions & 235 deletions Demos/RigidBodyDemos/main.cpp

This file was deleted.

73 changes: 64 additions & 9 deletions PositionBasedDynamics/PositionBasedRigidBodyDynamics.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ namespace PBD
Eigen::Matrix3f &K);

public:
/** Initialize rigid ball joint and return infos which are required by the solver step.
* Recomputation is only necessary when rest shape changes.\n\n
/** Initialize ball joint and return info which is required by the solver step.
*
* @param x0 center of mass of first body
* @param q0 rotation of first body
Expand All @@ -48,7 +47,7 @@ namespace PBD
Eigen::Matrix<float, 3, 4> &ballJointInfo
);

/** Update rigid ball joint info which are required by the solver step.
/** Update ball joint info which is required by the solver step.
* The ball joint info must be generated in the initialization process of the model
* by calling the function initRigidBodyBallJointInfo().
* This method should be called once per simulation step before executing the solver.\n\n
Expand All @@ -70,11 +69,12 @@ namespace PBD
/** Perform a solver step for a ball joint which links two rigid bodies.
* A ball joint removes three translational degrees of freedom between the bodies.
* The ball joint info must be generated in the initialization process of the model
* by calling the function initRigidBodyBallJointInfo() updated each time the bodies
* change their state by updateRigidBodyBallJointInfo().
* by calling the function initRigidBodyBallJointInfo() and updated each time the bodies
* change their state by updateRigidBodyBallJointInfo().\n\n
* More information can be found in: \cite Deul2014
*
* \image html balljoint.jpg "Ball joint"
* \image latex balljoint.jpg "Ball joint" width=0.5\textwidth
* \image html balljoint.jpg "ball joint"
* \image latex balljoint.jpg "ball joint" width=0.5\textwidth
*
* @param mass0 mass of first body
* @param x0 center of mass of first body
Expand Down Expand Up @@ -152,8 +152,12 @@ namespace PBD
/** Perform a solver step for a ball-on-line-joint which links two rigid bodies.
* A ball-on-line-joint removes two translational degrees of freedom between the bodies.
* The joint info must be generated in the initialization process of the model
* by calling the function initRigidBodyBallOnLineJointInfo() updated each time the bodies
* change their state by updateRigidBodyBallOnLineJointInfo().
* by calling the function initRigidBodyBallOnLineJointInfo() and updated each time the bodies
* change their state by updateRigidBodyBallOnLineJointInfo().\n\n
* More information can be found in: \cite Deul2014
*
* \image html ballonlinejoint.jpg "ball-on-line joint"
* \image latex ballonlinejoint.jpg "ball-on-line joint" width=0.5\textwidth
*
* @param mass0 mass of first body
* @param x0 center of mass of first body
Expand Down Expand Up @@ -185,6 +189,20 @@ namespace PBD
Eigen::Vector3f &corr_x1, Eigen::Quaternionf &corr_q1);


/** Initialize hinge joint and return info which is required by the solver step.
*
* @param x0 center of mass of first body
* @param q0 rotation of first body
* @param x1 center of mass of second body
* @param q1 rotation of second body
* @param hingeJointPosition position of hinge joint
* @param hingeJointAxis axis of hinge joint
* @param hingeJointInfo Stores the local and global positions of the connector points.
* The hinge joint is a combination of a ball joint and a ball-on-line joint.
* The joint info stores first the info of the ball joint and then the info of
* the ball-on-line joint. The info must be updated in each simulation step
* by calling updateRigidBodyHingeJointInfo().
*/
static bool initRigidBodyHingeJointInfo(
const Eigen::Vector3f &x0, // center of mass of body 0
const Eigen::Quaternionf &q0, // rotation of body 0
Expand All @@ -195,6 +213,17 @@ namespace PBD
Eigen::Matrix<float, 3, 14> &hingeJointInfo
);

/** Update hinge joint info which is required by the solver step.
* The ball joint info must be generated in the initialization process of the model
* by calling the function initRigidBodyHingeJointInfo().
* This method should be called once per simulation step before executing the solver.\n\n
*
* @param x0 center of mass of first body
* @param q0 rotation of first body
* @param x1 center of mass of second body
* @param q1 rotation of second body
* @param hingeJointInfo hinge joint information which should be updated
*/
static bool updateRigidBodyHingeJointInfo(
const Eigen::Vector3f &x0, // center of mass of body 0
const Eigen::Quaternionf &q0, // rotation of body 0
Expand All @@ -203,6 +232,32 @@ namespace PBD
Eigen::Matrix<float, 3, 14> &hingeJointInfo
);

/** Perform a solver step for a hinge joint which links two rigid bodies.
* A hinge joint removes three translational and two rotational degrees of freedom between the bodies.
* The hinge joint info must be generated in the initialization process of the model
* by calling the function initRigidBodyHingeJointInfo() and updated each time the bodies
* change their state by updateRigidBodyHingeJointInfo().\n\n
* More information can be found in: \cite Deul2014
*
* \image html hingejoint.jpg "hinge joint"
* \image latex hingejoint.jpg "hinge joint" width=0.5\textwidth
*
* @param mass0 mass of first body
* @param x0 center of mass of first body
* @param inertiaInverseW0 inverse inertia tensor in world coordinates of first body
* @param q0 rotation of first body
* @param mass1 mass of second body
* @param x1 center of mass of second body
* @param inertiaInverseW1 inverse inertia tensor in world coordinates of second body
* @param q1 rotation of second body
* @param hingeJointInfo Hinge joint information which is required by the solver. This
* information must be generated in the beginning by calling initRigidBodyHingeJointInfo()
* and updated each time the bodies change their state by updateRigidBodyHingeJointInfo().
* @param corr_x0 position correction of center of mass of first body
* @param corr_q0 rotation correction of first body
* @param corr_x1 position correction of center of mass of second body
* @param corr_q1 rotation correction of second body
*/
static bool solveRigidBodyHingeJoint(
const float mass0, // mass is zero if body is static
const Eigen::Vector3f &x0, // center of mass of body 0
Expand Down
Binary file added doc/images/ballonlinejoint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/hingejoint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0742530

Please sign in to comment.