Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
vpWireFrameSimulatorTypes.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  * Wire frame simulator
33  *
34 *****************************************************************************/
35 
36 #ifndef vpWireFrameSimulatorTypes_h
37 #define vpWireFrameSimulatorTypes_h
38 
39 #include <visp3/core/vpConfig.h>
40 
41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef unsigned short Index;
44 typedef char Type;
45 typedef float Matrix[4][4];
46 
47 /*
48  * MATRIX
49  * ______
50  *
51  * Matrice homogene ou non.
52  * | Rotation | 0 |
53  * Matrice non homogene = | 3x3 | 0 |
54  * |-------------| 0 |
55  * | Translation | 1 |
56  */
57 typedef float Matrix[4][4];
58 
59 #define DEFAULT_VSIZE 4
60 
61 /*
62  * Vertex_list :
63  * Pour optimiser l'allocation et la liberation memoire d'une liste de
64  * sommets: si (nbr > DEFAULT_VSIZE) | alors ptr est alloue et libere
65  * dynamiquement | sinon ptr = tbl fsi;
66  */
67 typedef struct
68 {
69  Index nbr; /* nombre de sommets */
70  Index *ptr; /* liste dynamique */
71  Index tbl[DEFAULT_VSIZE];
72 } Vertex_list;
73 
74 typedef struct
75 {
76  unsigned is_polygonal : 1; /* face polygonale */
77  unsigned is_visible : 1; /* face affichable */
78 #ifdef face_edge
79  Edge_list edge; /* liste d'aretes */
80 #endif // face_edge
81  Vertex_list vertex; /* liste de sommets */
82 #ifdef face_normal
83  Vector normal; /* vecteur normal */
84 #endif // face_normal
85 } Face;
86 
87 typedef struct
88 {
89  Index nbr; /* nombre de faces */
90  Face *ptr; /* liste dynamique */
91 } Face_list;
92 
93 typedef struct
94 {
95  float x, y, z;
96 } Point3f;
97 
98 typedef struct
99 {
100  Index nbr; /* nombre de points */
101  Point3f *ptr; /* liste dynamique */
102 } Point3f_list;
103 
104 typedef struct
105 {
106  unsigned is_display : 1; /* surface affichable */
107  unsigned is_polygonal : 1; /* surface polyedrique */
108  Type type; /* type de la primitive */
109 #ifdef face_edge
110  Edge_list edge; /* liste d'aretes */
111 #endif // face_edge
112  Face_list face; /* liste de faces */
113  Point3f_list point; /* points aux sommets */
114 #ifdef face_normal
115  Vector_list normal; /* normales aux sommets */
116 #endif // face_normal
117 } Bound;
118 
119 typedef struct
120 {
121  Index nbr; /* nombre de surfaces */
122  Bound *ptr; /* liste dynamique */
123 } Bound_list;
124 
125 typedef struct
126 {
127  char *name; /* nom de la scene */
128  Bound_list bound; /* liste de surfaces */
129 } Bound_scene;
130 END_VISP_NAMESPACE
131 #endif
132 #endif