17 for (
unsigned i=0; i<f.size(); i++){
37 for(
unsigned k = 1; k <
c.size() + 1; k++) {
38 double ahat = -
c[k-1].tri()/(2*k);
39 a[k][0] = a[k][1] = ahat;
42 for(
int k =
c.size()-1; k >= 0; k--) {
43 aTri = (
c[k].hat() + (k+1)*aTri/2)/(2*k+1);
55 for(
unsigned k = 1; k <
c.size() + 1; k++) {
56 T ahat = (
c[k-1][0]-
c[k-1][1])/(2*k);
61 for(
int k =
c.size()-1; k >= 0; k--) {
62 aTri = (
HatOf<T>(
c[k]).
d + (k+1)*aTri/2)/(2*k+1);
74 for(
unsigned i = 0; i< f.size(); i++) {
91 for(
int i = f.size()-1; i >= 0; i--) {
92 r = s*r + f[i][0]*u0 + f[i][1]*u1;
104 for(
int i = f.size()-1; i >= 0; i--) {
112 bool f_cst_ends =
false){
188 100+f.
cuts.back()*x_scale)));
190 g[
Y] = -f*y_scale+400;
205 for (
unsigned dim=0; dim<2; dim++){
206 curve[dim] = x*frame.x[dim] + y*frame.y[dim] + z*frame.z[dim];
207 curve[dim] += frame.O[dim];
213 for (
int i=0; i<=NbRays; i++){
226class ConvolutionToy:
public Toy {
234 std::ostringstream *notify,
235 int width,
int height,
bool save, std::ostringstream *timer_stream)
override {
248 frame.O =
Point(50,400);
249 frame.x =
Point(300,0);
250 frame.y =
Point(120,-75);
251 frame.z =
Point(0,-300);
276 adjuster.
pos[
X] = 400;
277 if(adjuster.
pos[
Y]>400) adjuster.
pos[
Y] = 400;
278 if(adjuster.
pos[
Y]<100) adjuster.
pos[
Y] = 100;
279 double scale=(400.-adjuster.
pos[
Y])/300+.01;
283 smoothB1[
X].push(
Linear(0.), 8+scale/2);
284 smoothB1[
Y].push(
Linear(0.), 8+scale/2);
286 smoothB2[
X].setDomain(
Interval(-scale/2,4-scale/2));
287 smoothB2[
Y] = smoothB2[
X];
299 cairo_set_line_width (cr, .5);
315 cairo_set_line_width (cr, .5);
325 for(
int i = 0; i <
SIZE; i++) {
338int main(
int argc,
char **argv) {
339 init(argc, argv,
new ConvolutionToy);
Conversion between Bezier control points and SBasis curves.
static int constexpr SIZE
Adaptor that creates 2D functions from 1D ones.
constexpr C extent() const
Range of real numbers that is never empty.
Function that interpolates linearly between two values.
Function defined as discrete pieces.
void push(const T &s, double to)
Convenience/implementation hiding function to add segment/cut pairs.
std::vector< double > cuts
void setDomain(Interval dom)
Two-dimensional point that doubles as a vector.
Polynomial in symmetric power basis.
void push_back(double x, double y)
Geom::D2< Geom::SBasis > asBezier()
vector< Handle * > handles
virtual void save(FILE *f)
virtual void draw(cairo_t *cr, std::ostringstream *notify, int w, int h, bool save, std::ostringstream *timing_stream)
SBasisOf< T > multi_compose(SBasisOf< double > const &f, SBasisOf< T > const &g)
SBasisOf< double > toSBasisOfDouble(SBasis const &f)
SBasisOf< T > integraaal(SBasisOf< T > const &c)
void plot3d(cairo_t *cr, SBasis const &x, SBasis const &y, SBasis const &z, Frame frame)
static void plot_graph(cairo_t *cr, Piecewise< SBasis > const &f, double x_scale=300, double y_scale=100)
Piecewise< SBasis > convole(SBasisOf< double > const &f, Interval dom_f, SBasisOf< double > const &g, Interval dom_g, bool f_cst_ends=false)
Lifts one dimensional objects into 2D.
Various utility functions.
Bezier reverse(const Bezier &a)
Bezier multiply(Bezier const &f, Bezier const &g)
Piecewise< D2< SBasis > > sectionize(D2< Piecewise< SBasis > > const &a)
D2< T > compose(D2< T > const &a, T const &b)
Bezier integral(Bezier const &a)
SBasis toSBasis(SBasisN< 1 > f)
void cairo_line_to(cairo_t *cr, Geom::Point p1)
void cairo_d2_pw_sb(cairo_t *cr, Geom::D2< Geom::Piecewise< Geom::SBasis > > const &p)
void cairo_move_to(cairo_t *cr, Geom::Point p1)
void cairo_d2_sb(cairo_t *cr, Geom::D2< Geom::SBasis > const &p)
void cairo_pw_d2_sb(cairo_t *cr, Geom::Piecewise< Geom::D2< Geom::SBasis > > const &p)
two-dimensional geometric operators.
Defines S-power basis function class with coefficient in arbitrary ring.
Polynomial in symmetric power basis (S-basis)
void cairo_set_source_rgba(cairo_t *cr, colour c)
void init(int argc, char **argv, Toy *t, int width=600, int height=600)