43 #include <visp/vpConfig.h>
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 #include <visp/vpMbtHiddenFace.h>
55 vpMbtPolygon::vpMbtPolygon()
67 vpMbtPolygon::~vpMbtPolygon()
83 vpMbtPolygon::setNbPoint(
const unsigned int nb)
98 vpMbtPolygon::addPoint(
const unsigned int n,
const vpPoint &P)
112 for (
unsigned int i = 0 ; i < nbpt ; i++)
142 e1[0] = p[1].get_X() - p[0].get_X() ;
143 e1[1] = p[1].get_Y() - p[0].get_Y() ;
144 e1[2] = p[1].get_Z() - p[0].get_Z() ;
146 e2[0] = p[2].get_X() - p[1].get_X() ;
147 e2[1] = p[2].get_Y() - p[1].get_Y() ;
148 e2[2] = p[2].get_Z() - p[1].get_Z() ;
152 double angle = p[0].get_X()*facenormal[0] + p[0].get_Y()*facenormal[1] + p[0].get_Z()*facenormal[2] ;
154 double diff = angle - angle_1;
155 if (diff < 0) negative++;
158 if(angle < -0.00001 )
166 if (angle < 0.0000001 )
201 e1[0] = p[1].get_X() - p[0].get_X() ;
202 e1[1] = p[1].get_Y() - p[0].get_Y() ;
203 e1[2] = p[1].get_Z() - p[0].get_Z() ;
205 e2[0] = p[2].get_X() - p[1].get_X() ;
206 e2[1] = p[2].get_Y() - p[1].get_Y() ;
207 e2[2] = p[2].get_Z() - p[1].get_Z() ;
219 double angle = p[0].get_X()*facenormal[0] + p[0].get_Y()*facenormal[1] + p[0].get_Z()*facenormal[2] ;
222 double cos_angle = n_cam_dot_n_plan * (1 / ( n_cam.euclideanNorm() * n_plan.euclideanNorm() ));
223 double my_angle = acos(cos_angle);
225 if(angle < 0 && ( my_angle > static_cast<double>(M_PI - alpha) || my_angle < static_cast<double>(-M_PI + alpha) ) ){
235 vpMbtHiddenFaces::vpMbtHiddenFaces()
243 vpMbtHiddenFaces::~vpMbtHiddenFaces()
248 for(std::list<vpMbtPolygon*>::const_iterator it=Lpol.begin(); it!=Lpol.end(); ++it){
265 vpMbtHiddenFaces::addPolygon(vpMbtPolygon *p)
267 vpMbtPolygon *p_new =
new vpMbtPolygon;
268 p_new->index = p->index;
269 p_new->setNbPoint(p->nbpt);
270 p_new->isvisible = p->isvisible;
271 for(
unsigned int i = 0; i < p->nbpt; i++)
272 p_new->p[i]= p->p[i];
273 Lpol.push_back(p_new);
287 unsigned int nbvisiblepolygone = 0 ;
290 for(std::list<vpMbtPolygon*>::const_iterator it=Lpol.begin(); it!=Lpol.end(); ++it){
292 if (p->isVisible(cMo))
295 return nbvisiblepolygone ;
306 vpMbtHiddenFaces::isVisible(
const int index)
309 for(std::list<vpMbtPolygon*>::const_iterator it=Lpol.begin(); it!=Lpol.end(); ++it){
311 if (p->getIndex() == index)
return p->isVisible() ;
324 vpMbtHiddenFaces::isAppearing(
const int index)
327 for(std::list<vpMbtPolygon*>::const_iterator it=Lpol.begin(); it!=Lpol.end(); ++it){
329 if (p->getIndex() == index)
return p->isAppearing() ;
338 vpMbtHiddenFaces::reset()
342 for(std::list<vpMbtPolygon*>::const_iterator it=Lpol.begin(); it!=Lpol.end(); ++it){
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Class that defines what is a point.
Class that provides a data structure for the column vectors as well as a set of operations on these v...
static double dotProd(const vpColVector &a, const vpColVector &b)
Dot Product.
static vpColVector crossProd(const vpColVector &a, const vpColVector &b)
normalise the vector
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &_cP)