-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVParabola.h
78 lines (60 loc) · 2.09 KB
/
VParabola.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef VParabola_h
#define VParabola_h
#include "VPoint.h"
#include "VEdge.h"
/*
Parabolas and events have pointers to each other, so we declare class VEvent, which will be defined later.
*/
class VEvent;
/*
A class that stores information about an item in beachline sequence (see Fortune's algorithm).
It can represent an arch of parabola or an intersection between two archs (which defines an edge).
In my implementation I build a binary tree with them (internal nodes are edges, leaves are archs).
*/
class VParabola
{
public:
/*
isLeaf : flag whether the node is Leaf or internal node
site : pointer to the focus point of parabola (when it is parabola)
edge : pointer to the edge (when it is an edge)
cEvent : pointer to the event, when the arch disappears (circle event)
parent : pointer to the parent node in tree
*/
bool isLeaf;
VPoint * site;
VEdge * edge;
VEvent * cEvent;
VParabola * parent;
/*
Constructors of the class (empty for edge, with focus parameter for an arch).
*/
VParabola ();
VParabola (VPoint * s);
/*
Access to the children (in tree).
*/
void SetLeft (VParabola * p) {_left = p; p->parent = this;}
void SetRight(VParabola * p) {_right = p; p->parent = this;}
VParabola * Left () { return _left; }
VParabola * Right() { return _right; }
/*
Some useful tree operations
GetLeft : returns the closest left leave of the tree
GetRight : returns the closest right leafe of the tree
GetLeftParent : returns the closest parent which is on the left
GetLeftParent : returns the closest parent which is on the right
GetLeftChild : returns the closest leave which is on the left of current node
GetRightChild : returns the closest leave which is on the right of current node
*/
static VParabola * GetLeft (VParabola * p);
static VParabola * GetRight (VParabola * p);
static VParabola * GetLeftParent (VParabola * p);
static VParabola * GetRightParent (VParabola * p);
static VParabola * GetLeftChild (VParabola * p);
static VParabola * GetRightChild (VParabola * p);
private:
VParabola * _left;
VParabola * _right;
};
#endif