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