diff options
author | Kent Mein <mein@cs.umn.edu> | 2006-01-30 22:59:33 +0300 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2006-01-30 22:59:33 +0300 |
commit | 8e9222ec217ab98980ffd75cd14387a062b46c9a (patch) | |
tree | ae31e42d4c2af0725486263cd70b1f7720606c96 /intern | |
parent | ed81ff405fc6f0b459c368107343962502c99e37 (diff) |
More simple fixes to cleanup warnings and what not:
extern/bullet/BulletDynamics/ConstraintSolver/SimpleConstraintSolver.h
added newline at end of file.
intern/boolop/intern/BOP_Face2Face.cpp
fixed indentation and had nested declarations of a varible i used
for multiple for loops, changed it to just one declaration.
source/blender/blenkernel/bad_level_call_stubs/stubs.c
added prototypes and a couple other fixes.
source/blender/include/BDR_drawobject.h
source/blender/include/BSE_node.h
source/blender/include/butspace.h
source/blender/render/extern/include/RE_shader_ext.h
added struct definitions
source/blender/src/editmesh_mods.c
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
removed unused variables;
source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
changed format of case statements to avoid warnings in gcc.
Kent
Diffstat (limited to 'intern')
-rw-r--r-- | intern/boolop/intern/BOP_Face2Face.cpp | 317 |
1 files changed, 159 insertions, 158 deletions
diff --git a/intern/boolop/intern/BOP_Face2Face.cpp b/intern/boolop/intern/BOP_Face2Face.cpp index 08928935f33..7e2b6bd7b2f 100644 --- a/intern/boolop/intern/BOP_Face2Face.cpp +++ b/intern/boolop/intern/BOP_Face2Face.cpp @@ -501,173 +501,174 @@ void BOP_getPoints(BOP_Mesh* mesh, * @param invertA indicates if points of same relative face had been exchanged */ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bool &invertA, bool &invertB) { - MT_Point3 sortedPoints[4]; - unsigned int sortedFaces[4], position[4]; - unsigned int i; - if (size == 2) { + MT_Point3 sortedPoints[4]; + unsigned int sortedFaces[4], position[4]; + unsigned int i; + if (size == 2) { - // Trivial case, only test the merge ... - if (BOP_comp(0,points[0].distance(points[1]))==0) { - face[0] = 3; - size--; - } - } - else { - // size is 3 or 4 - // Get segment extreme points - MT_Scalar maxDistance = -1; - for(i=0;i<size-1;i++){ - for(unsigned int j=i+1;j<size;j++){ - MT_Scalar distance = points[i].distance(points[j]); - if (distance > maxDistance){ - maxDistance = distance; - position[0] = i; - position[size-1] = j; - } - } - } + // Trivial case, only test the merge ... + if (BOP_comp(0,points[0].distance(points[1]))==0) { + face[0] = 3; + size--; + } + } + else { + // size is 3 or 4 + // Get segment extreme points + MT_Scalar maxDistance = -1; + for(i=0;i<size-1;i++){ + for(unsigned int j=i+1;j<size;j++){ + MT_Scalar distance = points[i].distance(points[j]); + if (distance > maxDistance){ + maxDistance = distance; + position[0] = i; + position[size-1] = j; + } + } + } + + // Get segment inner points + position[1] = position[2] = size; + for(i=0;i<size;i++){ + if ((i != position[0]) && (i != position[size-1])){ + if (position[1] == size) position[1] = i; + else position[2] = i; + } + } + + // Get inner points + if (position[2] < size) { + MT_Scalar d1 = points[position[1]].distance(points[position[0]]); + MT_Scalar d2 = points[position[2]].distance(points[position[0]]); + if (d1 > d2) { + unsigned int aux = position[1]; + position[1] = position[2]; + position[2] = aux; + } + } - // Get segment inner points - position[1] = position[2] = size; - for(i=0;i<size;i++){ - if ((i != position[0]) && (i != position[size-1])){ - if (position[1] == size) position[1] = i; - else position[2] = i; - } - } + // Sort data + for(i=0;i<size;i++) { + sortedPoints[i] = points[position[i]]; + sortedFaces[i] = face[position[i]]; + } - // Get inner points - if (position[2] < size) { - MT_Scalar d1 = points[position[1]].distance(points[position[0]]); - MT_Scalar d2 = points[position[2]].distance(points[position[0]]); - if (d1 > d2) { - unsigned int aux = position[1]; - position[1] = position[2]; - position[2] = aux; - } - } + invertA = false; + invertB = false; + if (face[1] == 1) { - // Sort data - for(i=0;i<size;i++) { - sortedPoints[i] = points[position[i]]; - sortedFaces[i] = face[position[i]]; - } + // invertA¿? + for(i=0;i<size;i++) { + if (position[i] == 1) { + invertA = true; + break; + } + else if (position[i] == 0) break; + } - // invertA, invertB ¿? - invertA = false; - invertB = false; - if (face[1] == 1) { - // invertA¿? - for(i=0;i<size;i++) { - if (position[i] == 1) { - invertA = true; - break; - } - else if (position[i] == 0) break; - } - // invertB¿? - if (size == 4) { - for(unsigned int i=0;i<size;i++) { - if (position[i] == 3) { - invertB = true; - break; - } - else if (position[i] == 2) break; - } - } - } - else if (face[1] == 2) { - // invertB¿? - for(unsigned int i=0;i<size;i++) { - if (position[i] == 2) { - invertB = true; - break; - } - else if (position[i] == 1) break; - } - } + // invertB¿? + if (size == 4) { + for(i=0;i<size;i++) { + if (position[i] == 3) { + invertB = true; + break; + } + else if (position[i] == 2) break; + } + } + } + else if (face[1] == 2) { + // invertB¿? + for(i=0;i<size;i++) { + if (position[i] == 2) { + invertB = true; + break; + } + else if (position[i] == 1) break; + } + } - // Merge data - MT_Scalar d1 = sortedPoints[1].distance(sortedPoints[0]); - MT_Scalar d2 = sortedPoints[1].distance(sortedPoints[2]); - if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[0]) { - if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) { - if (d1 < d2) { - // merge 0 and 1 - sortedFaces[0] = 3; - for(unsigned int i = 1; i<size-1;i++) { - sortedPoints[i] = sortedPoints[i+1]; - sortedFaces[i] = sortedFaces[i+1]; - } - size--; - if (size == 3) { - // merge 1 and 2 ??? - d1 = sortedPoints[1].distance(sortedPoints[2]); - if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) { - // merge! - sortedFaces[1] = 3; - size--; - } - } - } - else { - // merge 1 and 2 - sortedFaces[1] = 3; - for(unsigned int i = 2; i<size-1;i++) { - sortedPoints[i] = sortedPoints[i+1]; - sortedFaces[i] = sortedFaces[i+1]; - } - size--; - } - } - else { - // merge 0 and 1 - sortedFaces[0] = 3; - for(unsigned int i = 1; i<size-1;i++) { - sortedPoints[i] = sortedPoints[i+1]; - sortedFaces[i] = sortedFaces[i+1]; - } - size--; - if (size == 3) { - // merge 1 i 2 ??? - d1 = sortedPoints[1].distance(sortedPoints[2]); - if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) { - // merge! - sortedFaces[1] = 3; - size--; - } - } - } - } - else { - if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) { - // merge 1 and 2 - sortedFaces[1] = 3; - for(unsigned int i = 2; i<size-1;i++) { - sortedPoints[i] = sortedPoints[i+1]; - sortedFaces[i] = sortedFaces[i+1]; - } - size--; - } - else if (size == 4) { - d1 = sortedPoints[2].distance(sortedPoints[3]); - if (BOP_comp(0,d1)==0 && sortedFaces[2] != sortedFaces[3]) { - // merge 2 and 3 - sortedFaces[2] = 3; - size--; - } - } - } + // Merge data + MT_Scalar d1 = sortedPoints[1].distance(sortedPoints[0]); + MT_Scalar d2 = sortedPoints[1].distance(sortedPoints[2]); + if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[0]) { + if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) { + if (d1 < d2) { + // merge 0 and 1 + sortedFaces[0] = 3; + for(i = 1; i<size-1;i++) { + sortedPoints[i] = sortedPoints[i+1]; + sortedFaces[i] = sortedFaces[i+1]; + } + size--; + if (size == 3) { + // merge 1 and 2 ??? + d1 = sortedPoints[1].distance(sortedPoints[2]); + if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) { + // merge! + sortedFaces[1] = 3; + size--; + } + } + } + else { + // merge 1 and 2 + sortedFaces[1] = 3; + for(i = 2; i<size-1;i++) { + sortedPoints[i] = sortedPoints[i+1]; + sortedFaces[i] = sortedFaces[i+1]; + } + size--; + } + } + else { + // merge 0 and 1 + sortedFaces[0] = 3; + for(i = 1; i<size-1;i++) { + sortedPoints[i] = sortedPoints[i+1]; + sortedFaces[i] = sortedFaces[i+1]; + } + size--; + if (size == 3) { + // merge 1 i 2 ??? + d1 = sortedPoints[1].distance(sortedPoints[2]); + if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) { + // merge! + sortedFaces[1] = 3; + size--; + } + } + } + } + else { + if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) { + // merge 1 and 2 + sortedFaces[1] = 3; + for(i = 2; i<size-1;i++) { + sortedPoints[i] = sortedPoints[i+1]; + sortedFaces[i] = sortedFaces[i+1]; + } + size--; + } + else if (size == 4) { + d1 = sortedPoints[2].distance(sortedPoints[3]); + if (BOP_comp(0,d1)==0 && sortedFaces[2] != sortedFaces[3]) { + // merge 2 and 3 + sortedFaces[2] = 3; + size--; + } + } + } - // Merge initial points ... - for(i=0;i<size;i++) { - points[i] = sortedPoints[i]; - face[i] = sortedFaces[i]; - } + // Merge initial points ... + for(i=0;i<size;i++) { + points[i] = sortedPoints[i]; + face[i] = sortedFaces[i]; + } - } -} + } +} /** |