Skip to content

Basic_viewer: colour faces by value (distance to the plane and cell size) - #9598

Open
RajdeepKushwaha5 wants to merge 7 commits into
CGAL:mainfrom
RajdeepKushwaha5:colour-by-value
Open

Basic_viewer: colour faces by value (distance to the plane and cell size)#9598
RajdeepKushwaha5 wants to merge 7 commits into
CGAL:mainfrom
RajdeepKushwaha5:colour-by-value

Conversation

@RajdeepKushwaha5

Copy link
Copy Markdown
Member

This adds an automatic colouring of the faces by a value, mapped to a colour from a palette, suggested by the mentors as a follow-up to the clipping work. It reuses the per-volume face groups already stored for the cap (#9566).

Palette (D key). D turns the colouring on and cycles the palette: off, then a heat, a jet and a grey ramp. The palette is evaluated in the face shader, so there is no texture and no extra data.

Value (Shift+D key). Shift+D picks the value and how it is shown:

  • distance to the plane, as a smooth per-fragment gradient;
  • the same distance, as one flat colour per cell, taken from the cell centre, so neighbouring cells with a close value do not melt into one;
  • the cell size, as one flat colour per cell.

The distance is computed in the shader from the clipping plane the user already positions with Ctrl+C, so moving the plane recolours live and nothing is stored. The size is one number per cell: for this first version it is the cell's bounding-box volume (exact for axis-aligned cells, a close proxy otherwise), normalised over the smallest and largest cell so the palette spans the whole range. The exact cell volume is a planned follow-up.

The per-cell modes draw each volume with one flat value, reusing the per-volume groups, so the colouring is consistent with the clipping. It works in every face mode, including whole-volume clipping, where the kept cells follow the same colour map.

The change is contained in Basic_shaders.h and Basic_viewer.h.

Testing: verified on grids of hexahedra (Linear_cell_complex) with varying cell sizes that the three values and the three palettes behave as described, that the per-cell modes read as flat blocks with no melting, that the size palette runs from the smallest to the largest cell and does not depend on the plane, and that the colouring holds in every clipping mode, including the kept cells in whole-volume clipping.

Commits (the colour work on top of #9585)

836c619 Basic_viewer: colour faces by value (distance to the clipping plane)
36dd84d Basic_viewer: colour by value per cell (one flat colour per cell)
f34531a Basic_viewer: add cell size as a colour-by-value source
4caf4e3 Basic_viewer: colour the kept volumes in whole-volume clipping

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.

2 participants