I'm having some trouble figuring out if statements, they've been very finicky. Can anyone detect the problem with this? Or, alternately, can anyone say whether the if if-else else method I am using is a good one, or if I should switch to something else (no pun intented).
Thanks
Code:/* X-Axis Groups */ float VerSet_r_A; /*X Dimension of Vertices 0,2,4,6 */ float VerSet_r_D; /*X Dimension of Vertices 1,3,5,7 */ /* Y-Axis Groups */ float VerSet_r_B; /*Y Dimension of Vertices 0,1,6,7 */ float VerSet_r_E; /*Y Dimension of Vertices 2,3,4,5 */ /* Z-Axis Groups */ float VerSet_r_C; /*Z Dimension of Vertices 0,1,2,3 */ float VerSet_r_F; /*Z Dimension of Vertices 4,5,6,7 */ int C_closer; // Value 1 = C is closer. Value 0 = F is closer. int A_right; // Value 1 = A is right. Value 0 = D is right. int B_up; // Value 1 = B is up. Value 0 = E is up. int Config_Case; // 0 = P, 1 = S, 2 = R, 3 = Q int main (void) { if(VerSet_r_C > 0) { printf("Real_Cube is out of camera view. Real_Z value must be less than zero. \n"); return(0); }; if(VerSet_r_F > 0) { printf("Real_Cube is out of camera view. Real_Z value must be less than zero. \n"); return(0); }; if(VerSet_r_C > VerSet_r_F) C_closer = 1; // true else C_closer = 0; // false if(VerSet_r_A > VerSet_r_D) A_right = 1; // true else A_right = 0; // false if(VerSet_r_B > VerSet_r_E) B_up = 1; // true else B_up = 0; // false if(C_closer == 1) { if(A_right == 0) { if(B_up == 0) { Config_Case = 0; } else printf("Real_Cube Case orientation check error."); return(0); } else if(A_right == 1) { if(B_up == 1) { Config_Case = 1; } else printf("Real_Cube Case orientation check error."); return(0); } else printf("Real_Cube Case orientation check error."); return(0); } else if(C_closer == 0) { if(A_right == 0) { if(B_up == 1) { Config_Case = 2; } else printf("Real_Cube Case orientation check error."); return(0); } else if(A_right == 1) { if(B_up == 0) { Config_Case = 3; } else printf("Real_Cube Case orientation check error."); return(0); } else printf("Real_Cube Case orientation check error."); return(0); } /* For variable "Config_Case": Integer Values: Case-P = 0, Case-S = 1, Case-R = 2, Case-Q = 3 */ /* End Real_Cube Orientation Determination */ /* Main generation procedure? */ //For now, we are going to deal only with Case-P, and fill the others in later. printf("Case is: %i \n",Config_Case); if(Config_Case = 0) { printf("okay, we made it this far. \n"); } else printf("We can only deal with Case-P Real_Cube orientations at the moment. \n"); return(0); /* END OF PROGRAM. */ return(0); };



LinkBack URL
About LinkBacks



