Code

Line-end fix
[inkscape.git] / src / 2geom / sbasis-geometric.h
1 #ifndef _SBASIS_GEOMETRIC
2 #define _SBASIS_GEOMETRIC
3 #include "d2.h"
4 #include "piecewise.h"
5 #include <vector>
7 /** two-dimensional geometric operators.  
8  * Copyright 2007, JFBarraud
9  * Copyright 2007, njh
10  * 
11  * These operators are built on a more 'polynomially robust'
12  * transformation to map a function that takes a [0,1] parameter to a
13  * 2d vector into a function that takes the same [0,1] parameter to a
14  * unit vector with the same direction.
15  *
16  * Rather that using (X/sqrt(X))(t) which involves two unstable
17  * operations, sqrt and divide, this approach forms a curve directly
18  * from the various tangent directions at each end (angular jet).  As
19  * a result, the final path has a convergence behaviour derived from
20  * that of the sin and cos series. -- njh
21  */
23 namespace Geom{
25 Piecewise<D2<SBasis> > 
26 cutAtRoots(Piecewise<D2<SBasis> > const &M, double tol=1e-4);
28 Piecewise<SBasis>
29 atan2(D2<SBasis> const &vect, 
30            double tol=.01, unsigned order=3);
32 Piecewise<SBasis>
33 atan2(Piecewise<D2<SBasis> >const &vect, 
34            double tol=.01, unsigned order=3);
36 Piecewise<D2<SBasis> >
37 unitVector(D2<SBasis> const &vect, 
38            double tol=.01, unsigned order=3);
39 Piecewise<D2<SBasis> >
40 unitVector(Piecewise<D2<SBasis> > const &vect, 
41            double tol=.01, unsigned order=3);
43 // Piecewise<D2<SBasis> >
44 // uniform_speed(D2<SBasis> const M, 
45 //               double tol=.1);
47 Piecewise<SBasis> curvature(          D2<SBasis>   const &M, double tol=.01);
48 Piecewise<SBasis> curvature(Piecewise<D2<SBasis> > const &M, double tol=.01);
50 Piecewise<SBasis> arcLengthSb(          D2<SBasis>   const &M, double tol=.01);
51 Piecewise<SBasis> arcLengthSb(Piecewise<D2<SBasis> > const &M, double tol=.01);
53 double length(          D2<SBasis>   const &M, double tol=.01);
54 double length(Piecewise<D2<SBasis> > const &M, double tol=.01);
56 Piecewise<D2<SBasis> >
57 arc_length_parametrization(D2<SBasis> const &M, 
58                            unsigned order=3, 
59                            double tol=.01);
60 Piecewise<D2<SBasis> >
61 arc_length_parametrization(Piecewise<D2<SBasis> > const &M,
62                            unsigned order=3,
63                            double tol=.01);
66 unsigned centroid(Piecewise<D2<SBasis> > const &p, Point& centroid, double &area);
68 };
70 #endif
72 /*
73   Local Variables:
74   mode:c++
75   c-file-style:"stroustrup"
76   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
77   indent-tabs-mode:nil
78   fill-column:99
79   End:
80 */
81 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
83