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