chiark
/
gitweb
/
~ian
/
moebius2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
91ec108
)
sort triangles by centroids
author
Ian Jackson
<ian@davenant.relativity.greenend.org.uk>
Mon, 31 Dec 2007 02:25:15 +0000
(
02:25
+0000)
committer
Ian Jackson
<ian@davenant.relativity.greenend.org.uk>
Mon, 31 Dec 2007 02:25:15 +0000
(
02:25
+0000)
project.c
patch
|
blob
|
history
diff --git
a/project.c
b/project.c
index a2e3f9124f3fc005f05cf4864bc67f1572ed706a..266237f90b222be270b723c5845007ff85330e36 100644
(file)
--- a/
project.c
+++ b/
project.c
@@
-76,10
+76,14
@@
static void generate_display_list(void) {
}
static int dl_compare(const void *tav, const void *tbv) {
+ int i;
const Triangle *const *tap= tav, *ta= *tap;
const Triangle *const *tbp= tbp, *tb= *tbp;
- double za= ta->vertex[0][2];
- double zb= tb->vertex[0][2];
+ double za=0, zb=0;
+ for (i=0; i<3; i++) {
+ za += ta->vertex[i][2];
+ zb += tb->vertex[i][2];
+ }
return za > zb ? -1 :
za < zb ? +1 : 0;
}