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

Feature/colour provider #564

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Erick-Mendez
Copy link

Adds an abstraction for color providers used by the plotter. ColourWheel becomes a provider, and it also adds a simple ColourCircularBuffer provider. The plotter constructor is overloaded to provide backwards compatibility, with the default being a ColourWheel provider (as before).

Same as before with the ColourWheel:
image

Using the simple ColourCircularBuffer (and shades of green):
image

The SimplePlot example is updated to showcase how this functionality works:

  bool use_wheel = true; /// By default we use a ColourWheel provider

  if (use_wheel) {
      colours = std::make_unique<pangolin::ColourWheel>(0.6);
  }
  else {
      colours = std::make_unique<pangolin::ColourCircularBuffer>();
      colours->Add(pangolin::Colour::Green().WithAlpha(0.3f));
      colours->Add(pangolin::Colour::Green().WithAlpha(0.6f));
      colours->Add(pangolin::Colour::Green().WithAlpha(0.9f));
  }

  // OpenGL 'view' of data. We might have many views of the same data.
  pangolin::Plotter plotter(&log, std::move(colours), 0.0f,4.0f*(float)M_PI/tinc,-2.0f,2.0f,(float)M_PI/(4.0f*tinc),0.5f);

tobiasmaier and others added 2 commits July 19, 2022 20:53
@Erick-Mendez
Copy link
Author

@stevenlovegrove I wonder if you could have a look at this PR. It's a relatively small feature.
(unfortunately, I cannot add reviewers myself).
Thanks!

@stevenlovegrove
Copy link
Owner

Hi Erick - sorry I've never replied on this PR. I really like the idea and have actually been meaning to modify it slightly. My main objection to the current implementation is that it breaks the API. I have also been wanting to support colormaps and have been wondering if there is a unified API that could be used for the discrete and continuous use cases.

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

Successfully merging this pull request may close these issues.

5 participants