summaryrefslogtreecommitdiff
path: root/lib/include/graph.hpp
blob: 45cc47849544fa078e24c9c4244f9c91c5c91a32 (plain)
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

#pragma once

#include <cmath>
#include <vector>
#include <array>
#include <unordered_map>
#include <random>
#include <list>
#include <exception>
#include <algorithm>

#include "array_hash.hpp"

class graph {
  public:
    typedef struct coordinate {
      double x;
      double y;
    } coordinate;

    typedef struct vertex {
      coordinate r;
      std::vector<coordinate> polygon;
    } vertex;

    typedef struct edge {
      std::array<unsigned, 2> v;
      coordinate r;
      std::array<bool, 2> crossings;
    } edge;

    coordinate L;

    std::vector<vertex> vertices;
    std::vector<edge> edges;

    std::vector<vertex> dual_vertices;
    std::vector<edge> dual_edges;

    graph(unsigned Nx, unsigned Ny);
    graph(double Lx, double Ly, std::mt19937& rng);
    graph(unsigned n, double a, std::mt19937& rng);

    void helper(unsigned n, std::mt19937& rng);
    graph const rotate();
};