#include <rgb.h>
Public Member Functions | |
Rgb () | |
Initialize all components to zero. | |
Rgb (float c) | |
Initialize all components to the given real number c. | |
Rgb (float _r, float _g, float _b) | |
Initialize all components to the corresponding given values. | |
Rgb | operator+ (const Rgb &other) const |
Add the given RGB other to this and return the result. | |
Rgb | operator- (const Rgb &other) const |
Subtract the given RGB other from this and return the result. | |
Rgb | operator+ (float c) const |
Add the given real number c to every component of this and return the result. | |
Rgb & | operator+= (const Rgb &other) |
Add the given RGB other to this and set this to the result. | |
Rgb | operator* (const Rgb &other) const |
Component-wisely multiply the given RGB other to this and return the result. | |
Rgb | operator* (float c) const |
Multiply the given real number c with this and return the result. | |
Rgb & | operator*= (const Rgb &other) |
Component-wisely multiply the given RGB other to this and then set this to the result. | |
Rgb | operator/ (const Rgb &other) const |
Divide all the components of this with the corresponding components of other and return the result. | |
Rgb | operator/ (float c) const |
Divide all the components of this with the given real number c and return the result. | |
bool | is_near (const Rgb &other, float threshold=EPSILON) |
Check whether all the components of this is within threshold of the corresponding components of other or not. | |
Public Attributes | |
float | r |
intensity of the color red | |
float | g |
intensity of the color green | |
float | b |
intensity of the color blue |
Rgb::Rgb | ( | ) | [inline] |
Initialize all components to zero.
Rgb::Rgb | ( | float | c | ) | [inline] |
Initialize all components to the given real number c.
Rgb::Rgb | ( | float | _r, | |
float | _g, | |||
float | _b | |||
) | [inline] |
Initialize all components to the corresponding given values.
bool Rgb::is_near | ( | const Rgb & | other, | |
float | threshold = EPSILON | |||
) | [inline] |
Check whether all the components of this is within threshold of the corresponding components of other or not.
Use this method to test approximate equality.
Rgb Rgb::operator* | ( | float | c | ) | const [inline] |
Multiply the given real number c with this and return the result.
Component-wisely multiply the given RGB other to this and return the result.
Component-wisely multiply the given RGB other to this and then set this to the result.
Rgb Rgb::operator+ | ( | float | c | ) | const [inline] |
Add the given real number c to every component of this and return the result.
Add the given RGB other to this and return the result.
Add the given RGB other to this and set this to the result.
Subtract the given RGB other from this and return the result.
Rgb Rgb::operator/ | ( | float | c | ) | const [inline] |
Divide all the components of this with the given real number c and return the result.
Divide all the components of this with the corresponding components of other and return the result.
float Rgb::b |
intensity of the color blue
float Rgb::g |
intensity of the color green
float Rgb::r |
intensity of the color red