star-uniq

Filter out repeated triangles
git clone git://git.meso-star.fr/star-uniq.git
Log | Files | Refs | README | LICENSE

commit 4744699fd3e0907fb5e1542331cc9ec611fa23e6
parent 8201843bb76e1de0169eebe0b40b3850d421c908
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 22 May 2025 11:35:26 +0200

Rename member variable of key data structure

Remove the "__" suffix used to encourage the user not to access it
directly. The structure was originally publicly defined, but has now
been made private. Thus, _by construction_, the user cannot access it.
The suffix therefore becomes unnecessary.

Diffstat:
Msrc/suniq.c | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/suniq.c b/src/suniq.c @@ -40,7 +40,7 @@ pos_eq(const struct pos* a, const struct pos* b) } struct key { - double sorted_vertices__[3][3]; /* Internal data */ + double sorted_vertices[3][3]; }; static const struct key KEY_NULL = {0}; @@ -49,9 +49,9 @@ key_hash(const struct key* key) { double d[9]; ASSERT(key); - d3_set(d+0, key->sorted_vertices__[0]); - d3_set(d+3, key->sorted_vertices__[1]); - d3_set(d+6, key->sorted_vertices__[2]); + d3_set(d+0, key->sorted_vertices[0]); + d3_set(d+3, key->sorted_vertices[1]); + d3_set(d+6, key->sorted_vertices[2]); return (size_t)hash_fnv64(d, sizeof(d)); } @@ -60,9 +60,9 @@ key_eq(const struct key* a, const struct key* b) { ASSERT(a && b); return (char) - ( d3_eq(a->sorted_vertices__[0], b->sorted_vertices__[0]) - && d3_eq(a->sorted_vertices__[1], b->sorted_vertices__[1]) - && d3_eq(a->sorted_vertices__[2], b->sorted_vertices__[2])); + ( d3_eq(a->sorted_vertices[0], b->sorted_vertices[0]) + && d3_eq(a->sorted_vertices[1], b->sorted_vertices[1]) + && d3_eq(a->sorted_vertices[2], b->sorted_vertices[2])); } /* Generate the hash table that maps a triangle key to an index */ @@ -114,9 +114,9 @@ key_setup(struct key* key, const struct suniq_triangle* tri) ASSERT(key && tri); - d3_set(key->sorted_vertices__[0], tri->vertices[0]); - d3_set(key->sorted_vertices__[1], tri->vertices[1]); - d3_set(key->sorted_vertices__[2], tri->vertices[2]); + d3_set(key->sorted_vertices[0], tri->vertices[0]); + d3_set(key->sorted_vertices[1], tri->vertices[1]); + d3_set(key->sorted_vertices[2], tri->vertices[2]); #define SWAP3(A, B) { \ SWAP(double, A[0], B[0]); \ @@ -125,7 +125,7 @@ key_setup(struct key* key, const struct suniq_triangle* tri) } (void)0 /* Bubble sort (ascending order) */ - v = key->sorted_vertices__; + v = key->sorted_vertices; if(cmp_d3(v[0], v[1]) > 0) SWAP3(v[0], v[1]); if(cmp_d3(v[1], v[2]) > 0) SWAP3(v[1], v[2]); if(cmp_d3(v[0], v[1]) > 0) SWAP3(v[0], v[1]);