Cleanup: Reduce amount of misleading indentation

Was polluting compile output too much.
This commit is contained in:
Sergey Sharybin 2016-09-01 12:14:16 +02:00
parent 475b43ad4a
commit f7263b8b1a
7 changed files with 41 additions and 36 deletions

@ -151,8 +151,8 @@ static btScalar EdgeSeparation(const btBox2dShape* poly1, const btTransform& xf1
int index = 0; int index = 0;
btScalar minDot = BT_LARGE_FLOAT; btScalar minDot = BT_LARGE_FLOAT;
if( count2 > 0 ) if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot); index = (int) normal1.minDot( vertices2, count2, minDot);
btVector3 v1 = b2Mul(xf1, vertices1[edge1]); btVector3 v1 = b2Mul(xf1, vertices1[edge1]);
btVector3 v2 = b2Mul(xf2, vertices2[index]); btVector3 v2 = b2Mul(xf2, vertices2[index]);
@ -174,9 +174,9 @@ static btScalar FindMaxSeparation(int* edgeIndex,
// Find edge normal on poly1 that has the largest projection onto d. // Find edge normal on poly1 that has the largest projection onto d.
int edge = 0; int edge = 0;
btScalar maxDot; btScalar maxDot;
if( count1 > 0 ) if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot); edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
// Get the separation for the edge normal. // Get the separation for the edge normal.
btScalar s = EdgeSeparation(poly1, xf1, edge, poly2, xf2); btScalar s = EdgeSeparation(poly1, xf1, edge, poly2, xf2);

@ -232,8 +232,8 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
m_compoundShapeRevision = compoundShape->getUpdateRevision(); m_compoundShapeRevision = compoundShape->getUpdateRevision();
} }
if (m_childCollisionAlgorithms.size()==0) if (m_childCollisionAlgorithms.size()==0)
return; return;
const btDbvt* tree = compoundShape->getDynamicAabbTree(); const btDbvt* tree = compoundShape->getDynamicAabbTree();
//use a dynamic aabb tree to cull potential child-overlaps //use a dynamic aabb tree to cull potential child-overlaps

@ -1316,7 +1316,8 @@ void ControlParticles::finishControl(std::vector<ControlForces> &forces, LbmFloa
if(cvweight>1.) { cvweight = 1.; } if(cvweight>1.) { cvweight = 1.; }
// thus cvweight is in the range of 0..influenceVelocity, currently not normalized by numCParts // thus cvweight is in the range of 0..influenceVelocity, currently not normalized by numCParts
cvweight *= ivel; cvweight *= ivel;
if(cvweight<0.) cvweight=0.; if(cvweight>1.) cvweight=1.; if(cvweight<0.) cvweight=0.;
if(cvweight>1.) cvweight=1.;
// LBM, FIXME todo use relaxation factor // LBM, FIXME todo use relaxation factor
//pvel = (cvel*0.5 * cvweight) + (pvel * (1.0-cvweight)); //pvel = (cvel*0.5 * cvweight) + (pvel * (1.0-cvweight));
forces[i].weightVel = cvweight; forces[i].weightVel = cvweight;

@ -67,8 +67,10 @@ class IsoSurface :
/*! set # of subdivisions, this has to be done before init! */ /*! set # of subdivisions, this has to be done before init! */
void setSubdivs(int s) { void setSubdivs(int s) {
if(mInitDone) errFatal("IsoSurface::setSubdivs","Changing subdivs after init!", SIMWORLD_INITERROR); if(mInitDone) errFatal("IsoSurface::setSubdivs","Changing subdivs after init!", SIMWORLD_INITERROR);
if(s<1) s=1; if(s>10) s=10; if(s<1) s=1;
mSubdivs = s; } if(s>10) s=10;
mSubdivs = s;
}
int getSubdivs() { return mSubdivs;} int getSubdivs() { return mSubdivs;}
/*! set full edge settings, this has to be done before init! */ /*! set full edge settings, this has to be done before init! */
void setUseFulledgeArrays(bool set) { void setUseFulledgeArrays(bool set) {

@ -145,27 +145,29 @@ bool ConstraintSet::closeLoop(){
//toggle=!toggle; //toggle=!toggle;
//svd_boost_Macie(Jf,U,S,V,B,temp,1e-3*threshold,toggle); //svd_boost_Macie(Jf,U,S,V,B,temp,1e-3*threshold,toggle);
int ret = KDL::svd_eigen_HH(m_Jf,m_U,m_S,m_V,m_temp); int ret = KDL::svd_eigen_HH(m_Jf,m_U,m_S,m_V,m_temp);
if(ret<0) if(ret<0)
return false; return false;
// the reference point and frame of the jacobian is the base frame // the reference point and frame of the jacobian is the base frame
// m_externalPose-m_internalPose is the twist to extend the end effector // m_externalPose-m_internalPose is the twist to extend the end effector
// to get the required pose => change the reference point to the base frame // to get the required pose => change the reference point to the base frame
Twist twist_delta(diff(m_internalPose,m_externalPose)); Twist twist_delta(diff(m_internalPose,m_externalPose));
twist_delta=twist_delta.RefPoint(-m_internalPose.p); twist_delta=twist_delta.RefPoint(-m_internalPose.p);
for(unsigned int i=0;i<6;i++) for(unsigned int i=0;i<6;i++)
m_tdelta(i)=twist_delta(i); m_tdelta(i)=twist_delta(i);
//TODO: use damping in constraintset inversion? //TODO: use damping in constraintset inversion?
for(unsigned int i=0;i<6;i++) for(unsigned int i=0;i<6;i++) {
if(m_S(i)<m_threshold){ if(m_S(i)<m_threshold){
m_B.row(i).setConstant(0.0); m_B.row(i).setConstant(0.0);
}else } else {
m_B.row(i) = m_U.col(i)/m_S(i); m_B.row(i) = m_U.col(i)/m_S(i);
}
}
m_Jf_inv.noalias()=m_V*m_B; m_Jf_inv.noalias()=m_V*m_B;
m_chi.noalias()+=m_Jf_inv*m_tdelta; m_chi.noalias()+=m_Jf_inv*m_tdelta;
updateJacobian(); updateJacobian();
// m_externalPose-m_internalPose in end effector frame // m_externalPose-m_internalPose in end effector frame
// this is just to compare the pose, a different formula would work too // this is just to compare the pose, a different formula would work too
return Equal(m_internalPose.Inverse()*m_externalPose,F_identity,m_threshold); return Equal(m_internalPose.Inverse()*m_externalPose,F_identity,m_threshold);

@ -146,11 +146,11 @@ bool Scene::addObject(const std::string& name, Object* object, UncontrolledObjec
bool Scene::addConstraintSet(const std::string& name,ConstraintSet* task,const std::string& object1,const std::string& object2, const std::string& ee1, const std::string& ee2) bool Scene::addConstraintSet(const std::string& name,ConstraintSet* task,const std::string& object1,const std::string& object2, const std::string& ee1, const std::string& ee2)
{ {
//Check if objects exist: //Check if objects exist:
ObjectMap::iterator object1_it = objects.find(object1); ObjectMap::iterator object1_it = objects.find(object1);
ObjectMap::iterator object2_it = objects.find(object2); ObjectMap::iterator object2_it = objects.find(object2);
if(object1_it==objects.end()||object2_it==objects.end()) if(object1_it==objects.end()||object2_it==objects.end())
return false; return false;
int ee1_index = object1_it->second->object->addEndEffector(ee1); int ee1_index = object1_it->second->object->addEndEffector(ee1);
int ee2_index = object2_it->second->object->addEndEffector(ee2); int ee2_index = object2_it->second->object->addEndEffector(ee2);
if (ee1_index < 0 || ee2_index < 0) if (ee1_index < 0 || ee2_index < 0)
@ -159,11 +159,11 @@ bool Scene::addConstraintSet(const std::string& name,ConstraintSet* task,const s
constraints.insert(ConstraintMap::value_type(name,new ConstraintSet_struct( constraints.insert(ConstraintMap::value_type(name,new ConstraintSet_struct(
task,object1_it,ee1_index,object2_it,ee2_index, task,object1_it,ee1_index,object2_it,ee2_index,
Range(m_ncTotal,task->getNrOfConstraints()),Range(6*m_nsets,6)))); Range(m_ncTotal,task->getNrOfConstraints()),Range(6*m_nsets,6))));
if(!result.second) if(!result.second)
return false; return false;
m_ncTotal+=task->getNrOfConstraints(); m_ncTotal+=task->getNrOfConstraints();
m_nsets+=1; m_nsets+=1;
return true; return true;
} }
bool Scene::addSolver(Solver* _solver){ bool Scene::addSolver(Solver* _solver){

@ -60,7 +60,7 @@ bool WSDLSSolver::solve(const e_matrix& A, const e_vector& Wy, const e_vector& y
e_scalar N, M; e_scalar N, M;
// Create the Weighted jacobian // Create the Weighted jacobian
m_AWq.noalias() = A*Wq; m_AWq.noalias() = A*Wq;
for (i=0; i<m_nc; i++) for (i=0; i<m_nc; i++)
m_WyAWq.row(i) = Wy(i)*m_AWq.row(i); m_WyAWq.row(i) = Wy(i)*m_AWq.row(i);
@ -72,11 +72,11 @@ bool WSDLSSolver::solve(const e_matrix& A, const e_vector& Wy, const e_vector& y
} else { } else {
ret = KDL::svd_eigen_HH(m_WyAWq,m_U,m_S,m_V,m_temp); ret = KDL::svd_eigen_HH(m_WyAWq,m_U,m_S,m_V,m_temp);
} }
if(ret<0) if(ret<0)
return false; return false;
m_Wy_ydot = Wy.array() * ydot.array(); m_Wy_ydot = Wy.array() * ydot.array();
m_WqV.noalias() = Wq*m_V; m_WqV.noalias() = Wq*m_V;
qdot.setZero(); qdot.setZero();
e_scalar maxDeltaS = e_scalar(0.0); e_scalar maxDeltaS = e_scalar(0.0);
e_scalar prevS = e_scalar(0.0); e_scalar prevS = e_scalar(0.0);