-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGraph_ext.h
More file actions
80 lines (55 loc) · 1.55 KB
/
Graph_ext.h
File metadata and controls
80 lines (55 loc) · 1.55 KB
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
79
80
#ifndef GRAPH_EXT_GUARD
#define GRAPH_EXT_GUARD 1
#include <limits>
#include <Graph_lib/Graph.h>
namespace Graph_lib {
struct Arc : Ellipse
{
/// center, max and min distance from center,
/// start and end angles of the curve
Arc (Point p, int ww, int hh, int alpha, int beta);
void set_start_angle (int a) { phi1 = a; }
int start_angle () const { return phi1; }
void set_end_angle (int a) { phi2 = a; }
int end_angle () const { return phi2; }
protected:
void draw_lines () const override;
private:
int phi1, phi2;
};
/// @class Box -- rectangle with rounded corners
struct Box : Rectangle
{
Box (Point xy, int ww, int hh, int radius = automatic);
Box (Point x, Point y, int radius = automatic);
void set_roundness (int radius);
int roundness () const { return r; }
protected:
void draw_lines () const override;
private:
int r; // radius of roundness
enum { automatic = std::numeric_limits<int>::max() };
};
struct Regular_hexagon : Shape
{
/// with center at @param c and circumcircle radius @param rr
Regular_hexagon (Point c, int r);
Point center () const;
int width () const;
int height () const;
int edge () const; /// hexagon edge length
protected:
void draw_lines () const override;
};
/// tile a rectangle with regular hexagons
struct Hexagon_tile : Rectangle
{
Hexagon_tile (Point p, int ww, int hh, int rr);
void move (int dx, int dy) override;
protected:
void draw_lines () const override;
private:
Vector_ref<Regular_hexagon> tile;
};
} // of namespace Graph_lib
#endif // GRAPH_EXT_GUARD