Go to the documentation of this file.00001
00002 #ifndef bvgl_triangle_3d_txx_
00003 #define bvgl_triangle_3d_txx_
00004
00005
00006
00007 #include "bvgl_triangle_3d.h"
00008 #include <vgl/vgl_point_3d.h>
00009 #include <vcl_iostream.h>
00010 #include <vcl_algorithm.h>
00011 #include <vcl_cassert.h>
00012 #include <vcl_cmath.h>
00013
00014
00015
00016 template <class Type>
00017 bvgl_triangle_3d<Type>::bvgl_triangle_3d()
00018 {
00019 points_[0].set(0,0,0);
00020 points_[1].set(0,0,0);
00021 points_[2].set(0,0,0);
00022 }
00023
00024 template <class Type>
00025 bvgl_triangle_3d<Type>::bvgl_triangle_3d(vgl_point_3d<Type> const& corner1,
00026 vgl_point_3d<Type> const& corner2,
00027 vgl_point_3d<Type> const& corner3)
00028 {
00029 points_[0] = corner1;
00030 points_[1] = corner2;
00031 points_[2] = corner3;
00032 }
00033
00034 template <class Type>
00035 vcl_ostream& bvgl_triangle_3d<Type>::print(vcl_ostream& s) const
00036 {
00037 return s << "<bvgl_triangle_3d "<< ' ' << points_[0] << ' '
00038 << points_[1] << ' '
00039 << points_[2] << '>';
00040 }
00041
00042 template <class Type>
00043 vcl_ostream& bvgl_triangle_3d<Type>::write(vcl_ostream& s) const
00044 {
00045 return s << points_[0] << ' ' << points_[1] << ' ' << points_[2] << '>';
00046 }
00047
00048 template <class Type>
00049 vcl_istream& bvgl_triangle_3d<Type>::read(vcl_istream& is)
00050 {
00051 return is >> points_[0] >> points_[1] >> points_[2];
00052 }
00053
00054 //: Write box to stream
00055 template <class Type>
00056 vcl_ostream& operator<<(vcl_ostream& s, bvgl_triangle_3d<Type> const& p)
00057 {
00058 return p.print(s);
00059 }
00060
00061 //: Read box from stream
00062 template <class Type>
00063 vcl_istream& operator>>(vcl_istream& is, bvgl_triangle_3d<Type>& p)
00064 {
00065 return p.read(is);
00066 }
00067
00068 #undef BVGL_TRIANGLE_3D_INSTANTIATE
00069 #define BVGL_TRIANGLE_3D_INSTANTIATE(Type) \
00070 template class bvgl_triangle_3d<Type >;\
00071 template vcl_ostream& operator<<(vcl_ostream&, bvgl_triangle_3d<Type > const& p);\
00072 template vcl_istream& operator>>(vcl_istream&, bvgl_triangle_3d<Type >& p)
00073
00074 #endif // bvgl_triangle_3d_txx_