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 #if defined(VISP_HAVE_COIN)
62 #include <Inventor/nodes/SoSeparator.h>
63 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h>
64 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h>
65 #include <Inventor/VRMLnodes/SoVRMLCoordinate.h>
66 #include <Inventor/actions/SoWriteAction.h>
67 #include <Inventor/actions/SoSearchAction.h>
68 #include <Inventor/misc/SoChildList.h>
69 #include <Inventor/actions/SoGetMatrixAction.h>
70 #include <Inventor/actions/SoGetPrimitiveCountAction.h>
71 #include <Inventor/actions/SoToVRML2Action.h>
72 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
73 #include <Inventor/VRMLnodes/SoVRMLShape.h>
76 extern "C"{
extern Point2i *point2i;}
77 extern "C"{
extern Point2i *listpoint2i;}
86 Model_3D getExtension(
const char* file);
87 void set_scene_wrl (
const char* str, Bound_scene *sc,
float factor);
93 getExtension(
const char* file)
95 std::string sfilename(file);
97 size_t bnd = sfilename.find(
"bnd");
98 size_t BND = sfilename.find(
"BND");
99 size_t wrl = sfilename.find(
"wrl");
100 size_t WRL = sfilename.find(
"WRL");
102 size_t size = sfilename.size();
104 if ((bnd>0 && bnd<size ) || (BND>0 && BND<size))
106 else if ((wrl>0 && wrl<size) || ( WRL>0 && WRL<size))
108 #if defined(VISP_HAVE_COIN)
111 std::cout <<
"Coin not installed, cannot read VRML files" << std::endl;
112 throw std::string(
"Coin not installed, cannot read VRML files");
115 return UNKNOWN_MODEL;
121 void set_scene (
const char* str, Bound_scene *sc,
float factor)
126 if ((fd = fopen (str,
"r")) == NULL)
128 std::string error =
"The file " + std::string(str) +
" can not be opened";
132 open_keyword (keyword_tbl);
134 open_source (fd, str);
135 malloc_Bound_scene (sc, str,(Index)BOUND_NBR);
139 if (std::fabs(factor) > std::numeric_limits<double>::epsilon())
141 for (
int i = 0; i < sc->bound.nbr; i++)
143 for (
int j = 0; j < sc->bound.ptr[i].point.nbr; j++)
145 sc->bound.ptr[i].point.ptr[j].x = sc->bound.ptr[i].point.ptr[j].x*factor;
146 sc->bound.ptr[i].point.ptr[j].y = sc->bound.ptr[i].point.ptr[j].y*factor;
147 sc->bound.ptr[i].point.ptr[j].z = sc->bound.ptr[i].point.ptr[j].z*factor;
158 #if defined(VISP_HAVE_COIN)
160 #ifndef DOXYGEN_SHOULD_SKIP_THIS
164 std::vector<vpPoint> pt;
166 std::vector<int> index;
168 #endif // DOXYGEN_SHOULD_SKIP_THIS
170 void extractFaces(SoVRMLIndexedFaceSet*, indexFaceSet *ifs);
171 void ifsToBound (Bound*, std::list<indexFaceSet*> &);
172 void destroyIfs(std::list<indexFaceSet*> &);
175 void set_scene_wrl (
const char* str, Bound_scene *sc,
float factor)
180 SbBool ok = in.openFile(str);
181 SoSeparator *sceneGraph;
182 SoVRMLGroup *sceneGraphVRML2;
185 vpERROR_TRACE(
"can't open file \"%s\" \n Please check the Marker_Less.ini file", str);
189 if(!in.isFileVRML2())
191 sceneGraph = SoDB::readAll(&in);
192 if (sceneGraph == NULL) { }
195 SoToVRML2Action tovrml2;
196 tovrml2.apply(sceneGraph);
197 sceneGraphVRML2 =tovrml2.getVRML2SceneGraph();
198 sceneGraphVRML2->ref();
203 sceneGraphVRML2 = SoDB::readAllVRML(&in);
204 if (sceneGraphVRML2 == NULL) {
208 sceneGraphVRML2->ref();
213 int nbShapes = sceneGraphVRML2->getNumChildren();
217 malloc_Bound_scene (sc, str,(Index)BOUND_NBR);
220 for (
int i = 0; i < nbShapes; i++)
223 child = sceneGraphVRML2->getChild(i);
224 if (child->getTypeId() == SoVRMLShape::getClassTypeId())
226 std::list<indexFaceSet*> ifs_list;
227 SoChildList * child2list = child->getChildren();
228 for (
int j = 0; j < child2list->getLength(); j++)
230 if (((SoNode*)child2list->get(j))->getTypeId() == SoVRMLIndexedFaceSet::getClassTypeId())
232 indexFaceSet *ifs =
new indexFaceSet;
233 SoVRMLIndexedFaceSet * face_set;
234 face_set = (SoVRMLIndexedFaceSet*)child2list->get(j);
235 extractFaces(face_set,ifs);
236 ifs_list.push_back(ifs);
248 ifsToBound (&(sc->bound.ptr[iterShapes]), ifs_list);
249 destroyIfs(ifs_list);
255 if (std::fabs(factor) > std::numeric_limits<double>::epsilon())
257 for (
int i = 0; i < sc->bound.nbr; i++)
259 for (
int j = 0; j < sc->bound.ptr[i].point.nbr; j++)
261 sc->bound.ptr[i].point.ptr[j].x = sc->bound.ptr[i].point.ptr[j].x*factor;
262 sc->bound.ptr[i].point.ptr[j].y = sc->bound.ptr[i].point.ptr[j].y*factor;
263 sc->bound.ptr[i].point.ptr[j].z = sc->bound.ptr[i].point.ptr[j].z*factor;
271 extractFaces(SoVRMLIndexedFaceSet* face_set, indexFaceSet *ifs)
275 SoVRMLCoordinate *coord = (SoVRMLCoordinate *)(face_set->coord.getValue());
276 int coordSize = coord->point.getNum();
278 ifs->nbPt = coordSize;
279 for (
int i = 0; i < coordSize; i++)
281 SbVec3f point(0,0,0);
282 point[0]=coord->point[i].getValue()[0];
283 point[1]=coord->point[i].getValue()[1];
284 point[2]=coord->point[i].getValue()[2];
287 ifs->pt.push_back(pt);
290 SoMFInt32 indexList = face_set->coordIndex;
291 int indexListSize = indexList.getNum();
293 ifs->nbIndex = indexListSize;
294 for (
int i = 0; i < indexListSize; i++)
296 int index = face_set->coordIndex[i];
297 ifs->index.push_back(index);
301 void ifsToBound (Bound* bptr, std::list<indexFaceSet*> &ifs_list)
304 for(std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it){
307 bptr->point.nbr = (Index)nbPt;
308 bptr->point.ptr = (Point3f *) malloc ((
unsigned int)nbPt *
sizeof (Point3f));
311 unsigned int iter = 0;
312 for (std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it)
314 indexFaceSet* ifs = *it;
315 for (
unsigned int j = 0; j < (
unsigned int)ifs->nbPt; j++)
317 bptr->point.ptr[iter].x = (float)ifs->pt[j].get_oX();
318 bptr->point.ptr[iter].y = (float)ifs->pt[j].get_oY();
319 bptr->point.ptr[iter].z = (float)ifs->pt[j].get_oZ();
324 unsigned int nbFace = 0;
326 std::list<int> indSize;
328 for (std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it)
330 indexFaceSet* ifs = *it;
331 for (
unsigned int j = 0; j < (
unsigned int)ifs->nbIndex; j++)
333 if(ifs->index[j] == -1)
336 indSize.push_back(indice);
343 bptr->face.nbr = (Index)nbFace;
344 bptr->face.ptr = (Face *) malloc (nbFace *
sizeof (Face));
347 std::list<int>::const_iterator iter_indSize = indSize.begin();
348 for (
unsigned int i = 0; i < indSize.size(); i++)
350 bptr->face.ptr[i].vertex.nbr = (Index)*iter_indSize;
351 bptr->face.ptr[i].vertex.ptr = (Index *) malloc ((
unsigned int)*iter_indSize *
sizeof (Index));
357 for (std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it)
359 indexFaceSet* ifs = *it;
361 for (
unsigned int j = 0; j < (
unsigned int)ifs->nbIndex; j++)
363 if(ifs->index[j] != -1)
365 bptr->face.ptr[indice].vertex.ptr[iter] = (Index)(ifs->index[j] + offset);
378 void destroyIfs(std::list<indexFaceSet*> &ifs_list)
380 for(std::list<indexFaceSet*>::const_iterator it=ifs_list.begin(); it!=ifs_list.end(); ++it){
386 void set_scene_wrl (
const char* , Bound_scene* ,
float )
397 for (
unsigned int i = 0; i < 4; i++) {
398 for (
unsigned int j = 0; j < 4; j++)
399 jlcM[j][i] = (
float)vpM[i][j];
412 Byte b = (Byte) *get_rfstack ();
416 memmove((
char *) m, (
char *) mat,
sizeof (Matrix));
417 View_to_Matrix (get_vwstack (), *(get_tmstack ()));
418 postmult_matrix (m, *(get_tmstack ()));
420 bend = bp + sc.bound.nbr;
421 for (; bp < bend; bp++)
423 if ((clip = clipping_Bound (bp, m)) != NULL)
425 Face *fp = clip->face.ptr;
426 Face *fend = fp + clip->face.nbr;
428 set_Bound_face_display (clip, b);
430 point_3D_2D (clip->point.ptr, clip->point.nbr,I.
getWidth(),I.
getHeight(),point2i);
431 for (; fp < fend; fp++)
435 wireframe_Face (fp, point2i);
436 Point2i *pt = listpoint2i;
437 for (
int i = 1; i < fp->vertex.nbr; i++)
442 if (fp->vertex.nbr > 2)
462 Byte b = (Byte) *get_rfstack ();
466 memmove((
char *) m, (
char *) mat,
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)
513 : scene(), desiredScene(), camera(), objectImage(), fMo(), fMc(), camMf(),
514 refMo(), cMo(), cdMo(), object(PLATE), desiredObject(D_STANDARD),
516 desColor(
vpColor::red), sceneInitialized(false), displayCameraTrajectory(true),
517 cameraTrajectory(), poseList(), fMoList(), nbrPtLimit(1000), old_iPr(), old_iPz(),
518 old_iPt(), blockedr(false), blockedz(false), blockedt(false), blocked(false),
519 camMf2(), f2Mf(), px_int(1), py_int(1), px_ext(1), py_ext(1), displayObject(false),
520 displayDesiredObject(false), displayCamera(false), displayImageSimulator(false),
521 cameraFactor(1.), camTrajType(CT_LINE), extCamChanged(false), rotz(), thickness_(1), scene_dir()
525 scene_dir = VISP_SCENES_DIR;
529 std::cout <<
"The simulator uses data from VISP_SCENES_DIR=" << scene_dir << std::endl;
532 std::cout <<
"Cannot get VISP_SCENES_DIR environment variable" << std::endl;
546 scene.bound.ptr = NULL;
567 free_Bound_scene (&(this->
scene));
569 free_Bound_scene (&(this->
camera));
595 char name_cam[FILENAME_MAX];
596 char name[FILENAME_MAX];
601 const char *scene_dir_ = scene_dir.c_str();
602 if (strlen(scene_dir_) >= FILENAME_MAX) {
604 "Not enough memory to intialize the camera name"));
607 strcpy(name_cam, scene_dir_);
610 strcat(name_cam,
"/camera.bnd");
615 strcat(name_cam,
"/tool.bnd");
616 set_scene(name_cam,&(this->
camera),1.0);
619 strcpy(name, scene_dir_);
622 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
623 case CUBE : { strcat(name,
"/cube.bnd");
break; }
624 case PLATE : { strcat(name,
"/plate.bnd");
break; }
625 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
626 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
627 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
628 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
629 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
630 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
631 case ROAD : { strcat(name,
"/road.bnd");
break; }
632 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
633 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
634 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
635 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
636 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
637 case PLAN: { strcat(name,
"/plan.bnd");
break; }
638 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
640 set_scene(name,&(this->
scene),1.0);
642 scene_dir_ = scene_dir.c_str();
643 if (strlen(scene_dir_) >= FILENAME_MAX) {
645 "Not enough memory to intialize the desired object name"));
652 strcpy(name, scene_dir_);
653 strcat(name,
"/circle_sq2.bnd");
656 strcpy(name, scene_dir_);
657 strcat(name,
"/tool.bnd");
662 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
663 else add_rfstack(IS_BACK);
665 add_vwstack (
"start",
"depth", 0.0, 100.0);
666 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
667 add_vwstack (
"start",
"type", PERSPECTIVE);
676 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
738 char name_cam[FILENAME_MAX];
739 char name[FILENAME_MAX];
744 const char *scene_dir_ = scene_dir.c_str();
745 if (strlen(scene_dir_) >= FILENAME_MAX) {
747 "Not enough memory to intialize the camera name"));
750 strcpy(name_cam, scene_dir_);
751 strcat(name_cam,
"/camera.bnd");
754 if (strlen(obj) >= FILENAME_MAX) {
756 "Not enough memory to intialize the name"));
761 model = getExtension(obj);
762 if (model == BND_MODEL)
763 set_scene(name,&(this->
scene),1.0);
764 else if (model == WRL_MODEL)
765 set_scene_wrl(name,&(this->
scene),1.0);
766 else if (model == UNKNOWN_MODEL)
771 if (strlen(desired_object) >= FILENAME_MAX) {
773 "Not enough memory to intialize the camera name"));
776 strcpy(name,desired_object);
777 model = getExtension(desired_object);
778 if (model == BND_MODEL)
780 else if (model == WRL_MODEL)
782 else if (model == UNKNOWN_MODEL)
787 add_rfstack(IS_BACK);
789 add_vwstack (
"start",
"depth", 0.0, 100.0);
790 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
791 add_vwstack (
"start",
"type", PERSPECTIVE);
799 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
858 char name_cam[FILENAME_MAX];
859 char name[FILENAME_MAX];
863 const char *scene_dir_ = scene_dir.c_str();
864 if (strlen(scene_dir_) >= FILENAME_MAX) {
866 "Not enough memory to intialize the camera name"));
869 strcpy(name_cam, scene_dir_);
870 strcat(name_cam,
"/camera.bnd");
873 strcpy(name, scene_dir_);
876 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
877 case CUBE : { strcat(name,
"/cube.bnd");
break; }
878 case PLATE : { strcat(name,
"/plate.bnd");
break; }
879 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
880 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
881 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
882 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
883 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
884 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
885 case ROAD : { strcat(name,
"/road.bnd");
break; }
886 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
887 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
888 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
889 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
890 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
891 case PLAN: { strcat(name,
"/plan.bnd");
break; }
892 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
894 set_scene(name,&(this->
scene),1.0);
896 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
897 else add_rfstack(IS_BACK);
899 add_vwstack (
"start",
"depth", 0.0, 100.0);
900 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
901 add_vwstack (
"start",
"type", PERSPECTIVE);
911 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
968 char name_cam[FILENAME_MAX];
969 char name[FILENAME_MAX];
973 const char *scene_dir_ = scene_dir.c_str();
974 if (strlen(scene_dir_) >= FILENAME_MAX) {
976 "Not enough memory to intialize the camera name"));
979 strcpy(name_cam, scene_dir_);
980 strcat(name_cam,
"/camera.bnd");
983 if (strlen(obj) >= FILENAME_MAX) {
985 "Not enough memory to intialize the name"));
990 model = getExtension(obj);
991 if (model == BND_MODEL)
992 set_scene(name,&(this->
scene),1.0);
993 else if (model == WRL_MODEL)
994 set_scene_wrl(name,&(this->
scene),1.0);
995 else if (model == UNKNOWN_MODEL)
1000 add_rfstack(IS_BACK);
1002 add_vwstack (
"start",
"depth", 0.0, 100.0);
1003 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
1004 add_vwstack (
"start",
"type", PERSPECTIVE);
1011 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1086 float o44c[4][4],o44cd[4][4],x,y,z;
1087 Matrix
id = IDENTITY_MATRIX;
1106 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1107 x = o44c[2][0] + o44c[3][0];
1108 y = o44c[2][1] + o44c[3][1];
1109 z = o44c[2][2] + o44c[3][2];
1110 add_vwstack (
"start",
"vrp", x,y,z);
1111 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1112 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1113 add_vwstack (
"start",
"window", -u, u, -v, v);
1118 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1119 x = o44cd[2][0] + o44cd[3][0];
1120 y = o44cd[2][1] + o44cd[3][1];
1121 z = o44cd[2][2] + o44cd[3][2];
1122 add_vwstack (
"start",
"vrp", x,y,z);
1123 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1124 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1125 add_vwstack (
"start",
"window", -u, u, -v, v);
1145 bool changed =
false;
1149 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1172 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1175 vp2jlc_matrix(
fMc,w44c);
1176 vp2jlc_matrix(
fMo,w44o);
1179 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1180 x = w44cext[2][0] + w44cext[3][0];
1181 y = w44cext[2][1] + w44cext[3][1];
1182 z = w44cext[2][2] + w44cext[3][2];
1183 add_vwstack (
"start",
"vrp", x,y,z);
1184 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1185 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1186 add_vwstack (
"start",
"window", -u, u, -v, v);
1189 add_vwstack (
"start",
"type", PERSPECTIVE);
1224 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1225 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1227 while ((iter_poseList !=
poseList.end()) && (iter_fMoList !=
fMoList.end()))
1288 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1308 vp2jlc_matrix(camMft.
inverse(),w44cext);
1310 vp2jlc_matrix(
fMo,w44o);
1312 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1313 x = w44cext[2][0] + w44cext[3][0];
1314 y = w44cext[2][1] + w44cext[3][1];
1315 z = w44cext[2][2] + w44cext[3][2];
1316 add_vwstack (
"start",
"vrp", x,y,z);
1317 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1318 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1319 add_vwstack (
"start",
"window", -u, u, -v, v);
1371 float o44c[4][4],o44cd[4][4],x,y,z;
1372 Matrix
id = IDENTITY_MATRIX;
1391 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1392 x = o44c[2][0] + o44c[3][0];
1393 y = o44c[2][1] + o44c[3][1];
1394 z = o44c[2][2] + o44c[3][2];
1395 add_vwstack (
"start",
"vrp", x,y,z);
1396 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1397 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1398 add_vwstack (
"start",
"window", -u, u, -v, v);
1403 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1404 x = o44cd[2][0] + o44cd[3][0];
1405 y = o44cd[2][1] + o44cd[3][1];
1406 z = o44cd[2][2] + o44cd[3][2];
1407 add_vwstack (
"start",
"vrp", x,y,z);
1408 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1409 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1410 add_vwstack (
"start",
"window", -u, u, -v, v);
1430 bool changed =
false;
1434 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1457 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1460 vp2jlc_matrix(
fMc,w44c);
1461 vp2jlc_matrix(
fMo,w44o);
1464 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1465 x = w44cext[2][0] + w44cext[3][0];
1466 y = w44cext[2][1] + w44cext[3][1];
1467 z = w44cext[2][2] + w44cext[3][2];
1468 add_vwstack (
"start",
"vrp", x,y,z);
1469 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1470 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1471 add_vwstack (
"start",
"window", -u, u, -v, v);
1474 add_vwstack (
"start",
"type", PERSPECTIVE);
1507 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1508 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1510 while ((iter_poseList!=
poseList.end()) && (iter_fMoList!=
fMoList.end()) )
1571 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1591 vp2jlc_matrix(camMft.
inverse(),w44cext);
1593 vp2jlc_matrix(
fMo,w44o);
1595 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1596 x = w44cext[2][0] + w44cext[3][0];
1597 y = w44cext[2][1] + w44cext[3][1];
1598 z = w44cext[2][2] + w44cext[3][2];
1599 add_vwstack (
"start",
"vrp", x,y,z);
1600 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1601 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1602 add_vwstack (
"start",
"window", -u, u, -v, v);
1622 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1723 if (list_cMo.size() != list_fMo.size())
1730 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1731 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1733 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1763 if (list_cMo.size() != list_fMo.size())
1770 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1771 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1773 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1799 bool clicked =
false;
1800 bool clickedUp =
false;
1853 anglei = diffi*360/width;
1854 anglej = diffj*360/width;
1874 mov.
buildFrom(diffj*0.01,diffi*0.01,0,0,0,0);
1893 bool clicked =
false;
1894 bool clickedUp =
false;
1949 anglei = diffi*360/width;
1950 anglej = diffj*360/width;
1970 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.
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.
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
void setCameraPosition(const vpHomogeneousMatrix &cMt)
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
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
std::list< vpHomogeneousMatrix > poseList
vpHomogeneousMatrix camMf2
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...