NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Graph2DTool.h
Go to the documentation of this file.
1#pragma once
2
3#include "Tool.h"
4
5namespace NAGASH
6{
7 class Triangle;
8 class Circle;
9
10 class Point
11 {
12 private:
13 double x;
14 double y;
15
16 public:
17 Point(double _x, double _y)
18 {
19 x = _x;
20 y = _y;
21 }
22
24 {
25 x = 0;
26 y = 0;
27 }
28
29 double X() { return x; }
30 double Y() { return y; }
31 double Distance(Point a) { return sqrt(pow(a.X() - x, 2) + pow(a.Y() - y, 2)); }
32 bool IsInside(Circle c);
33 bool IsInside(Triangle t);
34 };
35
36 class Edge
37 {
38 private:
41
42 public:
43 Edge(Point start, Point end)
44 {
45 s = start;
46 e = end;
47 }
48
49 Point Start() { return s; }
50 Point End() { return e; }
51 double Length() { return s.Distance(e); }
52 };
53
54 class Circle
55 {
56 private:
58 double r;
59
60 public:
61 Circle(Point center, double rad)
62 {
63 c = center;
64 r = rad;
65 }
66 Point Center() { return c; }
67 double Radius() { return r; }
68 };
69
71 {
72 private:
73 Point P[3];
74
75 public:
77 {
78 P[0] = a;
79 P[1] = b;
80 P[2] = c;
81 }
82
84 {
85 P[0] = p;
86 P[1] = line.Start();
87 P[2] = line.End();
88 }
89
90 Point Vertex(int index) { return P[index]; }
93 };
94
95 class Graph2DTool : public Tool
96 {
97 public:
98 Graph2DTool(std::shared_ptr<MSGTool> msg, double prec = 1e-5);
99 std::vector<Triangle> DelaunayTriangulation(std::vector<Point> p_vec);
100
101 private:
102 double PRECISION;
103 };
104}
std::string line
double Radius()
Definition Graph2DTool.h:67
Circle(Point center, double rad)
Definition Graph2DTool.h:61
double Length()
Definition Graph2DTool.h:51
Edge(Point start, Point end)
Definition Graph2DTool.h:43
Point End()
Definition Graph2DTool.h:50
Point Start()
Definition Graph2DTool.h:49
std::vector< Triangle > DelaunayTriangulation(std::vector< Point > p_vec)
double Distance(Point a)
Definition Graph2DTool.h:31
bool IsInside(Circle c)
Point(double _x, double _y)
Definition Graph2DTool.h:17
Provide interface for all tools in NAGASH.
Definition Tool.h:72
std::shared_ptr< MSGTool > msg
Definition Tool.h:88
Triangle(Point a, Point b, Point c)
Definition Graph2DTool.h:76
Point Vertex(int index)
Definition Graph2DTool.h:90
Circle CircumscribedCircle()
Point Circumcenter()
Definition Graph2DTool.h:92
Triangle(Edge line, Point p)
Definition Graph2DTool.h:83