33 std::numeric_limits<qreal>::max());
74 QString cmd =
_(
"curve(");
77 foreach (
const Point &p, *
this) {
78 QString par =
_(
",%1,%2");
79 cmd += par.arg(p.x()).arg(p.y());
115 if (!it.findNext(p))
return;
116 if ((!check) || (it.hasPrevious() && it.hasNext()))
123 if (isEmpty())
return;
125 QMutableListIterator<Point> it(*
this);
126 while (it.hasNext()) {
127 Point &p = it.next();
128 p.setX(0.5 + p.x() / 2.0);
137 if (isEmpty())
return;
140 while (it.hasNext()) {
149 if ((x < 0.0) || (x > 1.0)) {
150 qWarning(
"Curve::insert(%0.2f,%0.2f): out of range !",x,y);
161 if (isEmpty())
return;
163 QMutableListIterator<Point> it(*
this);
164 while (it.hasNext()) {
165 Point &p = it.next();
168 append(
Point(1.0, first().y()));
174 if (isEmpty())
return;
176 QMutableListIterator<Point> it(*
this);
177 while (it.hasNext()) {
178 Point &p = it.next();
186 if (isEmpty())
return;
189 QMutableListIterator<Point> it(*
this);
190 while (it.hasNext()) {
191 Point &p = it.next();
202 double min = std::numeric_limits<double>::max();
203 double max = std::numeric_limits<double>::min();
208 foreach (
double yi, y) {
209 if (yi > max) max = yi;
210 if (yi < min) min = yi;
213 QMutableListIterator<Point> it(*
this);
214 while (it.hasNext()) {
215 Point &p = it.next();
217 if (!qFuzzyCompare(max, min))
218 p.ry() /= (max - min);
229 double min_dist = tol;
231 QMutableListIterator<Point> it(*
this);
232 while (it.hasNext()) {
233 Point &p = it.next();
235 double dist = hypot(px - p.x(), py - p.y());
236 if (dist < min_dist) {
247 return (a.x() < b.x());
254 std::sort(begin(), end(),
cmp);
Kwave::interpolation_t type()
void scaleFit(unsigned int range=1024)
QMutableListIterator< QPointF > Iterator
static QString name(Kwave::interpolation_t type)
void insert(double x, double y)
void fromCommand(const QString &command)
static bool cmp(const Kwave::Curve::Point &a, const Kwave::Curve::Point &b)
Kwave::Interpolation & interpolation()
bool prepareInterpolation(const Kwave::Curve &points)
Kwave::interpolation_t interpolationType()
void setInterpolationType(Kwave::interpolation_t type)
QVector< double > interpolation(const Kwave::Curve &points, unsigned int len)
Kwave::Interpolation m_interpolation
void deletePoint(Point p, bool check)
const QString & firstParam()
Point findPoint(double x, double y, double tol=.05)
static Kwave::interpolation_t find(const QString &name)
void setType(Kwave::interpolation_t t)