Skip to content

Commit

Permalink
Add new asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielChappuis committed Jan 31, 2019
1 parent 528d7bf commit 4ef6900
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/body/CollisionBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ void CollisionBody::setTransform(const Transform& transform) {
// Update the transform of the body
mTransform = transform;

assert(mTransform.getOrientation().length() > decimal(0.7));

// Update the broad-phase state of the body
updateBroadPhaseState();

Expand Down
2 changes: 2 additions & 0 deletions src/constraint/BallAndSocketJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,7 @@ void BallAndSocketJoint::solvePositionConstraint(const ConstraintSolverData& con
x2 += v2;
q2 += Quaternion(0, w2) * q2 * decimal(0.5);
q2.normalize();
assert(q1.length() > decimal(0.7));
assert(q2.length() > decimal(0.7));
}

3 changes: 3 additions & 0 deletions src/constraint/FixedJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,8 @@ void FixedJoint::solvePositionConstraint(const ConstraintSolverData& constraintS
// Update the body position/orientation of body 2
q2 += Quaternion(0, w2) * q2 * decimal(0.5);
q2.normalize();

assert(q1.length() > decimal(0.7));
assert(q2.length() > decimal(0.7));
}

3 changes: 3 additions & 0 deletions src/constraint/HingeJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ void HingeJoint::solvePositionConstraint(const ConstraintSolverData& constraintS
q2.normalize();
}
}

assert(q1.length() > decimal(0.7));
assert(q2.length() > decimal(0.7));
}


Expand Down
3 changes: 3 additions & 0 deletions src/constraint/SliderJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ void SliderJoint::solvePositionConstraint(const ConstraintSolverData& constraint
q2.normalize();
}
}

assert(q1.length() > decimal(0.7));
assert(q2.length() > decimal(0.7));
}

// Enable/Disable the limits of the joint
Expand Down
1 change: 1 addition & 0 deletions src/engine/DynamicsWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void DynamicsWorld::integrateRigidBodiesPositions() {
mConstrainedOrientations[indexArray] = currentOrientation +
Quaternion(0, newAngVelocity) *
currentOrientation * decimal(0.5) * mTimeStep;
assert(mConstrainedOrientations[indexArray].length() > decimal(0.7));
}
}
}
Expand Down

0 comments on commit 4ef6900

Please sign in to comment.