23class CurveOptions final
92 static constexpr
double EXPONENT_CURVINESS_BOUND = 0.95;
93 static constexpr
double VITAL_CURVINESS_BOUND = 1.00;
97 CurveOptions () = default;
98 CurveOptions (
double curviness,
Algorithm algo);
108 friend
bool operator== (const CurveOptions &a, const CurveOptions &b);
111 static constexpr auto kCurvinessKey =
"curviness"sv;
112 static constexpr auto kAlgorithmKey =
"algorithm"sv;
113 friend
void to_json (nlohmann::json &j, const CurveOptions &opts);
114 friend
void from_json (const nlohmann::json &j, CurveOptions &opts);
130class CurveOptionsQmlAdapter :
public QObject
134 double curviness READ curviness WRITE setCurviness NOTIFY curvinessChanged)
137 setAlgorithm NOTIFY algorithmChanged)
142 CurveOptionsQmlAdapter (
CurveOptions &options, QObject * parent =
nullptr)
143 : QObject (parent), options_ (options)
151 double curviness ()
const {
return options_.curviness_; }
152 void setCurviness (
double curviness)
154 if (qFuzzyCompare (options_.curviness_, curviness))
157 curviness = std::clamp (curviness, -1.0, 1.0);
158 options_.curviness_ = curviness;
159 Q_EMIT curvinessChanged (curviness);
161 Q_SIGNAL
void curvinessChanged (
double curviness);
165 return options_.algo_;
169 if (options_.algo_ == algorithm)
172 options_.algo_ = algorithm;
173 Q_EMIT algorithmChanged (algorithm);
178 Q_INVOKABLE
double normalizedY (
double x,
bool startHigher)
const
180 return options_.get_normalized_y (x, startHigher);