47 #include <visp/vpWireFrameSimulator.h>
53 #include <visp/vpSimulatorException.h>
54 #include <visp/vpPoint.h>
55 #include <visp/vpCameraParameters.h>
56 #include <visp/vpMeterPixelConversion.h>
57 #include <visp/vpPoint.h>
58 #include <visp/vpIoTools.h>
61 #define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
66 #if defined(VISP_HAVE_COIN)
67 #include <Inventor/nodes/SoSeparator.h>
68 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h>
69 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h>
70 #include <Inventor/VRMLnodes/SoVRMLCoordinate.h>
71 #include <Inventor/actions/SoWriteAction.h>
72 #include <Inventor/actions/SoSearchAction.h>
73 #include <Inventor/misc/SoChildList.h>
74 #include <Inventor/actions/SoGetMatrixAction.h>
75 #include <Inventor/actions/SoGetPrimitiveCountAction.h>
76 #include <Inventor/actions/SoToVRML2Action.h>
77 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
78 #include <Inventor/VRMLnodes/SoVRMLShape.h>
81 extern "C"{
extern Point2i *point2i;}
82 extern "C"{
extern Point2i *listpoint2i;}
95 getExtension(
const char* file)
97 std::string sfilename(file);
99 size_t bnd = sfilename.find(
"bnd");
100 size_t BND = sfilename.find(
"BND");
101 size_t wrl = sfilename.find(
"wrl");
102 size_t WRL = sfilename.find(
"WRL");
104 size_t size = sfilename.size();
106 if ((bnd>0 && bnd<size ) || (BND>0 && BND<size))
108 else if ((wrl>0 && wrl<size) || ( WRL>0 && WRL<size))
110 #if defined(VISP_HAVE_COIN)
113 std::cout <<
"Coin not installed, cannot read VRML files" << std::endl;
114 throw std::string(
"Coin not installed, cannot read VRML files");
117 return UNKNOWN_MODEL;
123 void set_scene (
const char* str, Bound_scene *sc,
float factor)
128 if ((fd = fopen (str,
"r")) == NULL)
131 strcpy (strerr,
"The file ");
133 strcat (strerr,
" can not be opened");
136 open_keyword (keyword_tbl);
138 open_source (fd, str);
139 malloc_Bound_scene (sc, str,(Index)BOUND_NBR);
143 if (std::fabs(factor) > std::numeric_limits<double>::epsilon())
145 for (
int i = 0; i < sc->bound.nbr; i++)
147 for (
int j = 0; j < sc->bound.ptr[i].point.nbr; j++)
149 sc->bound.ptr[i].point.ptr[j].x = sc->bound.ptr[i].point.ptr[j].x*factor;
150 sc->bound.ptr[i].point.ptr[j].y = sc->bound.ptr[i].point.ptr[j].y*factor;
151 sc->bound.ptr[i].point.ptr[j].z = sc->bound.ptr[i].point.ptr[j].z*factor;
162 #if defined(VISP_HAVE_COIN)
164 #ifndef DOXYGEN_SHOULD_SKIP_THIS
168 std::vector<vpPoint> pt;
170 std::vector<int> index;
172 #endif // DOXYGEN_SHOULD_SKIP_THIS
174 void extractFaces(SoVRMLIndexedFaceSet*, indexFaceSet *ifs);
175 void ifsToBound (Bound*, std::list<indexFaceSet*> &);
176 void destroyIfs(std::list<indexFaceSet*> &);
179 void set_scene_wrl (
const char* str, Bound_scene *sc,
float factor)
184 SbBool ok = in.openFile(str);
185 SoSeparator *sceneGraph;
186 SoVRMLGroup *sceneGraphVRML2;
189 vpERROR_TRACE(
"can't open file \"%s\" \n Please check the Marker_Less.ini file", str);
193 if(!in.isFileVRML2())
195 sceneGraph = SoDB::readAll(&in);
196 if (sceneGraph == NULL) { }
199 SoToVRML2Action tovrml2;
200 tovrml2.apply(sceneGraph);
201 sceneGraphVRML2 =tovrml2.getVRML2SceneGraph();
202 sceneGraphVRML2->ref();
207 sceneGraphVRML2 = SoDB::readAllVRML(&in);
208 if (sceneGraphVRML2 == NULL) { }
209 sceneGraphVRML2->ref();
214 int nbShapes = sceneGraphVRML2->getNumChildren();
218 malloc_Bound_scene (sc, str,(Index)BOUND_NBR);
221 for (
int i = 0; i < nbShapes; i++)
224 child = sceneGraphVRML2->getChild(i);
225 if (child->getTypeId() == SoVRMLShape::getClassTypeId())
227 std::list<indexFaceSet*> ifs_list;
228 SoChildList * child2list = child->getChildren();
229 for (
int j = 0; j < child2list->getLength(); j++)
231 if (((SoNode*)child2list->get(j))->getTypeId() == SoVRMLIndexedFaceSet::getClassTypeId())
233 indexFaceSet *ifs =
new indexFaceSet;
234 SoVRMLIndexedFaceSet * face_set;
235 face_set = (SoVRMLIndexedFaceSet*)child2list->get(j);
236 extractFaces(face_set,ifs);
237 ifs_list.push_back(ifs);
249 ifsToBound (&(sc->bound.ptr[iterShapes]), ifs_list);
250 destroyIfs(ifs_list);
256 if (std::fabs(factor) > std::numeric_limits<double>::epsilon())
258 for (
int i = 0; i < sc->bound.nbr; i++)
260 for (
int j = 0; j < sc->bound.ptr[i].point.nbr; j++)
262 sc->bound.ptr[i].point.ptr[j].x = sc->bound.ptr[i].point.ptr[j].x*factor;
263 sc->bound.ptr[i].point.ptr[j].y = sc->bound.ptr[i].point.ptr[j].y*factor;
264 sc->bound.ptr[i].point.ptr[j].z = sc->bound.ptr[i].point.ptr[j].z*factor;
272 extractFaces(SoVRMLIndexedFaceSet* face_set, indexFaceSet *ifs)
276 SoVRMLCoordinate *coord = (SoVRMLCoordinate *)(face_set->coord.getValue());
277 int coordSize = coord->point.getNum();
279 ifs->nbPt = coordSize;
280 for (
int i = 0; i < coordSize; i++)
282 SbVec3f point(0,0,0);
283 point[0]=coord->point[i].getValue()[0];
284 point[1]=coord->point[i].getValue()[1];
285 point[2]=coord->point[i].getValue()[2];
288 ifs->pt.push_back(pt);
291 SoMFInt32 indexList = face_set->coordIndex;
292 int indexListSize = indexList.getNum();
294 ifs->nbIndex = indexListSize;
295 for (
int i = 0; i < indexListSize; i++)
297 int index = face_set->coordIndex[i];
298 ifs->index.push_back(index);
302 void ifsToBound (Bound* bptr, std::list<indexFaceSet*> &ifs_list)
305 for(std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it){
308 bptr->point.nbr = (Index)nbPt;
309 bptr->point.ptr = (Point3f *) malloc ((
unsigned int)nbPt *
sizeof (Point3f));
312 unsigned int iter = 0;
313 for (std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it)
315 indexFaceSet* ifs = *it;
316 for (
unsigned int j = 0; j < (
unsigned int)ifs->nbPt; j++)
318 bptr->point.ptr[iter].x = (float)ifs->pt[j].get_oX();
319 bptr->point.ptr[iter].y = (float)ifs->pt[j].get_oY();
320 bptr->point.ptr[iter].z = (float)ifs->pt[j].get_oZ();
325 unsigned int nbFace = 0;
327 std::list<int> indSize;
329 for (std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it)
331 indexFaceSet* ifs = *it;
332 for (
unsigned int j = 0; j < (
unsigned int)ifs->nbIndex; j++)
334 if(ifs->index[j] == -1)
337 indSize.push_back(indice);
344 bptr->face.nbr = (Index)nbFace;
345 bptr->face.ptr = (Face *) malloc (nbFace *
sizeof (Face));
348 std::list<int>::const_iterator iter_indSize = indSize.begin();
349 for (
unsigned int i = 0; i < indSize.size(); i++)
351 bptr->face.ptr[i].vertex.nbr = (Index)*iter_indSize;
352 bptr->face.ptr[i].vertex.ptr = (Index *) malloc ((
unsigned int)*iter_indSize *
sizeof (Index));
358 for (std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it)
360 indexFaceSet* ifs = *it;
362 for (
unsigned int j = 0; j < (
unsigned int)ifs->nbIndex; j++)
364 if(ifs->index[j] != -1)
366 bptr->face.ptr[indice].vertex.ptr[iter] = (Index)(ifs->index[j] + offset);
379 void destroyIfs(std::list<indexFaceSet*> &ifs_list)
381 for(std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it){
387 void set_scene_wrl (
const char* , Bound_scene* ,
float )
398 for (
unsigned int i = 0; i < 4; i++) {
399 for (
unsigned int j = 0; j < 4; j++)
400 jlcM[j][i] = (
float)vpM[i][j];
413 Byte b = (Byte) *get_rfstack ();
417 memmove((
char *) m, (
char *) mat,
sizeof (Matrix));
418 View_to_Matrix (get_vwstack (), *(get_tmstack ()));
419 postmult_matrix (m, *(get_tmstack ()));
421 bend = bp + sc.bound.nbr;
422 for (; bp < bend; bp++)
424 if ((clip = clipping_Bound (bp, m)) != NULL)
426 Face *fp = clip->face.ptr;
427 Face *fend = fp + clip->face.nbr;
429 set_Bound_face_display (clip, b);
431 point_3D_2D (clip->point.ptr, clip->point.nbr,I.
getWidth(),I.
getHeight(),point2i);
432 for (; fp < fend; fp++)
436 wireframe_Face (fp, point2i);
437 Point2i *pt = listpoint2i;
438 for (
int i = 1; i < fp->vertex.nbr; i++)
443 if (fp->vertex.nbr > 2)
463 Byte b = (Byte) *get_rfstack ();
466 bcopy ((
char *) mat, (
char *) m,
sizeof (Matrix));
467 View_to_Matrix (get_vwstack (), *(get_tmstack ()));
468 postmult_matrix (m, *(get_tmstack ()));
470 bend = bp + sc.bound.nbr;
471 for (; bp < bend; bp++)
473 if ((clip = clipping_Bound (bp, m)) != NULL)
475 Face *fp = clip->face.ptr;
476 Face *fend = fp + clip->face.nbr;
478 set_Bound_face_display (clip, b);
480 point_3D_2D (clip->point.ptr, clip->point.nbr,I.
getWidth(),I.
getHeight(),point2i);
481 for (; fp < fend; fp++)
485 wireframe_Face (fp, point2i);
486 Point2i *pt = listpoint2i;
487 for (
int i = 1; i < fp->vertex.nbr; i++)
492 if (fp->vertex.nbr > 2)
516 scene_dir = VISP_SCENES_DIR;
520 std::cout <<
"The simulator uses data from VISP_SCENES_DIR=" << scene_dir << std::endl;
523 std::cout <<
"Cannot get VISP_SCENES_DIR environment variable" << std::endl;
586 free_Bound_scene (&(this->
scene));
588 free_Bound_scene (&(this->
camera));
614 char name_cam[FILENAME_MAX];
615 char name[FILENAME_MAX];
620 strcpy(name_cam, scene_dir.c_str());
621 if (desiredObject !=
D_TOOL)
623 strcat(name_cam,
"/camera.bnd");
628 strcat(name_cam,
"/tool.bnd");
629 set_scene(name_cam,&(this->
camera),1.0);
632 strcpy(name, scene_dir.c_str());
635 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
636 case CUBE : { strcat(name,
"/cube.bnd");
break; }
637 case PLATE : { strcat(name,
"/plate.bnd");
break; }
638 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
639 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
640 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
641 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
642 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
643 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
644 case ROAD : { strcat(name,
"/road.bnd");
break; }
645 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
646 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
647 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
648 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
649 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
650 case PLAN: { strcat(name,
"/plan.bnd");
break; }
651 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
653 set_scene(name,&(this->
scene),1.0);
655 switch (desiredObject)
659 strcpy(name, scene_dir.c_str());
660 strcat(name,
"/circle_sq2.bnd");
663 strcpy(name, scene_dir.c_str());
664 strcat(name,
"/tool.bnd");
669 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
670 else add_rfstack(IS_BACK);
672 add_vwstack (
"start",
"depth", 0.0, 100.0);
673 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
674 add_vwstack (
"start",
"type", PERSPECTIVE);
683 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
745 char name_cam[FILENAME_MAX];
746 char name[FILENAME_MAX];
751 strcpy(name_cam, scene_dir.c_str());
752 strcat(name_cam,
"/camera.bnd");
757 model = getExtension(obj);
758 if (model == BND_MODEL)
759 set_scene(name,&(this->
scene),1.0);
760 else if (model == WRL_MODEL)
761 set_scene_wrl(name,&(this->
scene),1.0);
762 else if (model == UNKNOWN_MODEL)
767 strcpy(name,desiredObject);
768 model = getExtension(desiredObject);
769 if (model == BND_MODEL)
771 else if (model == WRL_MODEL)
773 else if (model == UNKNOWN_MODEL)
778 add_rfstack(IS_BACK);
780 add_vwstack (
"start",
"depth", 0.0, 100.0);
781 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
782 add_vwstack (
"start",
"type", PERSPECTIVE);
790 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
849 char name_cam[FILENAME_MAX];
850 char name[FILENAME_MAX];
854 strcpy(name_cam, scene_dir.c_str());
855 strcat(name_cam,
"/camera.bnd");
858 strcpy(name, scene_dir.c_str());
861 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
862 case CUBE : { strcat(name,
"/cube.bnd");
break; }
863 case PLATE : { strcat(name,
"/plate.bnd");
break; }
864 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
865 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
866 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
867 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
868 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
869 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
870 case ROAD : { strcat(name,
"/road.bnd");
break; }
871 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
872 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
873 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
874 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
875 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
876 case PLAN: { strcat(name,
"/plan.bnd");
break; }
877 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
879 set_scene(name,&(this->
scene),1.0);
881 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
882 else add_rfstack(IS_BACK);
884 add_vwstack (
"start",
"depth", 0.0, 100.0);
885 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
886 add_vwstack (
"start",
"type", PERSPECTIVE);
896 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
953 char name_cam[FILENAME_MAX];
954 char name[FILENAME_MAX];
958 strcpy(name_cam, scene_dir.c_str());
959 strcat(name_cam,
"/camera.bnd");
964 model = getExtension(obj);
965 if (model == BND_MODEL)
966 set_scene(name,&(this->
scene),1.0);
967 else if (model == WRL_MODEL)
968 set_scene_wrl(name,&(this->
scene),1.0);
969 else if (model == UNKNOWN_MODEL)
974 add_rfstack(IS_BACK);
976 add_vwstack (
"start",
"depth", 0.0, 100.0);
977 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
978 add_vwstack (
"start",
"type", PERSPECTIVE);
985 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1060 float o44c[4][4],o44cd[4][4],x,y,z;
1061 Matrix
id = IDENTITY_MATRIX;
1080 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1081 x = o44c[2][0] + o44c[3][0];
1082 y = o44c[2][1] + o44c[3][1];
1083 z = o44c[2][2] + o44c[3][2];
1084 add_vwstack (
"start",
"vrp", x,y,z);
1085 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1086 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1087 add_vwstack (
"start",
"window", -u, u, -v, v);
1092 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1093 x = o44cd[2][0] + o44cd[3][0];
1094 y = o44cd[2][1] + o44cd[3][1];
1095 z = o44cd[2][2] + o44cd[3][2];
1096 add_vwstack (
"start",
"vrp", x,y,z);
1097 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1098 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1099 add_vwstack (
"start",
"window", -u, u, -v, v);
1119 bool changed =
false;
1123 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1146 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1149 vp2jlc_matrix(
fMc,w44c);
1150 vp2jlc_matrix(
fMo,w44o);
1153 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1154 x = w44cext[2][0] + w44cext[3][0];
1155 y = w44cext[2][1] + w44cext[3][1];
1156 z = w44cext[2][2] + w44cext[3][2];
1157 add_vwstack (
"start",
"vrp", x,y,z);
1158 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1159 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1160 add_vwstack (
"start",
"window", -u, u, -v, v);
1163 add_vwstack (
"start",
"type", PERSPECTIVE);
1198 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1199 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1201 while ((iter_poseList !=
poseList.end()) && (iter_fMoList !=
fMoList.end()))
1262 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1282 vp2jlc_matrix(camMft.
inverse(),w44cext);
1284 vp2jlc_matrix(
fMo,w44o);
1286 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1287 x = w44cext[2][0] + w44cext[3][0];
1288 y = w44cext[2][1] + w44cext[3][1];
1289 z = w44cext[2][2] + w44cext[3][2];
1290 add_vwstack (
"start",
"vrp", x,y,z);
1291 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1292 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1293 add_vwstack (
"start",
"window", -u, u, -v, v);
1345 float o44c[4][4],o44cd[4][4],x,y,z;
1346 Matrix
id = IDENTITY_MATRIX;
1365 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1366 x = o44c[2][0] + o44c[3][0];
1367 y = o44c[2][1] + o44c[3][1];
1368 z = o44c[2][2] + o44c[3][2];
1369 add_vwstack (
"start",
"vrp", x,y,z);
1370 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1371 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1372 add_vwstack (
"start",
"window", -u, u, -v, v);
1377 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1378 x = o44cd[2][0] + o44cd[3][0];
1379 y = o44cd[2][1] + o44cd[3][1];
1380 z = o44cd[2][2] + o44cd[3][2];
1381 add_vwstack (
"start",
"vrp", x,y,z);
1382 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1383 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1384 add_vwstack (
"start",
"window", -u, u, -v, v);
1404 bool changed =
false;
1408 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1431 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1434 vp2jlc_matrix(
fMc,w44c);
1435 vp2jlc_matrix(
fMo,w44o);
1438 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1439 x = w44cext[2][0] + w44cext[3][0];
1440 y = w44cext[2][1] + w44cext[3][1];
1441 z = w44cext[2][2] + w44cext[3][2];
1442 add_vwstack (
"start",
"vrp", x,y,z);
1443 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1444 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1445 add_vwstack (
"start",
"window", -u, u, -v, v);
1448 add_vwstack (
"start",
"type", PERSPECTIVE);
1481 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1482 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1484 while ((iter_poseList!=
poseList.end()) && (iter_fMoList!=
fMoList.end()) )
1545 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1565 vp2jlc_matrix(camMft.
inverse(),w44cext);
1567 vp2jlc_matrix(
fMo,w44o);
1569 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1570 x = w44cext[2][0] + w44cext[3][0];
1571 y = w44cext[2][1] + w44cext[3][1];
1572 z = w44cext[2][2] + w44cext[3][2];
1573 add_vwstack (
"start",
"vrp", x,y,z);
1574 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1575 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1576 add_vwstack (
"start",
"window", -u, u, -v, v);
1596 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1697 if (list_cMo.size() != list_fMo.size())
1704 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1705 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1707 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1737 if (list_cMo.size() != list_fMo.size())
1744 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1745 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1747 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1773 bool clicked =
false;
1774 bool clickedUp =
false;
1827 anglei = diffi*360/width;
1828 anglej = diffj*360/width;
1848 mov.
buildFrom(diffj*0.01,diffi*0.01,0,0,0,0);
1867 bool clicked =
false;
1868 bool clickedUp =
false;
1923 anglei = diffi*360/width;
1924 anglej = diffj*360/width;
1944 mov.
buildFrom(diffj*0.01,diffi*0.01,0,0,0,0);
bool displayImageSimulator
The object displayed at the desired position is the same than the scene object defined in vpSceneObje...
A cylinder of 80cm length and 10cm radius.
unsigned int nbElements(void)
return the number of element in the list
A tire represented by 2 circles with radius 10cm and 15cm.
bool outside(void) const
Test if the current element is outside the list (on the virtual element)
unsigned int getWidth() const
Three parallel lines with equation y=-5, y=0, y=5.
A plane represented by a 56cm by 56cm plate with a grid of 49 squares inside.
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Provide simple list management.
A plate with 8 points at coordinates (0.05,0,0), (0.15,0.05,0), (0.2,0.2,0), (-0.05,0.2,0), (-0.15,-0.1,0), (-0.1,-0.1,0), (-0.05,0.05,0) and (0.5,0,0). ach point is represented by a circle with 2cm radius.
void getImage(vpImage< unsigned char > &I, const vpCameraParameters &cam)
A 40cm by 40cm plate with 4 points at coordinates (-0.1,-0.1,0), (0.1,-0.1,0), (0.1,0.1,0), (0.1,0.1,0). Each point is represented by a circle with 2cm radius.
void setIdentity()
Basic initialisation (identity)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
Class to define colors available for display functionnalities.
A cylindrical tool is attached to the camera.
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
std::list< vpImageSimulator > objectImage
error that can be emited by ViSP classes.
std::list< vpImagePoint > cameraTrajectory
void track(const vpHomogeneousMatrix &cMo)
double get_y() const
Get the point y coordinate in the image plane.
A 40cm by 40cm plate with 4 points at coordinates (-0.05,0.05,0), (0.05,0.05,0), (0.05,-0.05,0), (-0.05,-0.05,0). Each point is represented by a circle with 2cm radius.
static const vpColor green
virtual ~vpWireFrameSimulator()
std::list< vpHomogeneousMatrix > fMoList
void next(void)
position the current element on the next one
Class that defines what is a point.
static Type maximum(const Type &a, const Type &b)
4 points at coordinates (-0.03,-0.03,0), (0.03,-0.03,0), (0.03,0.03,0), (0.03,0.03,0). Each point is represented by a circle with 1cm radius.
vpCameraParameters getExternalCameraParameters(const vpImage< unsigned char > &I) const
virtual bool getPointerPosition(vpImagePoint &ip)=0
The object displayed at the desired position is a circle.
A 40cm by 40cm plate with 4 points at coordinates (-0.025,-0.05,0), (-0.075,0.05,0), (0.075,0.05,0), (0.025,-0.05,0). Each point is represented by a circle with 2cm radius.
void front(void)
Position the current element on the first element of the list.
static void display(const vpImage< unsigned char > &I)
type & value(void)
return the value of the current element
Class which enables to project an image in the 3D space and get the view of a virtual camera...
void initScene(const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
bool displayDesiredObject
double get_x() const
Get the point x coordinate in the image plane.
static Type minimum(const Type &a, const Type &b)
A 40cm by 40cm plate with 3 points at coordinates (0,0,0), (0.1,0,0), (0,0.1,0). Each point is repres...
void getExternalImage(vpImage< unsigned char > &I)
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
Construction from translation vector and rotation matrix.
vpCameraParameters getInternalCameraParameters(const vpImage< unsigned char > &I) const
static double rad(double deg)
void displayTrajectory(const vpImage< unsigned char > &I, const std::list< vpHomogeneousMatrix > &list_cMo, const std::list< vpHomogeneousMatrix > &list_fMo, const vpHomogeneousMatrix &camMf)
vpCameraTrajectoryDisplayType camTrajType
A 40cm by 40cm plate with 4 points at coordinates (-0.07,-0.05,0), (0.07,0.05,0), (0...
vpSceneDesiredObject desiredObject
A 40cm by 40cm plate with 4 points at coordinates (0,-0.1,0), (0.1,0,0), (0,0.1,0), (-0.1,0,0). Each point is represented by a circle with 2cm radius.
void getInternalImage(vpImage< unsigned char > &I)
void display_scene(Matrix mat, Bound_scene &sc, const vpImage< vpRGBa > &I, const vpColor &color)
bool displayCameraTrajectory
vpHomogeneousMatrix camMf
vpHomogeneousMatrix navigation(const vpImage< vpRGBa > &I, bool &changed)
Three parallel lines representing a road.
vpImagePoint projectCameraTrajectory(const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo)
vpHomogeneousMatrix inverse() const
A pipe represented by a cylinder of 25 cm length and 15cm radius.
unsigned int getHeight() const
virtual bool getClick(bool blocking=true)=0
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void setCameraPosition(const vpHomogeneousMatrix &_cMt)
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
std::list< vpHomogeneousMatrix > poseList
vpHomogeneousMatrix camMf2
static const vpColor blue
void setWorldCoordinates(const double ox, const double oy, const double oz)
Set the point world coordinates. We mean here the coordinates of the point in the object frame...