1 /**
2 * \file
3 * \brief some std functions to work with (pw)s-basis
4 *
5 * Authors:
6 * Jean-Francois Barraud
7 *
8 * Copyright (C) 2006-2007 authors
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it either under the terms of the GNU Lesser General Public
12 * License version 2.1 as published by the Free Software Foundation
13 * (the "LGPL") or, at your option, under the terms of the Mozilla
14 * Public License Version 1.1 (the "MPL"). If you do not alter this
15 * notice, a recipient may use your version of this file under either
16 * the MPL or the LGPL.
17 *
18 * You should have received a copy of the LGPL along with this library
19 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * You should have received a copy of the MPL along with this library
22 * in the file COPYING-MPL-1.1
23 *
24 * The contents of this file are subject to the Mozilla Public License
25 * Version 1.1 (the "License"); you may not use this file except in
26 * compliance with the License. You may obtain a copy of the License at
27 * http://www.mozilla.org/MPL/
28 *
29 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
30 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
31 * the specific language governing rights and limitations.
32 */
34 //this a first try to define sqrt, cos, sin, etc...
35 //TODO: define a truncated compose(sb,sb, order) and extend it to pw<sb>.
36 //TODO: in all these functions, compute 'order' according to 'tol'.
37 //TODO: use template to define the pw version automatically from the sb version?
39 #ifndef SEEN_GEOM_SB_CALCULS_H
40 #define SEEN_GEOM_SB_CALCULS_H
43 #include <2geom/sbasis.h>
44 #include <2geom/piecewise.h>
45 #include <2geom/d2.h>
47 namespace Geom{
48 //-|x|---------------------------------------------------------------
49 Piecewise<SBasis> abs( SBasis const &f);
50 Piecewise<SBasis> abs(Piecewise<SBasis>const &f);
52 //- max(f,g), min(f,g) ----------------------------------------------
53 Piecewise<SBasis> max( SBasis const &f, SBasis const &g);
54 Piecewise<SBasis> max(Piecewise<SBasis> const &f, SBasis const &g);
55 Piecewise<SBasis> max( SBasis const &f, Piecewise<SBasis> const &g);
56 Piecewise<SBasis> max(Piecewise<SBasis> const &f, Piecewise<SBasis> const &g);
57 Piecewise<SBasis> min( SBasis const &f, SBasis const &g);
58 Piecewise<SBasis> min(Piecewise<SBasis> const &f, SBasis const &g);
59 Piecewise<SBasis> min( SBasis const &f, Piecewise<SBasis> const &g);
60 Piecewise<SBasis> min(Piecewise<SBasis> const &f, Piecewise<SBasis> const &g);
62 //-sign(x)---------------------------------------------------------------
63 Piecewise<SBasis> signSb( SBasis const &f);
64 Piecewise<SBasis> signSb(Piecewise<SBasis>const &f);
66 //-Sqrt---------------------------------------------------------------
67 Piecewise<SBasis> sqrt( SBasis const &f, double tol=1e-3, int order=3);
68 Piecewise<SBasis> sqrt(Piecewise<SBasis>const &f, double tol=1e-3, int order=3);
70 //-sin/cos--------------------------------------------------------------
71 Piecewise<SBasis> cos( SBasis const &f, double tol=1e-3, int order=3);
72 Piecewise<SBasis> cos(Piecewise<SBasis> const &f, double tol=1e-3, int order=3);
73 Piecewise<SBasis> sin( SBasis const &f, double tol=1e-3, int order=3);
74 Piecewise<SBasis> sin(Piecewise<SBasis> const &f, double tol=1e-3, int order=3);
75 //-Log---------------------------------------------------------------
76 Piecewise<SBasis> log( SBasis const &f, double tol=1e-3, int order=3);
77 Piecewise<SBasis> log(Piecewise<SBasis>const &f, double tol=1e-3, int order=3);
79 //--1/x------------------------------------------------------------
80 //TODO: change this...
81 Piecewise<SBasis> reciprocalOnDomain(Interval range, double tol=1e-3);
82 Piecewise<SBasis> reciprocal( SBasis const &f, double tol=1e-3, int order=3);
83 Piecewise<SBasis> reciprocal(Piecewise<SBasis>const &f, double tol=1e-3, int order=3);
85 //--interpolate------------------------------------------------------------
86 Piecewise<SBasis> interpolate( std::vector<double> times, std::vector<double> values, unsigned smoothness = 1);
87 }
89 #endif //SEEN_GEOM_PW_SB_CALCULUS_H
91 /*
92 Local Variables:
93 mode:c++
94 c-file-style:"stroustrup"
95 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
96 indent-tabs-mode:nil
97 fill-column:99
98 End:
99 */
100 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :