Ben NanoNote 3D scans
Sign in or create your account | Project List | Help
Ben NanoNote 3D scans Commit Details
Date: | 2010-09-24 00:55:11 (13 years 6 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 06b1b08c47b19345428f0a84f8776e81a7d50370 |
Message: | Added red and green band to blue band as further visual clues. - solidify/level.c (draw_map): moved open-coded "almost at the same height" parameter to constant NEAR - solidify/level.c (draw_map): draw green and red band next to the "near" blue band |
Files: |
solidify/level.c (2 diffs) |
Change Details
solidify/level.c | ||
---|---|---|
8 | 8 | #include "level.h" |
9 | 9 | |
10 | 10 | |
11 | #define NEAR 1 | |
12 | ||
13 | ||
11 | 14 | static void draw_map(GtkWidget *widget, struct face *f) |
12 | 15 | { |
13 | 16 | int x, y, z; |
... | ... | |
27 | 30 | continue; |
28 | 31 | } |
29 | 32 | z0 = f->z_ref+f->fx*(x-f->sx/2)+f->fy*(y-f->sy/2); |
30 | if (fabs(z-z0) < 1) { | |
33 | if (fabs(z-z0) < NEAR) { | |
31 | 34 | *p++ = 255*fabs(z-z0); |
32 | 35 | *p++ = 255*fabs(z-z0); |
33 | 36 | *p++ = 255; |
34 | 37 | continue; |
35 | 38 | } |
36 | 39 | if (z < z0) { |
37 | z = 255.0*(z-z0)/(z0-f->a->min_z); | |
40 | z = z > z0-2*NEAR ? 255*(z-z0)/NEAR : | |
41 | 255.0*(z-z0)/(z0-f->a->min_z); | |
38 | 42 | *p++ = 255; |
39 | 43 | *p++ = z; |
40 | 44 | *p++ = z; |
41 | 45 | } else { |
42 | z = 255.0*(z0-z)/(f->a->max_z-z0); | |
46 | z = z < z0+2*NEAR ? 255*(z0-z)/NEAR : | |
47 | 255.0*(z0-z)/(f->a->max_z-z0); | |
43 | 48 | *p++ = z; |
44 | 49 | *p++ = 255; |
45 | 50 | *p++ = z; |
Branches:
master