Visual Servoing Platform  version 3.0.0
vpView.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
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 http://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 "view.h" contient les Macros et les types
32  * des parametres de visualisation et de transformation 3D.
33  *
34  * Authors:
35  * Jean-Luc CORRE
36  *
37  *****************************************************************************/
38 
39 #ifndef vpView_H
40 #define vpView_H
41 
42 #include <visp3/core/vpConfig.h>
43 
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45 
46 /*
47  * Macros de numerotation des 6 plans de decoupage :
48  * - Les 6 plans de clipping definissent le volume canonique
49  * de la pyramide de vision dans lequel la scene est visible.
50  * - les 6 plans ont pour equations :
51  * Plan dessus : W = Y
52  * Plan dessous : -W = Y
53  * Plan droit : W = X
54  * Plan gauche : -W = X
55  * Plan arriere : W = Z
56  * Plan avant : W = 0
57  */
58 #define PLANE_ABOVE 0
59 #define PLANE_BELOW 1
60 #define PLANE_RIGHT 2
61 #define PLANE_LEFT 3
62 #define PLANE_BACK 4
63 #define PLANE_FRONT 5
64 #define PLANE_NBR 6
65 
66 /*
67  * Macros de positionnement des points 4D :
68  * Le positionnement d'un point 4D dans l'espace de l'observateur virtuel
69  * se fait par rapport aux 6 plans de decoupage.
70  * A chaque point 4D on associe 6 bits, un par plan de decoupage.
71  */
72 #define IS_INSIDE 0x00
73 #define IS_ABOVE 0x01
74 #define IS_BELOW 0x02
75 #define IS_RIGHT 0x04
76 #define IS_LEFT 0x08
77 #define IS_BACK 0x10
78 #define IS_FRONT 0x20
79 
80 #define vpDEFAULT_REMOVE IS_INSIDE
81 
82 #define PARALLEL 0
83 #define PERSPECTIVE 1
84 
85 #define vpDEFAULT_EYE { 0.0, 0.0, 1.0 }
86 #define vpDEFAULT_TARGET { 0.0, 0.0, 0.0 }
87 #define vpDEFAULT_FOCAL 1.0
88 #define vpDEFAULT_ANGLE 45.0
89 #define vpDEFAULT_TWIST 0.0
90 #define vpDEFAULT_SPEED 0.0
91 #define vpDEFAULT_CAMERA { vpDEFAULT_EYE, vpDEFAULT_TARGET,\
92  vpDEFAULT_FOCAL,vpDEFAULT_ANGLE, vpDEFAULT_TWIST,\
93  vpDEFAULT_SPEED }
94 
95 #define vpDEFAULT_COP { 0.0, 0.0, 1.0 }
96 #define vpDEFAULT_VRP { 0.0, 0.0, 0.0 }
97 #define vpDEFAULT_VPN { 0.0, 0.0,-1.0 }
98 #define vpDEFAULT_VUP { 0.0, 1.0, 0.0 }
99 #define vpDEFAULT_VWD {-1.0, 1.0,-1.0, 1.0 }
100 #define vpDEFAULT_DEPTH { 0.0, 1.0 }
101 #define vpDEFAULT_TYPE PERSPECTIVE
102 
103 #define vpDEFAULT_VIEW { vpDEFAULT_TYPE,\
104  vpDEFAULT_COP, vpDEFAULT_VRP,\
105  vpDEFAULT_VPN, vpDEFAULT_VUP,\
106  vpDEFAULT_VWD, vpDEFAULT_DEPTH }
107 
108 #define vpDEFAULT_WC { 1.0, 0.0, 0.0, 0.0,\
109  0.0, 1.0, 0.0, 0.0,\
110  0.0, 0.0, 1.0, 0.0,\
111  0.0, 0.0, 0.0, 1.0 }
112 
113 
114 /*
115  * CAMERA PARAMETERS
116  * _________________
117  *
118  * La structure "Camera_parameters" definit les parametres de la camera.
119  * eye Position de l'oeil ou de la camera.
120  * target Position de la cible ou du point visee dans la scene.
121  * focal Distance eye-target
122  * angle Angle d'ouverture en degres.
123  * twist Angle de rotation sur l'axe de visee (eye,target) en degres.
124  * speed Vitesse sur l'axe de visee (eye,target).
125  */
126 typedef struct {
127  Point3f eye; /* position de l'observateur */
128  Point3f target; /* point vise */
129  float focal; /* focale de la camera */
130  float angle; /* angle d'ouverture */
131  float twist; /* rotation sur l'axe de visee */
132  float speed; /* vitesse sur l'axe de visee */
133 } Camera_parameters;
134 
135 typedef struct {
136  float umin,umax; /* bords gauche et droit */
137  float vmin,vmax; /* bords inferieur et superieur */
138 } View_window;
139 
140 typedef struct {
141  float front; /* plan avant ("hither") */
142  float back; /* plan arriere ("yon") */
143 } View_depth;
144 
145 typedef struct {
146  Type type; /* type de la projection */
147  Point3f cop; /* centre de projection */
148  Point3f vrp; /* point de reference de visee */
149  Vector vpn; /* vecteur nomal au plan */
150  Vector vup; /* vecteur indiquant le "haut" */
151  View_window vwd; /* fenetre de projection */
152  View_depth depth; /* profondeurs de decoupages */
153 } View_parameters;
154 
155 #endif
156 #endif
157