core/vgl/vgl_cylinder.txx
Go to the documentation of this file.
00001 #ifndef vgl_cylinder_txx_
00002 #define vgl_cylinder_txx_
00003 //:
00004 // \file
00005 
00006 #include "vgl_cylinder.h"
00007 #include <vcl_iostream.h>
00008 
00009 template <class T>
00010 bool vgl_cylinder<T>::operator==(vgl_cylinder<T> const& cyl) const
00011 {
00012   return (this==&cyl) ||
00013          ( cyl.center_ == this->center_ &&
00014            cyl.radius_ == this->radius_ &&
00015            cyl.length_ == this->length_ &&
00016            cyl.orient_ == this->orient_);
00017 }
00018 
00019 template <class T>
00020 vcl_ostream& vgl_cylinder<T>::print(vcl_ostream& s) const
00021 {
00022   return s << "<vgl_cylinder center=" << center_ << ','
00023            << " radius=" << radius_ << ", length =" << length_
00024            << ", direction=" << orient_ << '>';
00025 }
00026 
00027 template <class T>
00028 vcl_ostream& operator<<(vcl_ostream& os, const vgl_cylinder<T>& cyl)
00029 {
00030   return cyl.print(os);
00031 }
00032 
00033 template <class T>
00034 vcl_istream& operator>>(vcl_istream& s, vgl_cylinder<T>& cyl)
00035 {
00036   T center_x, center_y, center_z, radius, length, orient_x, orient_y, orient_z;
00037   s >> center_x >> center_y >> center_z >> radius >> length >> orient_x >> orient_y >> orient_z;
00038   cyl.set_center(vgl_point_3d<T>(center_x,center_y,center_z));
00039   cyl.set_radius(radius);
00040   cyl.set_length(length);
00041   cyl.set_orientation(vgl_vector_3d<T>(orient_x,orient_y,orient_z));
00042   return s;
00043 }
00044 
00045 #undef VGL_CYLINDER_INSTANTIATE
00046 #define VGL_CYLINDER_INSTANTIATE(T) \
00047 template class vgl_cylinder<T >; \
00048 template vcl_ostream& operator<<(vcl_ostream&, vgl_cylinder<T >const&); \
00049 template vcl_istream& operator>>(vcl_istream&, vgl_cylinder<T >&)
00050 
00051 #endif // vgl_cylinder_txx_