2 #ifndef vgl_homg_line_2d_hxx_ 3 #define vgl_homg_line_2d_hxx_ 11 # include <vcl_msvc_warnings.h> 19 : a_(
l.a()) , b_(
l.b()) , c_(
l.c())
35 if ( b() == 0) p1.
set(-c(), a(), a());
36 else p1.
set(0, -c(), b());
37 if ( a() == 0) p2.
set(b(), -c(), b());
38 else if ( c() == 0) p2.
set(b(), -a(), 1);
39 else p2.
set(-c(), 0, a());
46 set(p1.
y()*p2.
w()-p1.
w()*p2.
y(),
47 p1.
w()*p2.
x()-p1.
x()*p2.
w(),
48 p1.
x()*p2.
y()-p1.
y()*p2.
x());
52 #define vp(os,v,s) { (os)<<' '; if ((v)>0) (os)<<'+';\ 53 if ((v)&&!(s)[0]) (os)<<(v); else { \ 54 if ((v)==-1) (os)<<'-';\ 55 else if ((v)!=0&&(v)!=1) (os)<<(v);\ 56 if ((v)!=0) (os)<<' '<<(s); } } 62 os <<
"<vgl_homg_line_2d";
vp(os,
l.a(),
"x");
vp(os,
l.b(),
"y");
vp(os,
l.c(),
"w");
63 return os <<
" = 0 >";
81 double sum = a_*a_ + b_*b_;
82 double den = std::sqrt(sum);
85 double an= (double)a()/den;
86 double bn= (double)b()/den;
87 double cn= (double)c()/den;
90 if (std::fabs(an)>std::fabs(bn))
120 #undef VGL_HOMG_LINE_2D_INSTANTIATE 121 #define VGL_HOMG_LINE_2D_INSTANTIATE(T) \ 122 template class vgl_homg_line_2d<T >; \ 123 template std::ostream& operator<<(std::ostream&, vgl_homg_line_2d<T >const&); \ 124 template std::istream& operator>>(std::istream&, vgl_homg_line_2d<T >&) 126 #endif // vgl_homg_line_2d_hxx_ Represents a homogeneous 2D line.
void get_two_points(vgl_homg_point_2d< T > &p1, vgl_homg_point_2d< T > &p2) const
get two points on the line.
vgl_homg_line_2d()
Default constructor (Line 1.y==0, the X axis).
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
line in projective 2D space
Represents a Euclidean 2D line.
point in projective 2D space
void set(T px, T py, T pw=(T) 1)
Set x,y,w.
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
void normalize()
divide all coefficients by sqrt(a^2 + b^2).
void set(T va, T vb, T vc)
Set a b c.