Skip to content

Add example and modify document for class Color#304

Merged
ahcorde merged 4 commits intogazebosim:ign-math6from
AzulRadio:ign-math6
Dec 15, 2021
Merged

Add example and modify document for class Color#304
ahcorde merged 4 commits intogazebosim:ign-math6from
AzulRadio:ign-math6

Conversation

@AzulRadio
Copy link
Copy Markdown
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

@AzulRadio AzulRadio requested a review from scpeters as a code owner December 11, 2021 06:00
@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
AzulRadio and others added 3 commits December 11, 2021 09:07
Signed-off-by: youhy <haoyuan2019@outlook.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Signed-off-by: youhy <haoyuan2019@outlook.com>
Signed-off-by: youhy <haoyuan2019@outlook.com>
Signed-off-by: youhy <haoyuan2019@outlook.com>
@codecov
Copy link
Copy Markdown

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.

@AzulRadio AzulRadio requested a review from ahcorde December 15, 2021 04:44
@ahcorde
Copy link
Copy Markdown
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
Copy Markdown

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.

5 participants