Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpTmstack.cpp
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4
*
5
* This software is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
* See the file LICENSE.txt at the root directory of this source
10
* distribution for additional information about the GNU GPL.
11
*
12
* For using ViSP with software that can not be combined with the GNU
13
* GPL, please contact Inria about acquiring a ViSP Professional
14
* Edition License.
15
*
16
* See https://visp.inria.fr for more information.
17
*
18
* This software was developed at:
19
* Inria Rennes - Bretagne Atlantique
20
* Campus Universitaire de Beaulieu
21
* 35042 Rennes Cedex
22
* France
23
*
24
* If you have questions regarding the use of this file, please contact
25
* Inria at visp@inria.fr
26
*
27
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
*
30
* Description:
31
* Le module "tmstack.c" contient les procedures de gestion
32
* de la pile de matrices de transformation (Transformation
33
* Matrix STACK).
34
*
35
* Authors:
36
* Jean-Luc CORRE
37
*/
38
39
#include "vpTmstack.h"
40
#include "vpArit.h"
41
#include "vpMy.h"
42
#include <math.h>
43
#include <stdio.h>
44
#include <string.h>
45
#include <visp3/core/vpConfig.h>
46
47
#ifndef DOXYGEN_SHOULD_SKIP_THIS
48
49
#define STACKSIZE 32
50
51
BEGIN_VISP_NAMESPACE
52
static
Matrix stack[STACKSIZE]
/* = IDENTITY_MATRIX*/
;
/* pile */
53
static
Matrix *sp = stack;
/* sommet */
54
55
/*
56
* La procedure "get_tmstack" retourne la matrice au sommet
57
* de la pile des matrices de transformation.
58
* Sortie :
59
* Pointeur de la matrice au sommet de la pile.
60
*/
61
Matrix *get_tmstack(
void
) {
return
(sp); }
62
63
/*
64
* La procedure "load_tmstack" charge une matrice au sommet
65
* de la pile des matrices de transformation.
66
* Entree :
67
* m Matrice a charger.
68
*/
69
void
load_tmstack(Matrix m)
70
{
71
// bcopy ((char *) m, (char *) *sp, sizeof (Matrix));
72
memmove((
char
*)*sp, (
char
*)m,
sizeof
(Matrix));
73
}
74
75
/*
76
* La procedure "pop_tmstack" depile la matrice au sommet
77
* de la pile des matrices de transformation.
78
*/
79
void
pop_tmstack(
void
)
80
{
81
if
(sp == stack) {
82
static
char
proc_name[] =
"pop_tmstack"
;
83
fprintf(stderr,
"%s: stack underflow\n"
, proc_name);
84
return
;
85
}
86
else
87
sp--;
88
}
89
90
/*
91
* La procedure "push_tmstack" empile et duplique le sommet
92
* de la pile des matrices de transformation.
93
*/
94
void
push_tmstack(
void
)
95
{
96
if
(sp == stack + STACKSIZE - 1) {
97
static
char
proc_name[] =
"push_tmstack"
;
98
fprintf(stderr,
"%s: stack overflow\n"
, proc_name);
99
return
;
100
}
101
sp++;
102
// bcopy ((char *) (sp - 1), (char *) sp, sizeof (Matrix));
103
memmove((
char
*)sp, (
char
*)(sp - 1),
sizeof
(Matrix));
104
}
105
106
/*
107
* La procedure "swap_tmstack" echange les deux premieres matrices
108
* de la pile des matrices de transformation.
109
*/
110
void
swap_tmstack(
void
)
111
{
112
Matrix *mp, tmp;
113
114
mp = (sp == stack) ? sp + 1 : sp - 1;
115
// bcopy ((char *) *sp, (char *) tmp, sizeof (Matrix));
116
// bcopy ((char *) *mp, (char *) *sp, sizeof (Matrix));
117
// bcopy ((char *) tmp, (char *) *mp, sizeof (Matrix));
118
memmove((
char
*)tmp, (
char
*)*sp,
sizeof
(Matrix));
119
memmove((
char
*)*sp, (
char
*)*mp,
sizeof
(Matrix));
120
memmove((
char
*)*mp, (
char
*)tmp,
sizeof
(Matrix));
121
}
122
123
/*
124
* La procedure "postmult_tmstack" postmultiplie la matrice au sommet
125
* de la pile des matrices de transformation.
126
* Entree :
127
* m Matrice multiplicative.
128
*/
129
void
postmult_tmstack(Matrix m) { postmult_matrix(*sp, m); }
130
131
/*
132
* La procedure "postrotate_tmstack" postmultiplie la matrice au sommet
133
* de la pile des matrices de transformation par une rotation.
134
* Entree :
135
* vp Vecteur de rotation.
136
*/
137
void
postrotate_tmstack(Vector *vp)
138
{
139
Matrix m;
140
141
Rotate_to_Matrix(vp, m);
142
postmult3_matrix(*sp, m);
143
}
144
145
/*
146
* La procedure "postscale_tmstack" postmultiplie la matrice au sommet
147
* de la pile des matrices de transformation par une homothetie.
148
* Entree :
149
* vp Vecteur d'homothetie.
150
*/
151
void
postscale_tmstack(Vector *vp) { postscale_matrix(*sp, vp); }
152
153
/*
154
* La procedure "posttranslate_tmstack" postmultiplie la matrice au sommet
155
* de la pile des matrices de transformation par une translation.
156
* Entree :
157
* vp Vecteur de translation.
158
*/
159
void
posttranslate_tmstack(Vector *vp) { posttrans_matrix(*sp, vp); }
160
161
/*
162
* La procedure "premult_tmstack" premultiplie la matrice au sommet
163
* de la pile des matrices de transformation.
164
* Entree :
165
* m Matrice multiplicative.
166
*/
167
void
premult_tmstack(Matrix m) { premult_matrix(*sp, m); }
168
169
/*
170
* La procedure "prerotate_tmstack" premultiplie la matrice au sommet
171
* de la pile des matrices de transformation par une rotation.
172
* Entree :
173
* vp Vecteur de rotation.
174
*/
175
void
prerotate_tmstack(Vector *vp)
176
{
177
Matrix m;
178
179
Rotate_to_Matrix(vp, m);
180
premult3_matrix(*sp, m);
181
}
182
183
/*
184
* La procedure "prescale_tmstack" premultiplie la matrice au sommet
185
* de la pile des matrices de transformation par une homothetie.
186
* Entree :
187
* vp Vecteur d'homothetie.
188
*/
189
void
prescale_tmstack(Vector *vp) { prescale_matrix(*sp, vp); }
190
191
/*
192
* La procedure "pretranslate_tmstack" premultiplie la matrice au sommet
193
* de la pile des matrices de transformation par une translation.
194
* Entree :
195
* vp Vecteur de translation.
196
*/
197
void
pretranslate_tmstack(Vector *vp) { pretrans_matrix(*sp, vp); }
198
END_VISP_NAMESPACE
199
#endif
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
robot
src
wireframe-simulator
vpTmstack.cpp
Generated by
1.17.0