Visual Servoing Platform  version 3.6.1 under development (2024-04-19)
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
42 
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  Index nbr; /* nombre de sommets */
69  Index *ptr; /* liste dynamique */
70  Index tbl[DEFAULT_VSIZE];
71 } Vertex_list;
72 
73 typedef struct {
74  unsigned is_polygonal : 1; /* face polygonale */
75  unsigned is_visible : 1; /* face affichable */
76 #ifdef face_edge
77  Edge_list edge; /* liste d'aretes */
78 #endif // face_edge
79  Vertex_list vertex; /* liste de sommets */
80 #ifdef face_normal
81  Vector normal; /* vecteur normal */
82 #endif // face_normal
83 } Face;
84 
85 typedef struct {
86  Index nbr; /* nombre de faces */
87  Face *ptr; /* liste dynamique */
88 } Face_list;
89 
90 typedef struct {
91  float x, y, z;
92 } Point3f;
93 
94 typedef struct {
95  Index nbr; /* nombre de points */
96  Point3f *ptr; /* liste dynamique */
97 } Point3f_list;
98 
99 typedef struct {
100  unsigned is_display : 1; /* surface affichable */
101  unsigned is_polygonal : 1; /* surface polyedrique */
102  Type type; /* type de la primitive */
103 #ifdef face_edge
104  Edge_list edge; /* liste d'aretes */
105 #endif // face_edge
106  Face_list face; /* liste de faces */
107  Point3f_list point; /* points aux sommets */
108 #ifdef face_normal
109  Vector_list normal; /* normales aux sommets */
110 #endif // face_normal
111 } Bound;
112 
113 typedef struct {
114  Index nbr; /* nombre de surfaces */
115  Bound *ptr; /* liste dynamique */
116 } Bound_list;
117 
118 typedef struct {
119  char *name; /* nom de la scene */
120  Bound_list bound; /* liste de surfaces */
121 } Bound_scene;
122 
123 #endif
124 #endif