tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
side.hpp
Go to the documentation of this file.
1 /**
2  * Copyright (C) 2011
3  * University of Rochester Department of Computer Science
4  * and
5  * Lehigh University Department of Computer Science and Engineering
6  *
7  * License: Modified BSD
8  * Please see the file LICENSE.RSTM for licensing information
9  */
10 
11 /* side.hpp
12  *
13  * Data structure to represent one side of a stitching-up operation.
14  * Contains methods to move around the border of a convex hull.
15  */
16 
17 #ifndef SIDE_HPP__
18 #define SIDE_HPP__
19 
20 #include "common.hpp"
21 #include "point.hpp"
22 #include "edge.hpp"
23 
24 // Point p is assumed to lie on a convex hull. Return the edge that
25 // lies dir of p on the hull.
26 //
28 
29 struct pv_side {
30  point* p; // working point
31  edge* a; // where we came from
32  edge* b; // where we're going to
33  point* ap; // at far end of a
34  point* bp; // at far end of b
35  int ai; // index of p within a
36  int bi; // index of p within b
37  int dir; // which way are we moving?
38 
39  // No non-trivial constructor.
40 
41  // pt is a point on a convex hull.
42  // Initialize such that a and b are the the edges with the
43  // external angle, and b is d (ccw, cw) of a.
44  //
45  void initialize(point* pt, int d);
46 
47  // e is an edge between two regions in the process of being
48  // stitched up. pt is an endpoint of e. After reinitialization,
49  // a should be e, ai should be e->index_of(pt), and b should be d
50  // of a at end ai.
51  //
52  void reinitialize(edge* e, point* pt, int d);
53 
54  // Nearby edges may have been updated. Make sure a and
55  // b still flank endpoints of mid in direction d.
56  // This means that mid _becomes_ a.
57  //
58  void update(edge* mid, int d);
59 
60  // Move one edge along a convex hull (possibly with an external
61  // edge attached at p), provided we stay in sight of point o.
62  // Return edge we moved across, or null if unable to move.
63  //
64  edge* move(point* o);
65 
66  // We're stitching up a seam. 'This' captures one side of
67  // current base edge (not explicitly needed). Edge bottom is at
68  // the "bottom" (initial end) of the seam; tells us if we cycle all
69  // the way around. Point o is at other end of base. Find candidate
70  // endpoint for new edge on this side, moving "up" the seam.
71  // Break edges as necessary.
72  //
73  point* find_candidate(edge* bottom, point* o);
74 
75  // Move one edge along a convex hull (possibly with an external
76  // edge attached at p), provided we stay in sight of point o
77  // and don't get too close to the next seam.
78  // Return edge we moved across, or null if we didn't move.
79  //
80  edge* conditional_move(point* o, int seam);
81 };
82 
83 struct tx_side {
84  point* p; // working point
85  edge* b; // where we're going to
86  point* bp; // at far end of b
87  int bi; // index of p within b
88  int dir; // which way are we moving?
89 
90  // No non-trivial constructor.
91 
92  // e is an edge between two regions in the process of being
93  // stitched up. pt is an endpoint of e. After initialization,
94  // b should be d of e at the p end, bi should be the p end of b,
95  // and bp should be at the other end of b.
96  //
97  TRANSACTION_SAFE void initialize(edge* e, point* pt, int d);
98 
99  // Move one edge along a convex hull (possibly with an external
100  // edge attached at p), provided we stay in sight of point o.
101  // Return edge we moved across, or null if unable to move.
102  //
104 };
105 
106 #endif // SIDE_HPP__
int dir
Definition: side.hpp:88
edge * b
Definition: side.hpp:32
Definition: side.hpp:83
TRANSACTION_SAFE void initialize(edge *e, point *pt, int d)
Definition: side.cpp:78
point * ap
Definition: side.hpp:33
void initialize(point *pt, int d)
Definition: side.cpp:56
#define TRANSACTION_SAFE
Definition: common.hpp:87
void reinitialize(edge *e, point *pt, int d)
Definition: side.cpp:105
Definition: side.hpp:29
Definition: point.hpp:33
point * bp
Definition: side.hpp:86
void update(edge *mid, int d)
Definition: side.cpp:90
Definition: edge.hpp:36
int ai
Definition: side.hpp:35
int dir
Definition: side.hpp:37
point * p
Definition: side.hpp:84
edge * move(point *o)
Definition: side.cpp:114
TRANSACTION_SAFE edge * hull_edge(point *p, int dir)
Definition: side.cpp:22
struct @18 p
int bi
Definition: side.hpp:87
int bi
Definition: side.hpp:36
point * find_candidate(edge *bottom, point *o)
Definition: side.cpp:170
edge * conditional_move(point *o, int seam)
Definition: side.cpp:144
point * bp
Definition: side.hpp:34
point * p
Definition: side.hpp:30
TRANSACTION_SAFE edge * move(point *o)
Definition: side.cpp:127
edge * b
Definition: side.hpp:85
edge * a
Definition: side.hpp:31