Go to the documentation of this file.00001
00064 #include "cob_3d_mapping_semantics/table_extraction.h"
00065
00066 using namespace cob_3d_mapping;
00067
00068 bool
00069 TableExtraction::isTable ()
00070 {
00071 if (!poly_ptr_)
00072 {
00073 std::cerr << "Input polygon not set, aborting..." << std::endl;
00074 return false;
00075 }
00076
00077 if (isHorizontal () && isHeightOk () && isSizeOk ())
00078 return true;
00079 else
00080 return false;
00081 }
00082
00083 bool
00084 TableExtraction::isHorizontal ()
00085 {
00086
00087 if ((poly_ptr_->normal_ (2) >= norm_z_max_ || poly_ptr_->normal_ (2) <= norm_z_min_)
00088 && (poly_ptr_->normal_ (0) < norm_x_max_ && poly_ptr_->normal_ (0) > norm_x_min_)
00089 && (poly_ptr_->normal_ (1) < norm_y_max_ && poly_ptr_->normal_ (1) > norm_y_min_))
00090 {
00091 return true;
00092 }
00093 else
00094 {
00095 return false;
00096 }
00097 }
00098
00099 bool
00100 TableExtraction::isHeightOk ()
00101 {
00102 if (poly_ptr_->pose_.translation () (2) > height_min_ && poly_ptr_->pose_.translation () (2) < height_max_)
00103 return true;
00104 else
00105 return false;
00106 }
00107
00108 bool
00109 TableExtraction::isSizeOk ()
00110 {
00111 double area = poly_ptr_->computeArea3d ();
00112 if (area >= area_min_ && area <= area_max_)
00113 return true;
00114 return false;
00115 }
00116
00117