summaryrefslogtreecommitdiffstats
path: root/src/2geom/basic-intersection.h
blob: d464891f92be972d080b899b62d95919ad6e1ab5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <2geom/point.h>
#include <2geom/sbasis.h>
#include <2geom/d2.h>

#include <vector>
#include <utility>


namespace Geom {

std::vector<std::pair<double, double> >
find_intersections( D2<SBasis> const & A,
                    D2<SBasis> const & B);

std::vector<std::pair<double, double> >
find_self_intersections(D2<SBasis> const & A);

// Bezier form
std::vector<std::pair<double, double> >
find_intersections( std::vector<Point> const & A,
                    std::vector<Point> const & B);

std::vector<std::pair<double, double> >
find_self_intersections(std::vector<Point> const & A);


/*
 * find_intersection
 *
 *  input: A, B       - set of control points of two Bezier curve
 *  input: precision  - required precision of computation
 *  output: xs        - set of pairs of parameter values
 *                      at which crossing happens
 *
 *  This routine is based on the Bezier Clipping Algorithm,
 *  see: Sederberg - Computer Aided Geometric Design
 */
void find_intersections (std::vector< std::pair<double, double> > & xs,
                         std::vector<Point> const& A,
                         std::vector<Point> const& B,
                         double precision = 1e-5);

};

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :