Code

add missing files
[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
47 namespace Geom {
49 #ifdef USE_RECURSIVE_INTERSECTOR
50 void
51 find_intersections( std::vector<std::pair<double, double> > &xs,
52                     D2<SBasis> const & A,
53                     D2<SBasis> const & B);
55 void
56 find_self_intersections(std::vector<std::pair<double, double> > &xs,
57                         D2<SBasis> const & A);
59 // Bezier form
60 void
61 find_intersections( std::vector<std::pair<double, double> > &xs,
62                     std::vector<Point> const & A,
63                     std::vector<Point> const & B,
64                     double precision = 1e-5);
66 // Bezier form
67 void
68 find_intersections_bezier_clipping( std::vector<std::pair<double, double> > &xs,
69                                     std::vector<Point> const & A,
70                                     std::vector<Point> const & B,
71                                     double precision = 1e-5);
73 void
74 find_self_intersections(std::vector<std::pair<double, double> > &xs,
75                         std::vector<Point> const & A);
77 #else
79 /*
80  * find_intersection
81  *
82  *  input: A, B       - set of control points of two Bezier curve
83  *  input: precision  - required precision of computation
84  *  output: xs        - set of pairs of parameter values
85  *                      at which crossing happens
86  *
87  *  This routine is based on the Bezier Clipping Algorithm,
88  *  see: Sederberg, Nishita, 1990 - Curve intersection using Bezier clipping
89  */
90 void find_intersections_clipping (std::vector< std::pair<double, double> > & xs,
91                          std::vector<Point> const& A,
92                          std::vector<Point> const& B,
93                          double precision = 1e-5);
94 #endif
95 /*
96  * find_collinear_normal
97  *
98  *  input: A, B       - set of control points of two Bezier curve
99  *  input: precision  - required precision of computation
100  *  output: xs        - set of pairs of parameter values
101  *                      at which there are collinear normals
102  *
103  *  This routine is based on the Bezier Clipping Algorithm,
104  *  see: Sederberg, Nishita, 1990 - Curve intersection using Bezier clipping
105  */
106 void find_collinear_normal (std::vector< std::pair<double, double> >& xs,
107                             std::vector<Point> const& A,
108                             std::vector<Point> const& B,
109                             double precision = 1e-5);
111 void polish_intersections(std::vector<std::pair<double, double> > &xs, 
112                           D2<SBasis> const &A,
113                           D2<SBasis> const &B);
115 void find_intersections(std::vector<std::pair<double, double> >& xs,
116                         D2<SBasis> const & A,
117                         D2<SBasis> const & B);
119 void find_self_intersections(std::vector<std::pair<double, double> >& xs,
120                              D2<SBasis> const & A);
123 void find_self_intersections(std::vector<std::pair<double, double> >& xs,
124                              std::vector<Point> const & A);
128 /**
129  * Compute the Hausdorf distance from A to B only.
130  */
131 double hausdorfl(D2<SBasis>& A, D2<SBasis> const& B,
132                  double m_precision,
133                  double *a_t=0, double* b_t=0);
135 /** 
136  * Compute the symmetric Hausdorf distance.
137  */
138 double hausdorf(D2<SBasis>& A, D2<SBasis> const& B,
139                 double m_precision,
140                 double *a_t=0, double* b_t=0);
143 #endif // !SEEN_GEOM_BASICINTERSECTION_H
145 /*
146   Local Variables:
147   mode:c++
148   c-file-style:"stroustrup"
149   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
150   indent-tabs-mode:nil
151   fill-column:99
152   End:
153 */
154 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :