ImageD  v2_7_5 (24.06.22)
ImageD is an image processing software designed for rapid prototyping and implementing algorithms and solutions for science, research and teaching.
d_geo_point_2d.h
Go to the documentation of this file.
1 /************************************
2  * added: 29.03.2021 *
3  * author: David Eilenstein *
4  * contact: D.Eilenstein@gsi.de *
5  * project: ImageD *
6  * facility: GSI Darmstadt, Ger *
7  ************************************/
8 
9 #ifndef D_GEO_POINT_2D_H
10 #define D_GEO_POINT_2D_H
11 
12 //own
13 #include <d_enum.h>
14 #include <d_geo_line_2d.h>
15 
16 //general
17 #include <iostream>
18 #include <vector>
19 #include <fstream>
20 #include <math.h>
21 
22 //Qt
23 #include <QDebug>
24 
25 //openCV
26 #include <opencv2/core/core.hpp>
27 #include <opencv2/highgui/highgui.hpp>
28 #include <opencv2/imgproc/imgproc.hpp>
29 
30 //namespaces
31 using namespace std;
32 //using namespace cv; (prohibited because of abigous names with qtdatavisualization)
33 #include <d_opencv_typedefs.h>
34 
35 //predeclaration, because points are needed for lines and vice versa
36 class D_Geo_Line_2D;
37 
43 {
44 public:
45  //constructors
47  D_Geo_Point_2D(double angle_rad);
48  D_Geo_Point_2D(double x, double y);
49  D_Geo_Point_2D(double u, double v, double w);
50  D_Geo_Point_2D(D_Geo_Line_2D L); //Dualism with lines
52 
53  //pseudo constructors
54  void set_point(D_Geo_Point_2D P);
55  void set_angle_unifrom(double angle_rad);
56  void set_angle_normal_unifrom(double angle_rad);
57 
58  //getter
59  double u() {return m_u;}
60  double v() {return m_v;}
61  double w() {return m_w;}
62  double x() {return m_u / m_w;}
63  double y() {return m_v / m_w;}
64  Mat Mat_homo();
65  Mat Mat_inhomo();
66  Point CV_Point() {return Point(x(), y());}
67  Point2f CV_Point2f() {return Point2f(x(), y());}
68  Point2d CV_Point2d() {return Point2d(x(), y());}
69 
70  //basic operations
71  bool equal(D_Geo_Point_2D P);
72  D_Geo_Point_2D negate();
73  D_Geo_Point_2D scale(double factor);
74  D_Geo_Point_2D unifrom();
75  D_Geo_Point_2D add_inhomo(D_Geo_Point_2D P);
76  D_Geo_Point_2D dif_inhomo(D_Geo_Point_2D P);
77  double mult_scalar_inhomo(D_Geo_Point_2D P);
78  double mult_scalar_homo(D_Geo_Point_2D P);
79  D_Geo_Line_2D mult_cross_homo(D_Geo_Point_2D P);
80 
81  //other operations
82  bool vanishing(double delta = 0);
83  double length();
84  double angle();
85  double angle(D_Geo_Point_2D P);
86  D_Geo_Line_2D connection(D_Geo_Point_2D P);
87  double distance(D_Geo_Point_2D P);
88  bool in_rect(size_t t, size_t b, size_t l, size_t r);
89  bool in_rect(size_t t, size_t b, size_t l, size_t r, double *min_dist, double *max_dist);
90  bool in_rect(Rect *rect);
91  bool in_rect(Mat *img);
92 
93 private:
94 
95  //members
96  double m_u;
97  double m_v;
98  double m_w;
99 };
100 
101 #endif // D_GEO_POINT_2D_H
Mat
cv::Mat Mat
Definition: d_opencv_typedefs.h:28
D_Geo_Line_2D::u
double u()
Definition: d_geo_line_2d.h:58
D_Geo_Point_2D::CV_Point2d
Point2d CV_Point2d()
Definition: d_geo_point_2d.h:68
D_Geo_Point_2D::w
double w()
Definition: d_geo_point_2d.h:61
Point2f
cv::Point2f Point2f
Definition: d_opencv_typedefs.h:37
D_Geo_Line_2D::v
double v()
Definition: d_geo_line_2d.h:59
D_Geo_Point_2D::Mat_homo
Mat Mat_homo()
Definition: d_geo_point_2d.cpp:68
D_Geo_Point_2D::set_point
void set_point(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:49
D_Geo_Point_2D::unifrom
D_Geo_Point_2D unifrom()
Definition: d_geo_point_2d.cpp:102
Rect
cv::Rect Rect
Definition: d_opencv_typedefs.h:65
D_Geo_Point_2D::distance
double distance(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:160
PI
const double PI
Definition: d_enum.h:2534
D_Geo_Point_2D::mult_cross_homo
D_Geo_Line_2D mult_cross_homo(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:127
D_Geo_Point_2D::equal
bool equal(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:85
D_Geo_Point_2D::v
double v()
Definition: d_geo_point_2d.h:60
D_Geo_Point_2D::vanishing
bool vanishing(double delta=0)
Definition: d_geo_point_2d.cpp:135
D_Geo_Point_2D::in_rect
bool in_rect(size_t t, size_t b, size_t l, size_t r)
Definition: d_geo_point_2d.cpp:167
D_Geo_Point_2D::u
double u()
Definition: d_geo_point_2d.h:59
Point
cv::Point Point
Definition: d_opencv_typedefs.h:35
D_Geo_Point_2D::mult_scalar_inhomo
double mult_scalar_inhomo(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:117
D_Geo_Line_2D
The D_Geo_Line_2D class represents a 2D line and offers usefulls methods for standard tasks for 2D po...
Definition: d_geo_line_2d.h:43
D_Geo_Point_2D::CV_Point
Point CV_Point()
Definition: d_geo_point_2d.h:66
D_Geo_Point_2D::angle
double angle()
Definition: d_geo_point_2d.cpp:145
D_Geo_Point_2D::y
double y()
Definition: d_geo_point_2d.h:63
d_geo_line_2d.h
D_Geo_Point_2D::scale
D_Geo_Point_2D scale(double factor)
Definition: d_geo_point_2d.cpp:95
D_Geo_Point_2D::CV_Point2f
Point2f CV_Point2f()
Definition: d_geo_point_2d.h:67
D_Geo_Point_2D::D_Geo_Point_2D
D_Geo_Point_2D()
Definition: d_geo_point_2d.cpp:11
D_Geo_Point_2D::Mat_inhomo
Mat Mat_inhomo()
Definition: d_geo_point_2d.cpp:77
D_Geo_Point_2D::mult_scalar_homo
double mult_scalar_homo(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:122
d_geo_point_2d.h
D_Geo_Point_2D::x
double x()
Definition: d_geo_point_2d.h:62
D_Geo_Point_2D::set_angle_normal_unifrom
void set_angle_normal_unifrom(double angle_rad)
Definition: d_geo_point_2d.cpp:63
D_Geo_Point_2D::set_angle_unifrom
void set_angle_unifrom(double angle_rad)
Definition: d_geo_point_2d.cpp:56
D_Geo_Line_2D::w
double w()
Definition: d_geo_line_2d.h:60
D_Geo_Point_2D::add_inhomo
D_Geo_Point_2D add_inhomo(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:107
Point2d
cv::Point2d Point2d
Definition: d_opencv_typedefs.h:38
D_Geo_Point_2D::connection
D_Geo_Line_2D connection(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:155
d_opencv_typedefs.h
D_Geo_Point_2D::negate
D_Geo_Point_2D negate()
Definition: d_geo_point_2d.cpp:90
D_Geo_Line_2D::intersection
D_Geo_Point_2D intersection(D_Geo_Line_2D L)
Definition: d_geo_line_2d.cpp:126
d_enum.h
D_Geo_Point_2D::length
double length()
Definition: d_geo_point_2d.cpp:140
D_Geo_Point_2D
The D_Geo_Point_2D class represents a 2D point and offers usefulls methods for standard tasks for 2D ...
Definition: d_geo_point_2d.h:43
D_Geo_Point_2D::dif_inhomo
D_Geo_Point_2D dif_inhomo(D_Geo_Point_2D P)
Definition: d_geo_point_2d.cpp:112