Visual Servoing Platform  version 3.0.0
vpBound.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 fichier "bound.h" contient les macros et le types
32  * utilises par le modele geometrique surfacique polygonale 3D.
33  *
34  * Authors:
35  * Jean-Luc CORRE
36  *
37  *****************************************************************************/
38 
39 #ifndef vpBound_H
40 #define vpBound_H
41 
42 #include <visp3/core/vpConfig.h>
43 #include <visp3/robot/vpMy.h>
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 
47 
48 #define START_ARG 0
49 #define NEXT_ARG 1
50 
51 #define BND_NULL (-1)
52 
53 #define BND_BLOCK 0
54 #define BND_CARDIOIDE 1
55 #define BND_CONE 2
56 #define BND_CYLINDER 3
57 #define BND_SPHERE 4
58 #define BND_TORUS 5
59 #define BND_WEDGE 6
60 
61 #define BND_F3 7
62 #define BND_F4 8
63 
64 #define BND_GRID 9
65 #define BND_PIPE 10
66 #define BND_SECTION 11
67 
68 #define BND_NBR 12
69 
70 
71 #define BOUND_NBR 1024
72 #define FACE_NBR 6144 /* Tailles de tableaux */
73 #define VERTEX_NBR 16
74 #define POINT_NBR 6144
75 #ifdef face_normal
76 #define VECTOR_NBR 6144
77 #endif //face_normal
78 
79 #ifdef face_edge
80 typedef struct {
81  Index v0, v1; /* extremites */
82  Index f0, f1; /* faces */
83 } Edge;
84 #endif //face_edge
85 
86 #ifdef face_edge
87 typedef struct {
88  Index nbr; /* nombre d'aretes */
89  Edge *ptr; /* liste dynamique */
90 } Edge_list;
91 #endif //face_edge
92 
93 #define DEFAULT_VSIZE 4
94 
95 /*
96  * Vertex_list :
97  * Pour optimiser l'allocation et la liberation memoire d'une liste de sommets:
98  * si (nbr > DEFAULT_VSIZE)
99  * | alors ptr est alloue et libere dynamiquement
100  * | sinon ptr = tbl
101  * fsi;
102  */
103 typedef struct {
104  Index nbr; /* nombre de sommets */
105  Index *ptr; /* liste dynamique */
106  Index tbl[DEFAULT_VSIZE];
107 } Vertex_list;
108 
109 typedef struct {
110  Index nbr; /* nombre de points */
111  Point3f *ptr; /* liste dynamique */
112 } Point3f_list;
113 
114 #ifdef face_normal
115 typedef struct {
116  Index nbr; /* nombre de vecteurs */
117  Vector *ptr; /* liste dynamique */
118 } Vector_list;
119 #endif //face_normal
120 
121 typedef struct {
122  unsigned is_polygonal:1; /* face polygonale */
123  unsigned is_visible :1; /* face affichable */
124 #ifdef face_edge
125  Edge_list edge; /* liste d'aretes */
126 #endif //face_edge
127  Vertex_list vertex; /* liste de sommets */
128 #ifdef face_normal
129  Vector normal; /* vecteur normal */
130 #endif //face_normal
131 } Face;
132 
133 typedef struct {
134  Index nbr; /* nombre de faces */
135  Face *ptr; /* liste dynamique */
136 } Face_list;
137 
138 typedef struct {
139  unsigned is_display :1; /* surface affichable */
140  unsigned is_polygonal:1; /* surface polyedrique */
141  Type type; /* type de la primitive */
142 #ifdef face_edge
143  Edge_list edge; /* liste d'aretes */
144 #endif //face_edge
145  Face_list face; /* liste de faces */
146  Point3f_list point; /* points aux sommets */
147 #ifdef face_normal
148  Vector_list normal; /* normales aux sommets */
149 #endif //face_normal
150 } Bound;
151 
152 typedef struct {
153  Index nbr; /* nombre de surfaces */
154  Bound *ptr; /* liste dynamique */
155 } Bound_list;
156 
157 typedef struct {
158  float xmin, xmax; /* bornes sur l'axe x */
159  float ymin, ymax; /* bornes sur l'axe y */
160  float zmin, zmax; /* bornes sur l'axe z */
161 } Bounding_box;
162 
163 typedef struct {
164  char *name; /* nom de la scene */
165  Bound_list bound; /* liste de surfaces */
166 } Bound_scene;
167 
168 typedef struct {
169  Index nbr; /* nombre de scenes */
170  Bound_scene *ptr; /* liste dynamique */
171 } Bound_scene_list;
172 
173 extern void malloc_huge_Bound (Bound *bp);
174 extern void free_huge_Bound (Bound *bp);
175 extern void fscanf_Bound (Bound *bp);
176 
177 #endif
178 #endif