Code

Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in...
[inkscape.git] / src / 2geom / basic-intersection.h
1 /**
2  * \file
3  * \brief  \todo brief description
4  *
5  * Authors:
6  *      ? <?@?.?>
7  * 
8  * Copyright ?-?  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  *
33  */
35 #ifndef SEEN_GEOM_BASICINTERSECTION_H
36 #define SEEN_GEOM_BASICINTERSECTION_H
38 #include <2geom/point.h>
39 #include <2geom/sbasis.h>
40 #include <2geom/d2.h>
42 #include <vector>
43 #include <utility>
45 #define USE_RECURSIVE_INTERSECTOR 0
48 namespace Geom {
50 //why not allowing precision to be set here?
51 void find_intersections(std::vector<std::pair<double, double> >& xs,
52                         D2<SBasis> const & A,
53                         D2<SBasis> const & B);
55 void find_intersections(std::vector< std::pair<double, double> > & xs,
56                          std::vector<Point> const& A,
57                          std::vector<Point> const& B,
58                          double precision = 1e-5);
60 //why not allowing precision to be set here?
61 void find_self_intersections(std::vector<std::pair<double, double> >& xs,
62                              D2<SBasis> const & A);
65 //--not implemented
66 //void find_self_intersections(std::vector<std::pair<double, double> >& xs,
67 //                             std::vector<Point> const & A);
70 //TODO: this should be moved to .cpp, shouldn't it?
71 // #ifdef USE_RECURSIVE_INTERSECTOR
72 // /*
73 //  * find_intersection
74 //  *
75 //  *  input: A, B       - set of control points of two Bezier curve
76 //  *  input: precision  - required precision of computation
77 //  *  output: xs        - set of pairs of parameter values
78 //  *                      at which crossing happens
79 //  */
80 // void find_intersections_bezier_recursive (std::vector< std::pair<double, double> > & xs,
81 //                          std::vector<Point> const& A,
82 //                          std::vector<Point> const& B,
83 //                          double precision = 1e-5);
84 // #else
85 /*
86  * find_intersection
87  *
88  *  input: A, B       - set of control points of two Bezier curve
89  *  input: precision  - required precision of computation
90  *  output: xs        - set of pairs of parameter values
91  *                      at which crossing happens
92  *
93  *  This routine is based on the Bezier Clipping Algorithm,
94  *  see: Sederberg, Nishita, 1990 - Curve intersection using Bezier clipping
95  */
96 void find_intersections_bezier_clipping (std::vector< std::pair<double, double> > & xs,
97                          std::vector<Point> const& A,
98                          std::vector<Point> const& B,
99                          double precision = 1e-5);
100 //#endif
104 /*
105  * find_collinear_normal
106  *
107  *  input: A, B       - set of control points of two Bezier curve
108  *  input: precision  - required precision of computation
109  *  output: xs        - set of pairs of parameter values
110  *                      at which there are collinear normals
111  *
112  *  This routine is based on the Bezier Clipping Algorithm,
113  *  see: Sederberg, Nishita, 1990 - Curve intersection using Bezier clipping
114  */
115 void find_collinear_normal (std::vector< std::pair<double, double> >& xs,
116                             std::vector<Point> const& A,
117                             std::vector<Point> const& B,
118                             double precision = 1e-5);
120 void polish_intersections(std::vector<std::pair<double, double> > &xs, 
121                           D2<SBasis> const &A,
122                           D2<SBasis> const &B);
125 /**
126  * Compute the Hausdorf distance from A to B only.
127  */
128 double hausdorfl(D2<SBasis>& A, D2<SBasis> const& B,
129                  double m_precision,
130                  double *a_t=0, double* b_t=0);
132 /** 
133  * Compute the symmetric Hausdorf distance.
134  */
135 double hausdorf(D2<SBasis>& A, D2<SBasis> const& B,
136                 double m_precision,
137                 double *a_t=0, double* b_t=0);
140 #endif // !SEEN_GEOM_BASICINTERSECTION_H
142 /*
143   Local Variables:
144   mode:c++
145   c-file-style:"stroustrup"
146   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
147   indent-tabs-mode:nil
148   fill-column:99
149   End:
150 */
151 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :