feat (wip): gui
This commit is contained in:
35
src/core/Colour.cpp
Normal file
35
src/core/Colour.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "Colour.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
using namespace core;
|
||||
|
||||
|
||||
Colour::Colour(const float r, const float g, const float b) {
|
||||
this->len = sqrt(r*r + g*g + b*b);
|
||||
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
}
|
||||
|
||||
|
||||
Colour::~Colour() {
|
||||
}
|
||||
|
||||
|
||||
char* Colour::toString() {
|
||||
sprintf(this->str, "%3.0f %3.0f %3.0f", round(this->r*255.0f),round(this->g*255.0f),round(this->b*255.0f));
|
||||
return this->str;
|
||||
}
|
||||
|
||||
|
||||
float Colour::getLength() const {
|
||||
return this->len;
|
||||
}
|
||||
|
||||
bool Colour::operator<(const Colour& other) const {
|
||||
return getLength() < other.getLength();
|
||||
}
|
||||
Reference in New Issue
Block a user