-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
phlummox
committed
Dec 14, 2020
1 parent
c92aaf3
commit 13a95f9
Showing
11 changed files
with
1,029 additions
and
1,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
#ifndef VEdge_h | ||
#define VEdge_h | ||
|
||
#include "Vpoint.h" | ||
#include <iostream> | ||
|
||
/* | ||
A class that stores an edge in Voronoi diagram | ||
start : pointer to start point | ||
end : pointer to end point | ||
left : pointer to Voronoi place on the left side of edge | ||
right : pointer to Voronoi place on the right side of edge | ||
neighbour : some edges consist of two parts, so we add the pointer to another part to connect them at the end of an algorithm | ||
direction : directional vector, from "start", points to "end", normal of |left, right| | ||
f, g : directional coeffitients satisfying equation y = f*x + g (edge lies on this line) | ||
*/ | ||
|
||
class VEdge | ||
{ | ||
public: | ||
|
||
VPoint * start; | ||
VPoint * end; | ||
VPoint * direction; | ||
VPoint * left; | ||
VPoint * right; | ||
|
||
double f; | ||
double g; | ||
|
||
VEdge * neighbour; | ||
|
||
/* | ||
Constructor of the class | ||
s : pointer to start | ||
a : pointer to left place | ||
b : pointer to right place | ||
*/ | ||
|
||
VEdge(VPoint * s, VPoint * a, VPoint * b) | ||
{ | ||
start = s; | ||
left = a; | ||
right = b; | ||
neighbour = 0; | ||
end = 0; | ||
|
||
f = (b->x - a->x) / (a->y - b->y) ; | ||
g = s->y - f * s->x ; | ||
direction = new VPoint(b->y - a->y, -(b->x - a->x)); | ||
} | ||
|
||
/* | ||
Destructor of the class | ||
direction belongs only to the current edge, other pointers can be shared by other edges | ||
*/ | ||
|
||
~VEdge() | ||
{ | ||
delete direction ; | ||
} | ||
|
||
}; | ||
|
||
#ifndef VEdge_h | ||
#define VEdge_h | ||
|
||
#include "Vpoint.h" | ||
#include <iostream> | ||
|
||
/* | ||
A class that stores an edge in Voronoi diagram | ||
start : pointer to start point | ||
end : pointer to end point | ||
left : pointer to Voronoi place on the left side of edge | ||
right : pointer to Voronoi place on the right side of edge | ||
neighbour : some edges consist of two parts, so we add the pointer to another part to connect them at the end of an algorithm | ||
direction : directional vector, from "start", points to "end", normal of |left, right| | ||
f, g : directional coeffitients satisfying equation y = f*x + g (edge lies on this line) | ||
*/ | ||
|
||
class VEdge | ||
{ | ||
public: | ||
|
||
VPoint * start; | ||
VPoint * end; | ||
VPoint * direction; | ||
VPoint * left; | ||
VPoint * right; | ||
|
||
double f; | ||
double g; | ||
|
||
VEdge * neighbour; | ||
|
||
/* | ||
Constructor of the class | ||
s : pointer to start | ||
a : pointer to left place | ||
b : pointer to right place | ||
*/ | ||
|
||
VEdge(VPoint * s, VPoint * a, VPoint * b) | ||
{ | ||
start = s; | ||
left = a; | ||
right = b; | ||
neighbour = 0; | ||
end = 0; | ||
|
||
f = (b->x - a->x) / (a->y - b->y) ; | ||
g = s->y - f * s->x ; | ||
direction = new VPoint(b->y - a->y, -(b->x - a->x)); | ||
} | ||
|
||
/* | ||
Destructor of the class | ||
direction belongs only to the current edge, other pointers can be shared by other edges | ||
*/ | ||
|
||
~VEdge() | ||
{ | ||
delete direction ; | ||
} | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
#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 | ||
*/ | ||
|
||
class VEvent | ||
{ | ||
public: | ||
VPoint * point; | ||
bool pe; | ||
double y; | ||
VParabola * arch; | ||
|
||
/* | ||
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 = 0; | ||
} | ||
|
||
/* | ||
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 | ||
#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 | ||
*/ | ||
|
||
class VEvent | ||
{ | ||
public: | ||
VPoint * point; | ||
bool pe; | ||
double y; | ||
VParabola * arch; | ||
|
||
/* | ||
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 = 0; | ||
} | ||
|
||
/* | ||
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 |
Oops, something went wrong.