From 325dca9f212f9fd44cd10a8180529970c7a08c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Mon, 21 Jun 2021 18:11:55 +0700 Subject: Remove trailing whitespaces and duplicated blank lines --- src/Skeleton.cpp | 97 +++++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 50 deletions(-) (limited to 'src/Skeleton.cpp') diff --git a/src/Skeleton.cpp b/src/Skeleton.cpp index e039bc4..a5516c6 100644 --- a/src/Skeleton.cpp +++ b/src/Skeleton.cpp @@ -29,10 +29,8 @@ extern int whichtri; extern XYZ normalrotated; extern bool groundish; - void Joint::DoConstraint() { - if(hasparent){ //Find midpoint midp=(position+parent->position)/2; @@ -53,22 +51,22 @@ void Muscle::DoConstraint(int broken) { oldlength=length; relaxlength=findDistance(parent1->position,parent2->position); - + if(type==boneconnect)strength=1; if(type==constraint)strength=0; - + if(strength<0)strength=0; if(strength>1)strength=1; - + length-=(length-relaxlength)*(1-strength)*multiplier*multiplier*10000; length-=(length-targetlength)*(strength)*multiplier*multiplier*10000; if(strength==0)length=relaxlength; - + if((relaxlength-length>0&&relaxlength-oldlength<0)||(relaxlength-length<0&&relaxlength-oldlength>0))length=relaxlength; - + if(lengthmaxlength&&!broken)length=maxlength; - + //Find midpoint midp=(parent1->position+parent2->position)/2; //Find vector from midpoint to second vector @@ -88,7 +86,7 @@ void Muscle::DoConstraint(int broken) void Skeleton::DoConstraints() { numrepeats=3; - + for(int j=0; jy+=.35; - + for(int j=0; jposition.x,muscles[i].parent1->position.y,muscles[i].parent1->position.z); glVertex3f(muscles[i].parent2->position.x,muscles[i].parent2->position.y,muscles[i].parent2->position.z); } - } + } glEnd(); - + if(muscleview!=2){ glPointSize(3); glBegin(GL_POINTS); @@ -301,7 +299,7 @@ void Skeleton::Draw(int muscleview) } glEnd(); } - + //Set old position to current position if(muscleview==2) for(int i=0; i=num_joints||which<0)joints[num_joints].hasparent=0; if(which=0){ joints[num_joints].parent=&joints[which]; joints[num_joints].hasparent=1; joints[num_joints].length=findDistance(joints[num_joints].position,joints[num_joints].parent->position); - } + } num_joints++; } } @@ -355,7 +353,7 @@ void Skeleton::DeleteMuscle(int whichmuscle) muscles[whichmuscle].visible=muscles[num_muscles-1].visible; muscles[whichmuscle].type=muscles[num_muscles-1].type; muscles[whichmuscle].targetlength=muscles[num_muscles-1].targetlength; - + num_muscles--; } } @@ -367,13 +365,13 @@ void Skeleton::SetJoint(float x, float y, float z, int which, int whichjoint) joints[whichjoint].position.x=x; joints[whichjoint].position.y=y; joints[whichjoint].position.z=z; - + if(which>=num_joints||which<0)joints[whichjoint].hasparent=0; if(which=0){ joints[whichjoint].parent=&joints[which]; joints[whichjoint].hasparent=1; joints[whichjoint].length=findDistance(joints[whichjoint].position,joints[whichjoint].parent->position); - } + } } } @@ -388,7 +386,7 @@ void Skeleton::AddMuscle(int attach1,int attach2,float minlength,float maxlength muscles[num_muscles].type=type; muscles[num_muscles].minlength=minlength; muscles[num_muscles].maxlength=maxlength; - + num_muscles++; } } @@ -404,7 +402,7 @@ void Skeleton::FindRotationJoint(int which) { XYZ temppoint1,temppoint2,tempforward; float distance; - + temppoint1=joints[which].position; temppoint2=joints[which].parent->position; distance=findDistance(temppoint1,temppoint2); @@ -432,7 +430,7 @@ void Skeleton::FindRotationMuscle(int which) { XYZ temppoint1,temppoint2,tempforward; float distance; - + temppoint1=muscles[which].parent1->position; temppoint2=muscles[which].parent2->position; distance=findDistance(temppoint1,temppoint2); @@ -490,23 +488,23 @@ void Animation::Load(char *fileName) } } } - + files.EndLoad(); - + for(int j=0;jmrotate1[i][j-1]+180)mrotate1[i][j]-=360; if(j!=0&&mrotate1[i][j]mrotate3[i][numframes-1]+180)mrotate3[i][j]-=360; if(j==0&&mrotate3[i][j]mrotate2[i][numframes-1]+180)mrotate2[i][j]-=360; @@ -597,7 +595,7 @@ void Animation::Load(char *fileName) if(j!=0&&rotate2[i][j]rotate1[i][j-1]+180)rotate1[i][j]-=360; if(j!=0&&rotate1[i][j]rotate3[i][numframes-1]+180)rotate3[i][j]-=360; if(j==0&&rotate3[i][j]rotate2[i][numframes-1]+180)rotate2[i][j]-=360; @@ -635,21 +633,21 @@ void Animation::Load(char *fileName, float rotate) } } files.EndLoad(); - + for(int j=0;jmrotate1[i][j-1]+180)mrotate1[i][j]-=360; if(j!=0&&mrotate1[i][j]mrotate3[i][numframes-1]+180)mrotate3[i][j]-=360; if(j==0&&mrotate3[i][j]mrotate2[i][numframes-1]+180)mrotate2[i][j]-=360; @@ -740,7 +738,7 @@ void Animation::Load(char *fileName, float rotate) if(j!=0&&rotate2[i][j]rotate1[i][j-1]+180)rotate1[i][j]-=360; if(j!=0&&rotate1[i][j]rotate3[i][numframes-1]+180)rotate3[i][j]-=360; if(j==0&&rotate3[i][j]rotate2[i][numframes-1]+180)rotate2[i][j]-=360; @@ -801,13 +799,12 @@ void Skeleton::Load(char *fileName) } } files.EndLoad(); - + for(int i=0;i