OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{FilamentMixer.cpp} Namespace Reference

Functions

float clamp01 (float x)
float srgb_to_linear (float x)
float linear_to_srgb (float x)
unsigned char to_u8 (float x)
float to_f01 (unsigned char x)
double parse_tangent_token (const std::string &tok)
std::vector< std::string > split_commas (const std::string &seg)

Function Documentation

◆ clamp01()

float Slic3r::anonymous_namespace{FilamentMixer.cpp}::clamp01 ( float x)
inline
31{
32 return std::max(0.0f, std::min(1.0f, x));
33}

References clamp01().

Referenced by clamp01(), and to_u8().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ linear_to_srgb()

float Slic3r::anonymous_namespace{FilamentMixer.cpp}::linear_to_srgb ( float x)
inline
41{
42 return (x >= 0.0031308f) ? (1.055f * std::pow(x, 1.0f / 2.4f) - 0.055f) : (12.92f * x);
43}

References linear_to_srgb().

Referenced by linear_to_srgb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_tangent_token()

double Slic3r::anonymous_namespace{FilamentMixer.cpp}::parse_tangent_token ( const std::string & tok)
inline
194{
195 if (tok.empty()) return std::numeric_limits<double>::quiet_NaN();
196 std::string lower(tok.size(), '\0');
197 std::transform(tok.begin(), tok.end(), lower.begin(),
198 [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
199 if (lower == "nan") return std::numeric_limits<double>::quiet_NaN();
200 try {
201 const double v = std::stod(tok);
202 if (!std::isfinite(v)) return std::numeric_limits<double>::quiet_NaN();
203 return v;
204 } catch (...) {
205 return std::numeric_limits<double>::quiet_NaN();
206 }
207}

References parse_tangent_token().

Referenced by parse_tangent_token().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_commas()

std::vector< std::string > Slic3r::anonymous_namespace{FilamentMixer.cpp}::split_commas ( const std::string & seg)
inline
213{
214 std::vector<std::string> out;
215 size_t start = 0;
216 while (true) {
217 const size_t comma = seg.find(',', start);
218 if (comma == std::string::npos) {
219 out.emplace_back(seg.substr(start));
220 return out;
221 }
222 out.emplace_back(seg.substr(start, comma - start));
223 start = comma + 1;
224 }
225}

References split_commas().

Referenced by split_commas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ srgb_to_linear()

float Slic3r::anonymous_namespace{FilamentMixer.cpp}::srgb_to_linear ( float x)
inline
36{
37 return (x >= 0.04045f) ? std::pow((x + 0.055f) / 1.055f, 2.4f) : x / 12.92f;
38}

References srgb_to_linear().

Referenced by srgb_to_linear().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_f01()

float Slic3r::anonymous_namespace{FilamentMixer.cpp}::to_f01 ( unsigned char x)
inline
52{
53 return static_cast<float>(x) / 255.0f;
54}

References to_f01().

Referenced by to_f01().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_u8()

unsigned char Slic3r::anonymous_namespace{FilamentMixer.cpp}::to_u8 ( float x)
inline
46{
47 const float clamped = clamp01(x);
48 return static_cast<unsigned char>(clamped * 255.0f + 0.5f);
49}
float clamp01(float x)
Definition FilamentMixer.cpp:30

References clamp01(), and to_u8().

Referenced by to_u8().

Here is the call graph for this function:
Here is the caller graph for this function: