Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convex Cell: VBW::index_t or ushort #234

Open
PlathC opened this issue Feb 25, 2025 · 0 comments
Open

Convex Cell: VBW::index_t or ushort #234

PlathC opened this issue Feb 25, 2025 · 0 comments

Comments

@PlathC
Copy link

PlathC commented Feb 25, 2025

I'm building Voronoi cell geometry from the triangulation through the ConvexCell class as follows:

for(GEO::index_t nn = 0; nn < cell.nb_v(); nn++) {
    if(cell.vertex_triangle(nn) == VBW::END_OF_LIST)
        continue;

    if(cell.v_global_index(nn) == VBW::global_index_t(-1))
        continue;

    VBW::index_t start = cell.vertex_triangle(nn);
    VBW::index_t t = start;
    do {
        if(t != GEO::index_t(-1)) {
            // Here: t must be converted to VBW::ushort
            const GEO::vec3 vertex = cell.triangle_point(t);
            
            // Actual computation on cell vertex
        }

        // Continue traversal
        VBW::index_t lv = cell.triangle_find_vertex(t, nn);
        t = cell.triangle_adjacent(t, (lv + 1) % 3);
    } while(t != start);
}

In this example, the user must perform a cast from VBW::index_t to VBW::ushort even if it seems that the API actually only needs a VBW::ushort from function declaration:

  • index_t vertex_triangle(index_t v) const -> Returns a VBW::index_t by performing a cast from a VBW::ushort.
  • vec3 triangle_point(ushort t) const -> Asks for a VBW::ushort which is converted to VBW::index_t in its call of compute_triangle_point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant