ViSP
 All Classes Functions Variables Enumerations Enumerator Friends Groups Pages
vpBound.h
1 /****************************************************************************
2  *
3  * $Id: vpBound.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Le fichier "bound.h" contient les macros et le types
36  * utilises par le modele geometrique surfacique polygonale 3D.
37  *
38  * Authors:
39  * Jean-Luc CORRE
40  *
41  *****************************************************************************/
42 
43 #ifndef vpBound_H
44 #define vpBound_H
45 
46 #include <visp/vpConfig.h>
47 
48 #ifndef DOXYGEN_SHOULD_SKIP_THIS
49 
50 #define START_ARG 0
51 #define NEXT_ARG 1
52 
53 #define BND_NULL (-1)
54 
55 #define BND_BLOCK 0
56 #define BND_CARDIOIDE 1
57 #define BND_CONE 2
58 #define BND_CYLINDER 3
59 #define BND_SPHERE 4
60 #define BND_TORUS 5
61 #define BND_WEDGE 6
62 
63 #define BND_F3 7
64 #define BND_F4 8
65 
66 #define BND_GRID 9
67 #define BND_PIPE 10
68 #define BND_SECTION 11
69 
70 #define BND_NBR 12
71 
72 
73 #define BOUND_NBR 1024
74 #define FACE_NBR 6144 /* Tailles de tableaux */
75 #define VERTEX_NBR 16
76 #define POINT_NBR 6144
77 #ifdef face_normal
78 #define VECTOR_NBR 6144
79 #endif //face_normal
80 
81 #ifdef face_edge
82 typedef struct {
83  Index v0, v1; /* extremites */
84  Index f0, f1; /* faces */
85 } Edge;
86 #endif //face_edge
87 
88 #ifdef face_edge
89 typedef struct {
90  Index nbr; /* nombre d'aretes */
91  Edge *ptr; /* liste dynamique */
92 } Edge_list;
93 #endif //face_edge
94 
95 #define DEFAULT_VSIZE 4
96 
97 /*
98  * Vertex_list :
99  * Pour optimiser l'allocation et la liberation memoire d'une liste de sommets:
100  * si (nbr > DEFAULT_VSIZE)
101  * | alors ptr est alloue et libere dynamiquement
102  * | sinon ptr = tbl
103  * fsi;
104  */
105 typedef struct {
106  Index nbr; /* nombre de sommets */
107  Index *ptr; /* liste dynamique */
108  Index tbl[DEFAULT_VSIZE];
109 } Vertex_list;
110 
111 typedef struct {
112  Index nbr; /* nombre de points */
113  Point3f *ptr; /* liste dynamique */
114 } Point3f_list;
115 
116 #ifdef face_normal
117 typedef struct {
118  Index nbr; /* nombre de vecteurs */
119  Vector *ptr; /* liste dynamique */
120 } Vector_list;
121 #endif //face_normal
122 
123 typedef struct {
124  unsigned is_polygonal:1; /* face polygonale */
125  unsigned is_visible :1; /* face affichable */
126 #ifdef face_edge
127  Edge_list edge; /* liste d'aretes */
128 #endif //face_edge
129  Vertex_list vertex; /* liste de sommets */
130 #ifdef face_normal
131  Vector normal; /* vecteur normal */
132 #endif //face_normal
133 } Face;
134 
135 typedef struct {
136  Index nbr; /* nombre de faces */
137  Face *ptr; /* liste dynamique */
138 } Face_list;
139 
140 typedef struct {
141  unsigned is_display :1; /* surface affichable */
142  unsigned is_polygonal:1; /* surface polyedrique */
143  Type type; /* type de la primitive */
144 #ifdef face_edge
145  Edge_list edge; /* liste d'aretes */
146 #endif //face_edge
147  Face_list face; /* liste de faces */
148  Point3f_list point; /* points aux sommets */
149 #ifdef face_normal
150  Vector_list normal; /* normales aux sommets */
151 #endif //face_normal
152 } Bound;
153 
154 typedef struct {
155  Index nbr; /* nombre de surfaces */
156  Bound *ptr; /* liste dynamique */
157 } Bound_list;
158 
159 typedef struct {
160  float xmin, xmax; /* bornes sur l'axe x */
161  float ymin, ymax; /* bornes sur l'axe y */
162  float zmin, zmax; /* bornes sur l'axe z */
163 } Bounding_box;
164 
165 typedef struct {
166  char *name; /* nom de la scene */
167  Bound_list bound; /* liste de surfaces */
168 } Bound_scene;
169 
170 typedef struct {
171  Index nbr; /* nombre de scenes */
172  Bound_scene *ptr; /* liste dynamique */
173 } Bound_scene_list;
174 
175 extern void malloc_huge_Bound (Bound *bp);
176 extern void free_huge_Bound (Bound *bp);
177 extern void fscanf_Bound (Bound *bp);
178 
179 #endif
180 #endif