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;
584 free_Bound_scene (&(this->
scene));
586 free_Bound_scene (&(this->
camera));
612 char name_cam[FILENAME_MAX];
613 char name[FILENAME_MAX];
618 strcpy(name_cam, scene_dir.c_str());
619 if (desiredObject !=
D_TOOL)
621 strcat(name_cam,
"/camera.bnd");
626 strcat(name_cam,
"/tool.bnd");
627 set_scene(name_cam,&(this->
camera),1.0);
630 strcpy(name, scene_dir.c_str());
633 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
634 case CUBE : { strcat(name,
"/cube.bnd");
break; }
635 case PLATE : { strcat(name,
"/plate.bnd");
break; }
636 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
637 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
638 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
639 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
640 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
641 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
642 case ROAD : { strcat(name,
"/road.bnd");
break; }
643 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
644 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
645 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
646 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
647 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
648 case PLAN: { strcat(name,
"/plan.bnd");
break; }
649 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
651 set_scene(name,&(this->
scene),1.0);
653 switch (desiredObject)
657 strcpy(name, scene_dir.c_str());
658 strcat(name,
"/cercle_sq2.bnd");
661 strcpy(name, scene_dir.c_str());
662 strcat(name,
"/tool.bnd");
667 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
668 else add_rfstack(IS_BACK);
670 add_vwstack (
"start",
"depth", 0.0, 100.0);
671 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
672 add_vwstack (
"start",
"type", PERSPECTIVE);
681 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
743 char name_cam[FILENAME_MAX];
744 char name[FILENAME_MAX];
749 strcpy(name_cam, scene_dir.c_str());
750 strcat(name_cam,
"/camera.bnd");
755 model = getExtension(obj);
756 if (model == BND_MODEL)
757 set_scene(name,&(this->
scene),1.0);
758 else if (model == WRL_MODEL)
759 set_scene_wrl(name,&(this->
scene),1.0);
760 else if (model == UNKNOWN_MODEL)
765 strcpy(name,desiredObject);
766 model = getExtension(desiredObject);
767 if (model == BND_MODEL)
769 else if (model == WRL_MODEL)
771 else if (model == UNKNOWN_MODEL)
776 add_rfstack(IS_BACK);
778 add_vwstack (
"start",
"depth", 0.0, 100.0);
779 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
780 add_vwstack (
"start",
"type", PERSPECTIVE);
788 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
847 char name_cam[FILENAME_MAX];
848 char name[FILENAME_MAX];
852 strcpy(name_cam, scene_dir.c_str());
854 strcpy(name, scene_dir.c_str());
857 case THREE_PTS : {strcat(name,
"/3pts.bnd");
break; }
858 case CUBE : { strcat(name,
"/cube.bnd");
break; }
859 case PLATE : { strcat(name,
"/plate.bnd");
break; }
860 case SMALL_PLATE : { strcat(name,
"/plate_6cm.bnd");
break; }
861 case RECTANGLE : { strcat(name,
"/rectangle.bnd");
break; }
862 case SQUARE_10CM : { strcat(name,
"/square10cm.bnd");
break; }
863 case DIAMOND : { strcat(name,
"/diamond.bnd");
break; }
864 case TRAPEZOID : { strcat(name,
"/trapezoid.bnd");
break; }
865 case THREE_LINES : { strcat(name,
"/line.bnd");
break; }
866 case ROAD : { strcat(name,
"/road.bnd");
break; }
867 case TIRE : { strcat(name,
"/circles2.bnd");
break; }
868 case PIPE : { strcat(name,
"/pipe.bnd");
break; }
869 case CIRCLE : { strcat(name,
"/circle.bnd");
break; }
870 case SPHERE : { strcat(name,
"/sphere.bnd");
break; }
871 case CYLINDER : { strcat(name,
"/cylinder.bnd");
break; }
872 case PLAN: { strcat(name,
"/plan.bnd");
break; }
873 case POINT_CLOUD: { strcat(name,
"/point_cloud.bnd");
break; }
875 set_scene(name,&(this->
scene),1.0);
877 if (obj ==
PIPE) load_rfstack(IS_INSIDE);
878 else add_rfstack(IS_BACK);
880 add_vwstack (
"start",
"depth", 0.0, 100.0);
881 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
882 add_vwstack (
"start",
"type", PERSPECTIVE);
889 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
946 char name_cam[FILENAME_MAX];
947 char name[FILENAME_MAX];
951 strcpy(name_cam, scene_dir.c_str());
952 strcat(name_cam,
"/camera.bnd");
957 model = getExtension(obj);
958 if (model == BND_MODEL)
959 set_scene(name,&(this->
scene),1.0);
960 else if (model == WRL_MODEL)
961 set_scene_wrl(name,&(this->
scene),1.0);
962 else if (model == UNKNOWN_MODEL)
967 add_rfstack(IS_BACK);
969 add_vwstack (
"start",
"depth", 0.0, 100.0);
970 add_vwstack (
"start",
"window", -0.1,0.1,-0.1,0.1);
971 add_vwstack (
"start",
"type", PERSPECTIVE);
978 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1053 float o44c[4][4],o44cd[4][4],x,y,z;
1054 Matrix
id = IDENTITY_MATRIX;
1073 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1074 x = o44c[2][0] + o44c[3][0];
1075 y = o44c[2][1] + o44c[3][1];
1076 z = o44c[2][2] + o44c[3][2];
1077 add_vwstack (
"start",
"vrp", x,y,z);
1078 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1079 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1080 add_vwstack (
"start",
"window", -u, u, -v, v);
1085 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1086 x = o44cd[2][0] + o44cd[3][0];
1087 y = o44cd[2][1] + o44cd[3][1];
1088 z = o44cd[2][2] + o44cd[3][2];
1089 add_vwstack (
"start",
"vrp", x,y,z);
1090 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1091 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1092 add_vwstack (
"start",
"window", -u, u, -v, v);
1112 bool changed =
false;
1116 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1139 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1142 vp2jlc_matrix(
fMc,w44c);
1143 vp2jlc_matrix(
fMo,w44o);
1146 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1147 x = w44cext[2][0] + w44cext[3][0];
1148 y = w44cext[2][1] + w44cext[3][1];
1149 z = w44cext[2][2] + w44cext[3][2];
1150 add_vwstack (
"start",
"vrp", x,y,z);
1151 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1152 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1153 add_vwstack (
"start",
"window", -u, u, -v, v);
1156 add_vwstack (
"start",
"type", PERSPECTIVE);
1191 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1192 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1194 while ((iter_poseList !=
poseList.end()) && (iter_fMoList !=
fMoList.end()))
1255 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1275 vp2jlc_matrix(camMft.
inverse(),w44cext);
1277 vp2jlc_matrix(
fMo,w44o);
1279 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1280 x = w44cext[2][0] + w44cext[3][0];
1281 y = w44cext[2][1] + w44cext[3][1];
1282 z = w44cext[2][2] + w44cext[3][2];
1283 add_vwstack (
"start",
"vrp", x,y,z);
1284 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1285 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1286 add_vwstack (
"start",
"window", -u, u, -v, v);
1338 float o44c[4][4],o44cd[4][4],x,y,z;
1339 Matrix
id = IDENTITY_MATRIX;
1358 add_vwstack (
"start",
"cop", o44c[3][0],o44c[3][1],o44c[3][2]);
1359 x = o44c[2][0] + o44c[3][0];
1360 y = o44c[2][1] + o44c[3][1];
1361 z = o44c[2][2] + o44c[3][2];
1362 add_vwstack (
"start",
"vrp", x,y,z);
1363 add_vwstack (
"start",
"vpn", o44c[2][0],o44c[2][1],o44c[2][2]);
1364 add_vwstack (
"start",
"vup", o44c[1][0],o44c[1][1],o44c[1][2]);
1365 add_vwstack (
"start",
"window", -u, u, -v, v);
1370 add_vwstack (
"start",
"cop", o44cd[3][0],o44cd[3][1],o44cd[3][2]);
1371 x = o44cd[2][0] + o44cd[3][0];
1372 y = o44cd[2][1] + o44cd[3][1];
1373 z = o44cd[2][2] + o44cd[3][2];
1374 add_vwstack (
"start",
"vrp", x,y,z);
1375 add_vwstack (
"start",
"vpn", o44cd[2][0],o44cd[2][1],o44cd[2][2]);
1376 add_vwstack (
"start",
"vup", o44cd[1][0],o44cd[1][1],o44cd[1][2]);
1377 add_vwstack (
"start",
"window", -u, u, -v, v);
1397 bool changed =
false;
1401 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon() )
1424 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1427 vp2jlc_matrix(
fMc,w44c);
1428 vp2jlc_matrix(
fMo,w44o);
1431 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1432 x = w44cext[2][0] + w44cext[3][0];
1433 y = w44cext[2][1] + w44cext[3][1];
1434 z = w44cext[2][2] + w44cext[3][2];
1435 add_vwstack (
"start",
"vrp", x,y,z);
1436 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1437 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1438 add_vwstack (
"start",
"window", -u, u, -v, v);
1441 add_vwstack (
"start",
"type", PERSPECTIVE);
1474 std::list<vpHomogeneousMatrix>::const_iterator iter_poseList =
poseList.begin();
1475 std::list<vpHomogeneousMatrix>::const_iterator iter_fMoList =
fMoList.begin();
1477 while ((iter_poseList!=
poseList.end()) && (iter_fMoList!=
fMoList.end()) )
1538 float w44o[4][4],w44cext[4][4],w44c[4][4],x,y,z;
1558 vp2jlc_matrix(camMft.
inverse(),w44cext);
1560 vp2jlc_matrix(
fMo,w44o);
1562 add_vwstack (
"start",
"cop", w44cext[3][0],w44cext[3][1],w44cext[3][2]);
1563 x = w44cext[2][0] + w44cext[3][0];
1564 y = w44cext[2][1] + w44cext[3][1];
1565 z = w44cext[2][2] + w44cext[3][2];
1566 add_vwstack (
"start",
"vrp", x,y,z);
1567 add_vwstack (
"start",
"vpn", w44cext[2][0],w44cext[2][1],w44cext[2][2]);
1568 add_vwstack (
"start",
"vup", w44cext[1][0],w44cext[1][1],w44cext[1][2]);
1569 add_vwstack (
"start",
"window", -u, u, -v, v);
1589 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1690 if (list_cMo.size() != list_fMo.size())
1697 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1698 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1700 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1730 if (list_cMo.size() != list_fMo.size())
1737 std::list<vpHomogeneousMatrix>::const_iterator it_cMo = list_cMo.begin();
1738 std::list<vpHomogeneousMatrix>::const_iterator it_fMo = list_fMo.begin();
1740 while ((it_cMo != list_cMo.end()) && (it_fMo != list_fMo.end()))
1766 bool clicked =
false;
1767 bool clickedUp =
false;
1820 anglei = diffi*360/width;
1821 anglej = diffj*360/width;
1841 mov.
buildFrom(diffj*0.01,diffi*0.01,0,0,0,0);
1860 bool clicked =
false;
1861 bool clickedUp =
false;
1916 anglei = diffi*360/width;
1917 anglej = diffj*360/width;
1937 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
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.
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.
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)
vpCameraParameters getExternalCameraParameters(const vpImage< unsigned char > &I) const
virtual bool getPointerPosition(vpImagePoint &ip)=0
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)
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
vpSceneDesiredObject desiredObject
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)
vpImagePoint projectCameraTrajectory(const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo)
vpHomogeneousMatrix inverse() const
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...