~lib2geom-hackers/lib2geom/trunk

« back to all changes in this revision

Viewing changes to convex-cover.h

  • Committer: njh
  • Date: 2006-05-22 11:50:24 UTC
  • Revision ID: svn-v4:4601daaa-0314-0410-9a8b-c964a3c23b6b:trunk/lib2geom:1
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "path.h"
 
2
 
 
3
/** A convex cover is a sequence of convex polygons that completely
 
4
 * cover the path.  For now a convex hull class is included here.
 
5
 */
 
6
 
 
7
namespace Geom{
 
8
 
 
9
/** ConvexHull
 
10
 * A convexhull is a convex region - every point between two points in the convex hull is also in
 
11
 * the convex hull.  It is defined by a set of points travelling in a clockwise direction.
 
12
 */
 
13
class ConvexHull{
 
14
public:
 
15
    std::vector<Point> boundary;
 
16
    
 
17
    void add_point(Point p);
 
18
    bool contains_point(Point p);
 
19
};
 
20
 
 
21
ConvexHull intersection(ConvexHull a, ConvexHull b);
 
22
ConvexHull merge(ConvexHull a, ConvexHull b);
 
23
 
 
24
// we should be concerned about singular tranforms here.
 
25
template <class T> ConvexHull operator*(ConvexHull const &p, T const &m) {
 
26
    ConvexHull pr;
 
27
    
 
28
    pr.cmd = p.cmd;
 
29
    pr.boundary.reserve(p.boundary.size());
 
30
    
 
31
    for(unsigned i = 0; i < p.boundary.size(); i++) {
 
32
        pr.boundary.push_back(p.boundary[i]*m);
 
33
    }
 
34
    return pr;
 
35
}
 
36
 
 
37
class ConvexCover{
 
38
public:
 
39
    Path* path;
 
40
    
 
41
    
 
42
};
 
43
 
 
44
};
 
45
 
 
46
/*
 
47
  Local Variables:
 
48
  mode:c++
 
49
  c-file-style:"stroustrup"
 
50
  c-file-offsets:((innamespace . 0)(substatement-open . 0))
 
51
  indent-tabs-mode:nil
 
52
  c-brace-offset:0
 
53
  fill-column:99
 
54
  End:
 
55
  vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
 
56
*/
 
57