Edge.hpp
Go to the documentation of this file.
1 
6 #ifndef EDGE_HPP
7 #define EDGE_HPP
8 
9 #include <vector>
10 #include "geometry.hpp"
11 
13 class Edge
14 {
15 public:
16 
18  std::pair<Vector2D, Vector2D> vertices;
19 
21  std::pair<int, int> neighbors;
22 
29  Edge(Vector2D const& p1, Vector2D const& p2,
30  int neighbor1, int neighbor2);
31 
36  Edge& operator=(const Edge& other);
37 
38  Edge(void);
39 
40  ~Edge(void);
41 
45  Edge(Edge const& other);
46 
50  double GetLength(void) const;
51 };
52 
57 Vector2D Parallel(Edge const& edge);
58 
65 double DistanceToEdge(Vector2D const& point,Edge const& edge);
66 
75 bool SegmentIntersection(Edge const& edge1,Edge const& edge2,
76  Vector2D &Intersection,double eps=1e-8);
77 
82 Vector2D calc_centroid(const Edge& edge);
83 
84 #endif // EDGE_HPP
Geometrical calculations.
bool SegmentIntersection(Edge const &edge1, Edge const &edge2, Vector2D &Intersection, double eps=1e-8)
Calculates the intersection of two edges.
Definition: Edge.cpp:45
Vector2D Parallel(Edge const &edge)
Calculates a unit vector parallel to an edge.
Definition: Edge.cpp:83
Interface between two cells.
Definition: Edge.hpp:13
Edge & operator=(const Edge &other)
copy operator
Definition: Edge.cpp:15
std::pair< Vector2D, Vector2D > vertices
Points at the ends of the edge.
Definition: Edge.hpp:18
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
double DistanceToEdge(Vector2D const &point, Edge const &edge)
Calculates the distance of a point to an edge.
Definition: Edge.cpp:31
Vector2D calc_centroid(const Edge &edge)
Calculates the centroid of an edge.
Definition: Edge.cpp:88
2D Mathematical vector
Definition: geometry.hpp:15
double GetLength(void) const
Returns the length of the edge.
Definition: Edge.cpp:26