Code

053c2d285c7ab360c03aae02c8d813028bfeee23
[inkscape.git] / src / 2geom / sbasis-math.h
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>
46 namespace Geom{
47 //-|x|---------------------------------------------------------------
48 Piecewise<SBasis> abs(          SBasis const &f);
49 Piecewise<SBasis> abs(Piecewise<SBasis>const &f);
51 //- max(f,g), min(f,g) ----------------------------------------------
52 Piecewise<SBasis> max(          SBasis  const &f,           SBasis  const &g);
53 Piecewise<SBasis> max(Piecewise<SBasis> const &f,           SBasis  const &g);
54 Piecewise<SBasis> max(          SBasis  const &f, Piecewise<SBasis> const &g);
55 Piecewise<SBasis> max(Piecewise<SBasis> const &f, Piecewise<SBasis> const &g);
56 Piecewise<SBasis> min(          SBasis  const &f,           SBasis  const &g);
57 Piecewise<SBasis> min(Piecewise<SBasis> const &f,           SBasis  const &g);
58 Piecewise<SBasis> min(          SBasis  const &f, Piecewise<SBasis> const &g);
59 Piecewise<SBasis> min(Piecewise<SBasis> const &f, Piecewise<SBasis> const &g);
61 //-sign(x)---------------------------------------------------------------
62 Piecewise<SBasis> signSb(          SBasis const &f);
63 Piecewise<SBasis> signSb(Piecewise<SBasis>const &f);
65 //-Sqrt---------------------------------------------------------------
66 Piecewise<SBasis> sqrt(          SBasis const &f, double tol=1e-3, int order=3);
67 Piecewise<SBasis> sqrt(Piecewise<SBasis>const &f, double tol=1e-3, int order=3);
69 //-sin/cos--------------------------------------------------------------
70 Piecewise<SBasis> cos(          SBasis  const &f, double tol=1e-3, int order=3);
71 Piecewise<SBasis> cos(Piecewise<SBasis> const &f, double tol=1e-3, int order=3);
72 Piecewise<SBasis> sin(          SBasis  const &f, double tol=1e-3, int order=3);
73 Piecewise<SBasis> sin(Piecewise<SBasis> const &f, double tol=1e-3, int order=3);
74 //-Log---------------------------------------------------------------
75 Piecewise<SBasis> log(          SBasis const &f, double tol=1e-3, int order=3);
76 Piecewise<SBasis> log(Piecewise<SBasis>const &f, double tol=1e-3, int order=3);
78 //--1/x------------------------------------------------------------
79 //TODO: change this...
80 Piecewise<SBasis> reciprocalOnDomain(Interval range, double tol=1e-3);
81 Piecewise<SBasis> reciprocal(          SBasis const &f, double tol=1e-3, int order=3);
82 Piecewise<SBasis> reciprocal(Piecewise<SBasis>const &f, double tol=1e-3, int order=3);
84 }
86 #endif //SEEN_GEOM_PW_SB_CALCULUS_H
88 /*
89   Local Variables:
90   mode:c++
91   c-file-style:"stroustrup"
92   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
93   indent-tabs-mode:nil
94   fill-column:99
95   End:
96 */
97 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :