-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvevent.h
63 lines (53 loc) · 1.37 KB
/
vevent.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
#ifndef VEVENT_H
#define VEVENT_H
#include <iostream>
#include "vpoint.h"
#include "vparabola.h"
/*
* The class for storing place / circle event in event queue.
*
* point : the point at which current event occurs (top circle point
* for circle event, focus point for place event)
* pe : whether it is a place event or not
* y : y coordinate of "point", events are sorted by this "y"
* arch : if "pe", it is an arch above which the event occurs
* circleCenter : if not "pe", this represents the intersection in the diagram
*/
class VEvent
{
public:
VPoint *point;
bool pe;
double y;
VParabola *arch;
VPoint *circleCenter;
/*
* Constructor for the class
*
* p : point, at which the event occurs
* pev : whether it is a place event or not
*/
VEvent(VPoint *p, bool pev)
{
point = p;
pe = pev;
y = p->y;
arch = nullptr;
circleCenter = nullptr;
}
~VEvent()
{
delete circleCenter;
}
/*
* function for comparing two events (by "y" property)
*/
struct CompareEvent : public std::binary_function <VEvent *, VEvent *, bool>
{
bool operator ()(const VEvent *l, const VEvent *r) const
{
return l->y < r->y;
}
};
};
#endif // VEVENT_H