2 #ifndef vgl_point_2d_hxx_ 3 #define vgl_point_2d_hxx_ 16 # include <vcl_msvc_warnings.h> 22 : x_(p.x()/p.w()), y_(p.y()/p.w())
34 set(p.x()/p.w(), p.y()/p.w());
42 double Num_x = (p1.
x()-p3.
x())*(p2.
x()-p4.
x());
43 double Num_y = (p1.
y()-p3.
y())*(p2.
y()-p4.
y());
44 double Den_x = (p1.
x()-p4.
x())*(p2.
x()-p3.
x());
45 double Den_y = (p1.
y()-p4.
y())*(p2.
y()-p3.
y());
46 if (Den_x == Den_y)
return 0.5*(Num_x+Num_y)/Den_x;
47 else return (Den_x*Num_x+Den_y*Num_y)/(Den_x*Den_x+Den_y*Den_y);
54 return s <<
"<vgl_point_2d "<< p.
x() <<
',' << p.
y() <<
" > ";
65 if (! is.good())
return is;
89 is >> std::ws >> tx >> std::ws;
102 if (is.peek() ==
')')
113 if (is.peek() ==
'>')
124 template <
class Type>
130 #undef VGL_POINT_2D_INSTANTIATE 131 #define VGL_POINT_2D_INSTANTIATE(T) \ 132 template class vgl_point_2d<T >; \ 133 template double cross_ratio(vgl_point_2d<T >const&, vgl_point_2d<T >const&, \ 134 vgl_point_2d<T >const&, vgl_point_2d<T >const&); \ 135 template std::ostream& operator<<(std::ostream&, const vgl_point_2d<T >&); \ 136 template std::istream& operator>>(std::istream&, vgl_point_2d<T >&) 138 #endif // vgl_point_2d_hxx_ a point in 2D nonhomogeneous space
Represents a homogeneous 2D line.
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.
vgl_point_2d()=default
Default constructor.
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.
Type a() const
Parameter a of line a*x + b*y + c = 0.
point in projective 2D space
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
Type b() const
Parameter b of line a*x + b*y + c = 0.
double angle(v const &a, v const &b)
smallest angle between two vectors (in radians, between 0 and Pi).
Type c() const
Parameter c of line a*x + b*y + c = 0.
std::istream & read(std::istream &is)
Read from stream, possibly with formatting.