2 #ifndef vgl_homg_point_2d_hxx_ 3 #define vgl_homg_point_2d_hxx_ 9 # include <vcl_msvc_warnings.h> 17 set(l1.
b()*l2.
c()-l1.
c()*l2.
b(),
18 l1.
c()*l2.
a()-l1.
a()*l2.
c(),
19 l1.
a()*l2.
b()-l1.
b()*l2.
a());
27 double Num_x = (p1.
x()*p3.
w()-p3.
x()*p1.
w())*(p2.
x()*p4.
w()-p4.
x()*p2.
w());
28 double Num_y = (p1.
y()*p3.
w()-p3.
y()*p1.
w())*(p2.
y()*p4.
w()-p4.
y()*p2.
w());
29 double Den_x = (p1.
x()*p4.
w()-p4.
x()*p1.
w())*(p2.
x()*p3.
w()-p3.
x()*p2.
w());
30 double Den_y = (p1.
y()*p4.
w()-p4.
y()*p1.
w())*(p2.
y()*p3.
w()-p3.
y()*p2.
w());
31 if (Den_x == Den_y)
return 0.5*(Num_x+Num_y)/Den_x;
32 else return (Den_x*Num_x+Den_y*Num_y)/(Den_x*Den_x+Den_y*Den_y);
38 return s <<
" <vgl_homg_point_2d (" 39 << p.
x() <<
',' << p.
y() <<
',' << p.
w() <<
") >";
51 #undef VGL_HOMG_POINT_2D_INSTANTIATE 52 #define VGL_HOMG_POINT_2D_INSTANTIATE(T) \ 53 template class vgl_homg_point_2d<T >; \ 54 template double cross_ratio(vgl_homg_point_2d<T >const&, vgl_homg_point_2d<T >const&, \ 55 vgl_homg_point_2d<T >const&, vgl_homg_point_2d<T >const&); \ 56 template std::ostream& operator<<(std::ostream&, vgl_homg_point_2d<T >const&); \ 57 template std::istream& operator>>(std::istream&, vgl_homg_point_2d<T >&) 59 #endif // vgl_homg_point_2d_hxx_ T a() const
Parameter a of line a*x + b*y + c*w = 0.
Represents a homogeneous 2D line.
T b() const
Parameter b of line a*x + b*y + c*w = 0.
double cross_ratio(vgl_homg_point_1d< T >const &p1, vgl_homg_point_1d< T >const &p2, vgl_homg_point_1d< T >const &p3, vgl_homg_point_1d< T >const &p4)
cross ratio of four points.
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
line in projective 2D space
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.
T c() const
Parameter c of line a*x + b*y + c*w = 0.
vgl_homg_point_2d()
Default constructor with (0,0,1).
Represents a homogeneous 2D point.