lpe-powerstroke-interpolators.h revision 26467da82c920aae52b2c00844c12f9ea236b480
/** @file
* Interpolators for lists of points.
*/
/* Authors:
* Johan Engelen <j.b.c.engelen@alumnus.utwente.nl>
*
* Copyright (C) 2010-2011 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/spiro.h"
/// @TODO Move this to 2geom?
enum InterpolatorType {
};
Interpolator() {};
virtual ~Interpolator() {};
Interpolator(const Interpolator&);
};
Linear() {};
}
return path;
};
};
// this class is terrible
CubicBezierFit() {};
virtual ~CubicBezierFit() {};
// worst case gives us 2 segment per point
for (unsigned i = 0; i < n_points; ++i) {
}
double tolerance_sq = 0; // this value is just a random guess
if ( n_segs > 0)
{
for (int c = 0; c < n_segs; c++) {
}
}
g_free(b);
return fit;
};
CubicBezierFit(const CubicBezierFit&);
};
/// @todo invent name for this class
};
virtual ~CubicBezierJohan() {};
}
return fit;
};
}
double _beta;
CubicBezierJohan(const CubicBezierJohan&);
};
SpiroInterpolator() {};
virtual ~SpiroInterpolator() {};
for (unsigned int i = 0; i < len; ++i) {
controlpoints[i].x = points[i][X];
}
return fit;
};
SpiroInterpolator(const SpiroInterpolator&);
};
// Quick mockup for testing the behavior for powerstroke controlpoint interpolation
// return n_points-1 cubic segments
// duplicate first point
}
return fit;
};
// create interpolating bezier between p1 and p2
// Part of the code comes from StackOverflow user eriatarka84
// calculate time coords (deltas) of points
// the factor 0.25 can be generalized for other Catmull-Rom interpolation types
// see alpha in Yuksel et al. "On the Parameterization of Catmull-Rom Curves",
// safety check for repeated points
dt1 = 1.0;
// compute tangents when parameterized in [t1,t2]
// rescale tangents for parametrization in [0,1]
// create bezier from tangents (this is already in 2geom somewhere, or should be moved to it)
// the tangent of a bezier curve is: B'(t) = 3(1-t)^2 (b1 - b0) + 6(1-t)t(b2-b1) + 3t^2(b3-b2)
// So we have to make sure that B'(0) = tan1 and B'(1) = tan2, and we already know that b0=p1 and b3=p2
// tan1 = B'(0) = 3 (b1 - p1) --> p1 + (tan1)/3 = b1
// tan2 = B'(1) = 3 (p2 - b2) --> p2 - (tan2)/3 = b2
}
};
inline Interpolator*
switch (type) {
case INTERP_LINEAR:
case INTERP_CUBICBEZIER:
case INTERP_CUBICBEZIER_JOHAN:
case INTERP_SPIRO:
default:
}
}
} //namespace Interpolate
} //namespace Geom
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :