colors

extract colors from pictures
git clone git://git.2f30.org/colors
Log | Files | Refs | README | LICENSE

commit 2e236eb16ffd96377fae76d7dfb89f0607092a9c
parent cdaf6c549f610a478672c730a279beffadfb4c88
Author: lostd <lostd@2f30.org>
Date:   Thu,  4 Jun 2015 18:14:20 +0300

Readability fix

Diffstat:
Mcolors.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/colors.c b/colors.c @@ -17,7 +17,7 @@ struct point { }; struct cluster { - struct point c; + struct point center; TAILQ_HEAD(members, point) members; size_t nmembers; }; @@ -57,7 +57,7 @@ adjcluster(struct cluster *c) newc.x /= c->nmembers; newc.y /= c->nmembers; newc.z /= c->nmembers; - c->c = newc; + c->center = newc; } void @@ -82,7 +82,7 @@ initcluster(struct cluster *c) TAILQ_FOREACH(p, &points, e) if (i++ == sel) break; - c->c = *p; + c->center = *p; } void @@ -134,7 +134,7 @@ process(void) TAILQ_FOREACH_SAFE(p, &points, e, tmp) { /* calculate the distance of this point from all cluster centers */ for (i = 0; i < nclusters; i++) - dists[i] = distance(p, &clusters[i].c); + dists[i] = distance(p, &clusters[i].center); /* find the cluster that is nearest to the point */ mind = dists[0]; @@ -188,9 +188,9 @@ printclusters(void) for (i = 0; i < nclusters; i++) if (clusters[i].nmembers || eflag) printf("#%02x%02x%02x\n", - clusters[i].c.x, - clusters[i].c.y, - clusters[i].c.z); + clusters[i].center.x, + clusters[i].center.y, + clusters[i].center.z); } void