Lens distortion correction division model 1p
 All Classes Files Functions Variables
line.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2013, AMI RESEARCH GROUP <lalvarez@dis.ulpgc.es>
3  License : CC Creative Commons "Attribution-NonCommercial-ShareAlike"
4  see http://creativecommons.org/licenses/by-nc-sa/3.0/es/deed.en
5  */
6 
7 
8 #ifndef AMI_DLL_H
9  #define AMI_DLL_H
10 #endif
11 
17 #ifndef LINE_H
18 #define LINE_H
19 #include <iostream>
20 #include <math.h>
21 #include "point2d.h"
22 
23 namespace ami
24 {
29 // class AMI_DLL_H FOR STRAIGHT LINES
30 class AMI_DLL_H line{
31  double a,b,c;
32 public:
33  line():a(0.0),b(0.0),c(0.0){};
34  line(double xx, double yy,double zz):a(xx), b(yy), c(zz){}
36  a=v.y-u.y; b=u.x-v.x; c=v.x*u.y-u.x*v.y;}
37 
43  const double &get_a() const {return a;}
44  double &get_a() {return a;}
50  const double &get_b() const {return b;}
51  double &get_b() {return b;}
57  const double &get_c() const {return c;}
58  double &get_c() {return c;}
59 
65  void get_abc(double &a2,double &b2,double &c2) {a2=a; b2=b; c2=c;}
66  void get_abc(double &a2,double &b2,double &c2) const {a2=a; b2=b; c2=c;}
67 
68 
74  void set_a(double a2){a=a2;}
80  void set_b(double b2){b=b2;}
86  void set_c(double c2){c=c2;}
92  void set_abc(double a2,double b2,double c2){a=a2; b=b2; c=c2;}
93 
94 
100  //template <class T>
101  double distance(const point2d<double> &p) const {
102  double d = sqrt(a*a+b*b);
103  return (a*p.x+b*p.y+c)/d;
104  };
105 
111  //template <class T>
112  double evaluation(const point2d<double> &p) const {
113  return (a*p.x+b*p.y+c);
114  };
115 
116  friend point2d <double> line_intersection(const line &l1,const line &l2);
117 
118 };
119 
120 
121  point2d <double> line_intersection(const line &l1,const line &l2);
122 
123 }
124 
125  std::ostream &operator <<(std::ostream &s, const ami::line &p);
126  std::istream &operator >>(std::istream &s, ami::line &p) ;
127 
128 #endif
void get_abc(double &a2, double &b2, double &c2)
Get the three coefficients "a,b,c".
Definition: line.h:65
double evaluation(const point2d< double > &p) const
Evaluates a point with the line equation.
Definition: line.h:112
void set_abc(double a2, double b2, double c2)
Set the three coefficients "a,b,c".
Definition: line.h:92
T x
Definition: point2d.h:37
double & get_c()
Get coefficient "c".
Definition: line.h:58
class for straight lines
Definition: line.h:30
void set_b(double b2)
Set coefficient "b".
Definition: line.h:80
T y
Definition: point2d.h:38
line(double xx, double yy, double zz)
Definition: line.h:34
double & get_b()
Get coefficient "b".
Definition: line.h:51
double distance(const point2d< double > &p) const
Calculates the distance between a point and the line.
Definition: line.h:101
void set_a(double a2)
Set coefficient "a".
Definition: line.h:74
void set_c(double c2)
Set coefficient "c".
Definition: line.h:86
double & get_a()
Get coefficient "a".
Definition: line.h:44
point2d class definition