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

Polyhedron demo - Use subdomain's color only when meshing from labeled images #7800

Merged

Conversation

ange-clement
Copy link
Member

Summary of Changes

Fixes issue #7799 : Surface_patch_index are not colored anymore.
Now, Surface_patch_index are colored by default.
But when meshing from labelled images, the subdomain colors are used.

Release Management

@ange-clement
Copy link
Member Author

image_mesh_color
Tetrahedral meshing from an image and tetrahedral meshing from a mesh.

@lrineau lrineau added the presentation Used to select pull-requests to include in a branch for a presentation label Oct 16, 2023
lrineau added a commit to lrineau/cgal that referenced this pull request Oct 16, 2023
…e_patch_index-color

Polyhedron demo - Use subdomain's color only when meshing from labeled images

# Conflicts:
#	Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp
@sloriot sloriot added the Batch_2 Second Batch of PRs under testing label Oct 16, 2023
Domains colors better follow item color
@sloriot sloriot added Batch_1 First Batch of PRs under testing Under Testing and removed Batch_2 Second Batch of PRs under testing Batch_1 First Batch of PRs under testing labels Oct 24, 2023
@sloriot
Copy link
Member

sloriot commented Nov 2, 2023

Successfully tested in CGAL-6.0-Ic-96

@lrineau lrineau self-assigned this Nov 2, 2023
@lrineau lrineau added the rm only: ready for master For the release team only: that indicates that a PR is about to be merged in 'master' label Nov 2, 2023
@lrineau lrineau merged commit 65183a9 into CGAL:master Nov 6, 2023
9 checks passed
@lrineau lrineau removed rm only: ready for master For the release team only: that indicates that a PR is about to be merged in 'master' presentation Used to select pull-requests to include in a branch for a presentation labels Nov 6, 2023
Comment on lines +889 to +897
double i = -1;
double patch_hsv_value = use_subdomain_colors ? fmod(c.valueF() + .5, 1.) : c.valueF();
for (Indices::iterator it = surface_patch_indices_.begin(),
end = surface_patch_indices_.end(); it != end; ++it, i += 1.)
{
double hue = c.hueF() + 1. / double(nb_patch_indices) * i;
if (hue > 1) { hue -= 1.; }
colors[*it] = QColor::fromHsvF(hue, c.saturationF(), patch_hsv_value);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ange-clement I have an issue with the demo, and it is caused by this old PR (merged Nov 6 2023).

I think the issue is with this loop (and the next one, that is similar).

Let's suppose nb_patch_indices==1. At the first iteration of the loop, i is equal to -1, and the expression

                 c.hueF() + 1. / double(nb_patch_indices) * i

is equal to

                 c.hueF() - 1.

and then is almost certainly an invalid hue (the only valid negative hue is -1.f, for achromatic colors).

Why start i at -1 instead of 0 like it was before?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is more, but that is not directly related to your PR, hue should be in float instead of double.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Polyhedron demo - Surface_patch_index not colored anymore
4 participants