Skip to content

Feature/colour provider#564

Open
Erick-Mendez wants to merge 7 commits intostevenlovegrove:masterfrom
Erick-Mendez:feature/ColourProvider
Open

Feature/colour provider#564
Erick-Mendez wants to merge 7 commits intostevenlovegrove:masterfrom
Erick-Mendez:feature/ColourProvider

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);

@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