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 D2<Piecewise<SBasis> >
37 tan2(SBasis const &angle,
38 double tol=.01, unsigned order=3);
40 D2<Piecewise<SBasis> >
41 tan2(Piecewise<SBasis> const &angle,
42 double tol=.01, unsigned order=3);
44 Piecewise<D2<SBasis> >
45 unitVector(D2<SBasis> const &vect,
46 double tol=.01, unsigned order=3);
47 Piecewise<D2<SBasis> >
48 unitVector(Piecewise<D2<SBasis> > const &vect,
49 double tol=.01, unsigned order=3);
51 // Piecewise<D2<SBasis> >
52 // uniform_speed(D2<SBasis> const M,
53 // double tol=.1);
55 Piecewise<SBasis> curvature( D2<SBasis> const &M, double tol=.01);
56 Piecewise<SBasis> curvature(Piecewise<D2<SBasis> > const &M, double tol=.01);
58 Piecewise<SBasis> arcLengthSb( D2<SBasis> const &M, double tol=.01);
59 Piecewise<SBasis> arcLengthSb(Piecewise<D2<SBasis> > const &M, double tol=.01);
61 double length( D2<SBasis> const &M, double tol=.01);
62 double length(Piecewise<D2<SBasis> > const &M, double tol=.01);
64 Piecewise<D2<SBasis> >
65 arc_length_parametrization(D2<SBasis> const &M,
66 unsigned order=3,
67 double tol=.01);
68 Piecewise<D2<SBasis> >
69 arc_length_parametrization(Piecewise<D2<SBasis> > const &M,
70 unsigned order=3,
71 double tol=.01);
74 unsigned centroid(Piecewise<D2<SBasis> > const &p, Point& centroid, double &area);
76 };
78 #endif
80 /*
81 Local Variables:
82 mode:c++
83 c-file-style:"stroustrup"
84 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
85 indent-tabs-mode:nil
86 fill-column:99
87 End:
88 */
89 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :