Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpViewio.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Le module "viewio.c" contient les procedures d'entree/sortie
32 * des types definis dans le module "view.h".
33 * Les entrees non specifiees sont effectuees
34 * sur le fichier source de "lex.c".
35 * Pour les mots cles des "fprintf_..." voir "token.c".
36 *
37 * Authors:
38 * Jean-Luc CORRE
39 */
40
41#include <visp3/core/vpConfig.h>
42
43#ifndef DOXYGEN_SHOULD_SKIP_THIS
44
45#include <stdio.h>
46
47#include "vpArit.h"
48#include "vpLex.h"
49#include "vpMyio.h"
50#include "vpSkipio.h"
51#include "vpToken.h"
52#include "vpViewio.h"
53
55/*
56 * La procedure "fscanf_Remove" lit en ascii les parametres d'elimination
57 * des faces.
58 * Entree :
59 * bp Parametres a lire.
60 */
61 void fscanf_Remove(Byte *bp)
62{
63 switch (lex()) {
64 case T_NONE:
65 *bp = IS_INSIDE;
66 break;
67 case T_ABOVE:
68 *bp |= IS_ABOVE;
69 break;
70 case T_BACK:
71 *bp |= IS_BACK;
72 break;
73 case T_BELOW:
74 *bp |= IS_BELOW;
75 break;
76 case T_FRONT:
77 *bp |= IS_FRONT;
78 break;
79 case T_LEFT:
80 *bp |= IS_LEFT;
81 break;
82 case T_RIGHT:
83 *bp |= IS_RIGHT;
84 break;
85 default:
86 lexerr("start", "remove: keyword "
87 "\"none|above|back|below|front|left|right\" expected");
88 break;
89 }
90}
91
92/*
93 * La procedure "fscanf_View_parameters" lit en ascii les parametres
94 * de visualisation.
95 * Entree :
96 * vp Parametres de visualisation a lire.
97 */
98void fscanf_View_parameters(View_parameters *vp)
99{
100 /* Lecture du type de projection lors de la prise de vue. */
101
102 skip_keyword(T_TYPE, "view: keyword \"type\" expected");
103 switch (lex()) {
104 case T_PARALLEL:
105 vp->type = PARALLEL;
106 break;
107 case T_PERSPECTIVE:
108 vp->type = PERSPECTIVE;
109 break;
110 default:
111 lexerr("start", "view_type: keyword \"parallel|perspective\" expected");
112 break;
113 }
114
115 /* Lecture du centre de projection (oeil) de la prise de vue. */
116
117 skip_keyword(T_COP, "view: keyword \"cop\" expected");
118 pusherr("view_cop: ");
119 fscanf_Point3f(&vp->cop);
120 poperr();
121
122 /* Lecture du point de reference (cible) a la prise de vue. */
123
124 skip_keyword(T_VRP, "view: keyword \"vrp\" expected");
125 pusherr("view_vrp: ");
126 fscanf_Point3f(&vp->vrp);
127 poperr();
128
129 /* Lecture de la direction normale au plan de projection. */
130
131 skip_keyword(T_VPN, "view: keyword \"vpn\" expected");
132 pusherr("view_vpn: ");
133 fscanf_Vector(&vp->vpn);
134 poperr();
135
136 /* Lecture de la direction indiquant le haut de la projection. */
137
138 skip_keyword(T_VUP, "view: keyword \"vup\" expected");
139 pusherr("view_vup: ");
140 fscanf_Vector(&vp->vup);
141 poperr();
142
143 /* Lecture de la fenetre de projection de la prise de vue. */
144
145 skip_keyword(T_WINDOW, "view: keyword \"window\" expected");
146 pusherr("view_window_umin: ");
147 fscanf_float(&vp->vwd.umin);
148 popuperr("view_window_umax: ");
149 fscanf_float(&vp->vwd.umax);
150 popuperr("view_window_vmin: ");
151 fscanf_float(&vp->vwd.vmin);
152 popuperr("view_window_vmax: ");
153 fscanf_float(&vp->vwd.vmax);
154 poperr();
155
156 /* Lecture des profondeurs de decoupage avant et arriere. */
157
158 skip_keyword(T_DEPTH, "view: keyword \"depth\" expected");
159 pusherr("view_depth_front: ");
160 fscanf_float(&vp->depth.front);
161 popuperr("view_depth_back: ");
162 fscanf_float(&vp->depth.back);
163 poperr();
164}
165END_VISP_NAMESPACE
166#endif