19 #ifndef ATOMPROBE_MISC_H 20 #define ATOMPROBE_MISC_H 52 return (oth.
red == red && oth.
green == green && oth.
blue==blue);
59 bool tolEqual(
const T &a,
const T &b,
const T &f)
67 void selectElements(
const std::vector<T> &in,
const std::vector<unsigned int> &indices, std::vector<T>& out)
69 out.resize(indices.size());
70 #pragma omp parallel for 71 for(
auto i=0u; i<indices.size(); ++i)
72 out[i]=in[indices[i]];
86 std::vector<std::vector<T> > transposed;
87 transposed.resize(v[0].size());
89 for(
size_t ui=0;ui<transposed.size();ui++)
91 transposed[ui].resize(v.size());
94 #pragma omp parallel for 95 for(
size_t ui=0;ui<v.size();ui++)
97 for(
size_t uj=0;uj<v[ui].size();uj++)
99 transposed[uj][ui]=v[ui][uj];
117 for(
size_t ui=0;ui<vec.size();ui++)
122 vec[ui-shift] = vec[ui];
124 vec.resize(vec.size()-shift);
129 bool runMiscMathsTests();
Data holder for colour as float.
void selectElements(const std::vector< T > &in, const std::vector< unsigned int > &indices, std::vector< T > &out)
Obtain the elements at positions indicies in the input vector, copy to output.
void fromHex(const std::string &s)
void vectorMultiErase(std::vector< T > &vec, const std::vector< bool > &wantKill)
Remove elements from the vector, without preserving order.
void transposeVector(std::vector< std::vector< T > > &v)
Perform an out-of-place tranposition of a given vector.
void genColString(unsigned char r, unsigned char g, unsigned char b, unsigned char a, std::string &s)
std::string toHex() const
Convert to hex-256 representation #rrggbb.
bool operator==(const RGBf &oth) const
bool parseColString(const std::string &str, unsigned char &r, unsigned char &g, unsigned char &b, unsigned char &a)
Parse a colour string containing rgb[a]; hex for with leading #.
bool tolEqual(const T &a, const T &b, const T &f)
Test for equality within tolerance f (||a-b|| < f)