polygon.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef POLYGON_HPP
  2. #define POLYGON_HPP
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6. #include "vertex.hpp"
  7. #include "matrix.hpp"
  8. #include "adjacency_matrix.hpp"
  9. #include "coefficients.hpp"
  10. #include "error.hpp"
  11. using namespace std;
  12. class Polygon{
  13. private:
  14. static Coefficients coefficients;
  15. size_t length;
  16. vector<Vertex> vertices;
  17. unordered_map<Vertex,uint64> indices;
  18. AdjacencyMatrix B;
  19. mpfr_t fp;
  20. void compute_B();
  21. void compute_C(Matrix& C);
  22. void compute_M(Matrix& M,const Matrix& C);
  23. void compute_fp();
  24. void add_vertex(const int32& x,const int32& y);
  25. void add_neighbours(const int32& x,const int32& y);
  26. public:
  27. static Coefficients& get_coefficients();
  28. Polygon();
  29. Polygon(string str);
  30. size_t size() const;
  31. size_t graph_size() const;
  32. Vertex vertex(size_t i) const;
  33. int get_coeff_B(size_t i,size_t j) const;
  34. mpfr_srcptr get_fp() const;
  35. };
  36. inline
  37. Polygon::Polygon(){
  38. length=0;
  39. }
  40. inline size_t
  41. Polygon::size() const{
  42. return length;
  43. }
  44. inline size_t
  45. Polygon::graph_size() const{
  46. return vertices.size();
  47. }
  48. inline Vertex
  49. Polygon::vertex(size_t i) const{
  50. return vertices[i];
  51. }
  52. inline Coefficients&
  53. Polygon::get_coefficients(){
  54. return coefficients;
  55. }
  56. inline mpfr_srcptr
  57. Polygon::get_fp() const{
  58. return fp;
  59. }
  60. inline int
  61. Polygon::get_coeff_B(size_t i,size_t j) const{
  62. return B.get(i,j);
  63. }
  64. #endif