Visual Servoing Platform  version 3.6.1 under development (2024-04-20)
vpView.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See https://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Le module "view.h" contient les Macros et les types
33  * des parametres de visualisation et de transformation 3D.
34  *
35  * Authors:
36  * Jean-Luc CORRE
37  *
38 *****************************************************************************/
39 
40 #ifndef vpView_H
41 #define vpView_H
42 
43 #include <visp3/core/vpConfig.h>
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 
47 #include "vpArit.h"
48 #include "vpMy.h"
49 
50 /*
51  * Macros de numerotation des 6 plans de decoupage :
52  * - Les 6 plans de clipping definissent le volume canonique
53  * de la pyramide de vision dans lequel la scene est visible.
54  * - les 6 plans ont pour equations :
55  * Plan dessus : W = Y
56  * Plan dessous : -W = Y
57  * Plan droit : W = X
58  * Plan gauche : -W = X
59  * Plan arriere : W = Z
60  * Plan avant : W = 0
61  */
62 #define PLANE_ABOVE 0
63 #define PLANE_BELOW 1
64 #define PLANE_RIGHT 2
65 #define PLANE_LEFT 3
66 #define PLANE_BACK 4
67 #define PLANE_FRONT 5
68 #define PLANE_NBR 6
69 
70 /*
71  * Macros de positionnement des points 4D :
72  * Le positionnement d'un point 4D dans l'espace de l'observateur virtuel
73  * se fait par rapport aux 6 plans de decoupage.
74  * A chaque point 4D on associe 6 bits, un par plan de decoupage.
75  */
76 #define IS_INSIDE 0x00
77 #define IS_ABOVE 0x01
78 #define IS_BELOW 0x02
79 #define IS_RIGHT 0x04
80 #define IS_LEFT 0x08
81 #define IS_BACK 0x10
82 #define IS_FRONT 0x20
83 
84 #define vpDEFAULT_REMOVE IS_INSIDE
85 
86 #define PARALLEL 0
87 #define PERSPECTIVE 1
88 
89 #define vpDEFAULT_EYE \
90  { \
91  0.0, 0.0, 1.0 \
92  }
93 #define vpDEFAULT_TARGET \
94  { \
95  0.0, 0.0, 0.0 \
96  }
97 #define vpDEFAULT_FOCAL 1.0
98 #define vpDEFAULT_ANGLE 45.0
99 #define vpDEFAULT_TWIST 0.0
100 #define vpDEFAULT_SPEED 0.0
101 #define vpDEFAULT_CAMERA \
102  { \
103  vpDEFAULT_EYE, vpDEFAULT_TARGET, vpDEFAULT_FOCAL, vpDEFAULT_ANGLE, vpDEFAULT_TWIST, vpDEFAULT_SPEED \
104  }
105 
106 #define vpDEFAULT_COP \
107  { \
108  0.0, 0.0, 1.0 \
109  }
110 #define vpDEFAULT_VRP \
111  { \
112  0.0, 0.0, 0.0 \
113  }
114 #define vpDEFAULT_VPN \
115  { \
116  0.0, 0.0, -1.0 \
117  }
118 #define vpDEFAULT_VUP \
119  { \
120  0.0, 1.0, 0.0 \
121  }
122 #define vpDEFAULT_VWD \
123  { \
124  -1.0, 1.0, -1.0, 1.0 \
125  }
126 #define vpDEFAULT_DEPTH \
127  { \
128  0.0, 1.0 \
129  }
130 #define vpDEFAULT_TYPE PERSPECTIVE
131 
132 #define vpDEFAULT_VIEW \
133  { \
134  vpDEFAULT_TYPE, vpDEFAULT_COP, vpDEFAULT_VRP, vpDEFAULT_VPN, vpDEFAULT_VUP, vpDEFAULT_VWD, vpDEFAULT_DEPTH \
135  }
136 
137 #define vpDEFAULT_WC \
138  { \
139  1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 \
140  }
141 
142 /*
143  * CAMERA PARAMETERS
144  * _________________
145  *
146  * La structure "Camera_parameters" definit les parametres de la camera.
147  * eye Position de l'oeil ou de la camera.
148  * target Position de la cible ou du point visee dans la scene.
149  * focal Distance eye-target
150  * angle Angle d'ouverture en degres.
151  * twist Angle de rotation sur l'axe de visee (eye,target) en degres.
152  * speed Vitesse sur l'axe de visee (eye,target).
153  */
154 typedef struct {
155  Point3f eye; /* position de l'observateur */
156  Point3f target; /* point vise */
157  float focal; /* focale de la camera */
158  float angle; /* angle d'ouverture */
159  float twist; /* rotation sur l'axe de visee */
160  float speed; /* vitesse sur l'axe de visee */
161 } Camera_parameters;
162 
163 typedef struct {
164  float umin, umax; /* bords gauche et droit */
165  float vmin, vmax; /* bords inferieur et superieur */
166 } View_window;
167 
168 typedef struct {
169  float front; /* plan avant ("hither") */
170  float back; /* plan arriere ("yon") */
171 } View_depth;
172 
173 typedef struct {
174  Type type; /* type de la projection */
175  Point3f cop; /* centre de projection */
176  Point3f vrp; /* point de reference de visee */
177  Vector vpn; /* vecteur nomal au plan */
178  Vector vup; /* vecteur indiquant le "haut" */
179  View_window vwd; /* fenetre de projection */
180  View_depth depth; /* profondeurs de decoupages */
181 } View_parameters;
182 
183 #endif
184 #endif