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 ();
418 memmove((
char *) m, (
char *) mat,
sizeof (Matrix));
419 View_to_Matrix (get_vwstack (), *(get_tmstack ()));
420 postmult_matrix (m, *(get_tmstack ()));
422 bend = bp + sc.bound.nbr;
423 for (; bp < bend; bp++)
425 if ((clip = clipping_Bound (bp, m)) != NULL)
427 Face *fp = clip->face.ptr;
428 Face *fend = fp + clip->face.nbr;
430 set_Bound_face_display (clip, b);
432 point_3D_2D (clip->point.ptr, clip->point.nbr,I.
getWidth(),I.
getHeight(),point2i);
433 for (; fp < fend; fp++)
437 wireframe_Face (fp, point2i);
438 Point2i *pt = listpoint2i;
439 for (
int i = 1; i < fp->vertex.nbr; i++)
444 if (fp->vertex.nbr > 2)
464 Byte b = (Byte) *get_rfstack ();
468 bcopy ((
char *) mat, (
char *) m,
sizeof (Matrix));
469 View_to_Matrix (get_vwstack (), *(get_tmstack ()));
470 postmult_matrix (m, *(get_tmstack ()));
472 bend = bp + sc.bound.nbr;
473 for (; bp < bend; bp++)
475 if ((clip = clipping_Bound (bp, m)) != NULL)
477 Face *fp = clip->face.ptr;
478 Face *fend = fp + clip->face.nbr;
480 set_Bound_face_display (clip, b);
482 point_3D_2D (clip->point.ptr, clip->point.nbr,I.
getWidth(),I.
getHeight(),point2i);
483 for (; fp < fend; fp++)
487 wireframe_Face (fp, point2i);
488 Point2i *pt = listpoint2i;
489 for (
int i = 1; i < fp->vertex.nbr; i++)
494 if (fp->vertex.nbr > 2)
518 scene_dir = VISP_SCENES_DIR;
522 std::cout <<
"The simulator uses data from VISP_SCENES_DIR=" << scene_dir << std::endl;
525 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,
"/cercle_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());
856 strcpy(name, scene_dir.c_str());
859 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
860 case CUBE : { strcat(name,
"/cube.bnd");
break; }
861 case PLATE : { strcat(name,
"/plate.bnd");
break; }
862 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
863 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
864 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
865 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
866 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
867 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
868 case ROAD : { strcat(name,
"/road.bnd");
break; }
869 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
870 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
871 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
872 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
873 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
874 case PLAN: { strcat(name,
"/plan.bnd");
break; }
875 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
877 set_scene(name,&(this->
scene),1.0);
879 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
880 else add_rfstack(IS_BACK);
882 add_vwstack (
"start",
"depth", 0.0, 100.0);
883 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
884 add_vwstack (
"start",
"type", PERSPECTIVE);
891 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
948 char name_cam[FILENAME_MAX];
949 char name[FILENAME_MAX];
953 strcpy(name_cam, scene_dir.c_str());
954 strcat(name_cam,
"/camera.bnd");
959 model = getExtension(obj);
960 if (model == BND_MODEL)
961 set_scene(name,&(this->
scene),1.0);
962 else if (model == WRL_MODEL)
963 set_scene_wrl(name,&(this->
scene),1.0);
964 else if (model == UNKNOWN_MODEL)
969 add_rfstack(IS_BACK);
971 add_vwstack (
"start",
"depth", 0.0, 100.0);
972 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
973 add_vwstack (
"start",
"type", PERSPECTIVE);
980 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1055 float o44c[4][4],o44cd[4][4],x,y,z;
1056 Matrix
id = IDENTITY_MATRIX;
1075 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1076 x = o44c[2][0] + o44c[3][0];
1077 y = o44c[2][1] + o44c[3][1];
1078 z = o44c[2][2] + o44c[3][2];
1079 add_vwstack (
"start",
"vrp", x,y,z);
1080 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1081 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1082 add_vwstack (
"start",
"window", -u, u, -v, v);
1087 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1088 x = o44cd[2][0] + o44cd[3][0];
1089 y = o44cd[2][1] + o44cd[3][1];
1090 z = o44cd[2][2] + o44cd[3][2];
1091 add_vwstack (
"start",
"vrp", x,y,z);
1092 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1093 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1094 add_vwstack (
"start",
"window", -u, u, -v, v);
1114 bool changed =
false;
1118 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1141 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1144 vp2jlc_matrix(
fMc,w44c);
1145 vp2jlc_matrix(
fMo,w44o);
1148 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1149 x = w44cext[2][0] + w44cext[3][0];
1150 y = w44cext[2][1] + w44cext[3][1];
1151 z = w44cext[2][2] + w44cext[3][2];
1152 add_vwstack (
"start",
"vrp", x,y,z);
1153 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1154 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1155 add_vwstack (
"start",
"window", -u, u, -v, v);
1158 add_vwstack (
"start",
"type", PERSPECTIVE);
1193 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1194 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1196 while ((iter_poseList !=
poseList.end()) && (iter_fMoList !=
fMoList.end()))
1257 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1277 vp2jlc_matrix(camMft.
inverse(),w44cext);
1279 vp2jlc_matrix(
fMo,w44o);
1281 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1282 x = w44cext[2][0] + w44cext[3][0];
1283 y = w44cext[2][1] + w44cext[3][1];
1284 z = w44cext[2][2] + w44cext[3][2];
1285 add_vwstack (
"start",
"vrp", x,y,z);
1286 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1287 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1288 add_vwstack (
"start",
"window", -u, u, -v, v);
1340 float o44c[4][4],o44cd[4][4],x,y,z;
1341 Matrix
id = IDENTITY_MATRIX;
1360 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1361 x = o44c[2][0] + o44c[3][0];
1362 y = o44c[2][1] + o44c[3][1];
1363 z = o44c[2][2] + o44c[3][2];
1364 add_vwstack (
"start",
"vrp", x,y,z);
1365 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1366 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1367 add_vwstack (
"start",
"window", -u, u, -v, v);
1372 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1373 x = o44cd[2][0] + o44cd[3][0];
1374 y = o44cd[2][1] + o44cd[3][1];
1375 z = o44cd[2][2] + o44cd[3][2];
1376 add_vwstack (
"start",
"vrp", x,y,z);
1377 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1378 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1379 add_vwstack (
"start",
"window", -u, u, -v, v);
1399 bool changed =
false;
1403 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1426 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1429 vp2jlc_matrix(
fMc,w44c);
1430 vp2jlc_matrix(
fMo,w44o);
1433 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1434 x = w44cext[2][0] + w44cext[3][0];
1435 y = w44cext[2][1] + w44cext[3][1];
1436 z = w44cext[2][2] + w44cext[3][2];
1437 add_vwstack (
"start",
"vrp", x,y,z);
1438 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1439 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1440 add_vwstack (
"start",
"window", -u, u, -v, v);
1443 add_vwstack (
"start",
"type", PERSPECTIVE);
1476 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1477 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1479 while ((iter_poseList!=
poseList.end()) && (iter_fMoList!=
fMoList.end()) )
1540 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1560 vp2jlc_matrix(camMft.
inverse(),w44cext);
1562 vp2jlc_matrix(
fMo,w44o);
1564 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1565 x = w44cext[2][0] + w44cext[3][0];
1566 y = w44cext[2][1] + w44cext[3][1];
1567 z = w44cext[2][2] + w44cext[3][2];
1568 add_vwstack (
"start",
"vrp", x,y,z);
1569 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1570 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1571 add_vwstack (
"start",
"window", -u, u, -v, v);
1591 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1692 if (list_cMo.size() != list_fMo.size())
1699 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1700 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1702 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1732 if (list_cMo.size() != list_fMo.size())
1739 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1740 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1742 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1768 bool clicked =
false;
1769 bool clickedUp =
false;
1822 anglei = diffi*360/width;
1823 anglej = diffj*360/width;
1843 mov.
buildFrom(diffj*0.01,diffi*0.01,0,0,0,0);
1862 bool clicked =
false;
1863 bool clickedUp =
false;
1918 anglei = diffi*360/width;
1919 anglej = diffj*360/width;
1939 mov.
buildFrom(diffj*0.01,diffi*0.01,0,0,0,0);
bool displayImageSimulator
unsigned int nbElements(void)
return the number of element in the list
vpCameraParameters getInternalCameraParameters(const vpImage< vpRGBa > &I) const
bool outside(void) const
Test if the current element is outside the list (on the virtual element)
unsigned int getWidth() const
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Provide simple list management.
void getImage(vpImage< unsigned char > &I, const vpCameraParameters &cam)
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.
vpHomogeneousMatrix navigation(vpImage< vpRGBa > &I, bool &changed)
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
std::list< vpImageSimulator > objectImage
std::list< vpImagePoint > cameraTrajectory
void track(const vpHomogeneousMatrix &cMo)
double get_y() const
Get the point y coordinate in the image plane.
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)
virtual bool getPointerPosition(vpImagePoint &ip)=0
void getInternalImage(vpImage< vpRGBa > &I)
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...
bool displayDesiredObject
double get_x() const
Get the point x coordinate in the image plane.
static Type minimum(const Type &a, const Type &b)
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
Construction from translation vector and rotation matrix.
static double rad(double deg)
vpCameraTrajectoryDisplayType camTrajType
void display_scene(Matrix mat, Bound_scene &sc, vpImage< vpRGBa > &I, vpColor color)
vpCameraParameters getExternalCameraParameters(const vpImage< vpRGBa > &I) const
vpSceneDesiredObject desiredObject
vpImagePoint projectCameraTrajectory(vpImage< vpRGBa > &I, vpHomogeneousMatrix cMo, vpHomogeneousMatrix fMo)
bool displayCameraTrajectory
vpHomogeneousMatrix camMf
vpHomogeneousMatrix inverse() const
void initScene(vpSceneObject obj, vpSceneDesiredObject desiredObject)
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)
void getExternalImage(vpImage< vpRGBa > &I)
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
std::list< vpHomogeneousMatrix > poseList
void displayTrajectory(vpImage< unsigned char > &I, const std::list< vpHomogeneousMatrix > &list_cMo, const std::list< vpHomogeneousMatrix > &list_fMo, const vpHomogeneousMatrix &camMf)
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...