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

Add example and modify document for class Color #304

Merged
merged 4 commits into from
Dec 15, 2021

Conversation

AzulRadio
Copy link
Contributor

Update Document

Add an example for class Color as one goal mentioned in #300

Summary

Add an example for class Color and change the existing documents.

Test it

cd example
mkdir build
cmake ../
make
./color_example

Others

I found something weird about the ignition::math::Color::HSV() and ignition::math::Color::SetFromHSV() when writing the example. When using the return value of the HSV() as the input for SetFromHSV(), the value of the instance is inconsistent. But I am not sure if it is a bug or I'm just using it the wrong way so I am not sure if making it a separate issue is a good idea.

Like this (put it in /example)

#include <iostream>
#include <ignition/math/Color.hh>

int main() 
{
  ignition::math::Color a = ignition::math::Color(0.5, 0.6, 0.7);
  std::cout << "The RGBA value of a: " << a << std::endl;
  std::cout << "The HSV value of a: " << a.HSV() << std::endl;
  
  // use its own HSV value to set HSV value, should be exactly the same.
  a.ignition::math::Color::SetFromHSV(a.HSV()[0], a.HSV()[1], a.HSV()[2]);
  std::cout << "The RGBA value of a: " << a << std::endl;
  std::cout << "The HSV value of a: " << a.HSV() << std::endl;

  // one more time
  a.ignition::math::Color::SetFromHSV(a.HSV()[0], a.HSV()[1], a.HSV()[2]);
  std::cout << "The RGBA value of a: " << a << std::endl;
  std::cout << "The HSV value of a: " << a.HSV() << std::endl;
}

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@github-actions github-actions bot added Gazebo 1️1️ Dependency of Gazebo classic version 11 🌱 garden Ignition Garden 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🏰 citadel Ignition Citadel 🔮 dome Ignition Dome labels Dec 11, 2021
examples/color_example.cc Outdated Show resolved Hide resolved
examples/color_example.cc Show resolved Hide resolved
AzulRadio and others added 3 commits December 11, 2021 09:07
Signed-off-by: youhy <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: youhy <[email protected]>
Signed-off-by: youhy <[email protected]>
@codecov
Copy link

codecov bot commented Dec 13, 2021

Codecov Report

Merging #304 (e3014be) into ign-math6 (d338701) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           ign-math6     #304   +/-   ##
==========================================
  Coverage      99.65%   99.65%           
==========================================
  Files             67       67           
  Lines           6359     6359           
==========================================
  Hits            6337     6337           
  Misses            22       22           
Impacted Files Coverage Δ
include/ignition/math/Color.hh 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d338701...e3014be. Read the comment docs.

@ahcorde
Copy link
Contributor

ahcorde commented Dec 15, 2021

Thank you for your contribution!

@ahcorde ahcorde merged commit af04dad into gazebosim:ign-math6 Dec 15, 2021
@chapulina chapulina mentioned this pull request Dec 16, 2021
45 tasks
@osrf-triage
Copy link

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-03-01-citadel-edifice-fortress/1313/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel 🔮 dome Ignition Dome 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden Gazebo 1️1️ Dependency of Gazebo classic version 11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants