cartesian2d-test.c
Go to the documentation of this file.
1 // Copyright (c) 2010-2016 The YP-Spur Authors, except where otherwise indicated.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #include <math.h>
22 #include <stdio.h>
23 
24 #include <cartesian2d.h>
25 
27 
28 int main(int argc, char *argv[])
29 {
30  double x, y, theta;
31 
32  BS = CS_add(0, 0, 0, 0);
33  GL = CS_add(BS, 1, 1, 0);
34  LC = CS_add(GL, 1, 1, 0);
35  LC2 = CS_add(GL, 2, 2, 0);
36  LC3 = CS_add(BS, -3, -3, 0);
37  LC4 = CS_add(LC3, -3, -3, 0);
38 
39  x = 2;
40  y = 2;
41  theta = 2;
42  CS_recursive_trans(GL, BS, &x, &y, &theta);
43  printf("%f %f %f\n", x, y, theta);
44 
45  x = 2;
46  y = 2;
47  theta = 2;
48  CS_recursive_trans(LC, GL, &x, &y, &theta);
49  printf("%f %f %f\n", x, y, theta);
50 
51  x = 2;
52  y = 2;
53  theta = 2;
54  CS_recursive_trans(LC2, GL, &x, &y, &theta);
55  printf("%f %f %f\n", x, y, theta);
56 
57  x = 2;
58  y = 2;
59  theta = 2;
60  CS_recursive_trans(LC4, LC, &x, &y, &theta);
61  printf("%f %f %f\n", x, y, theta);
62 
63  return 0;
64 }
CSptr LC4
CSptr CS_add(CSptr parent_cs, double x, double y, double theta)
Definition: libcarte2d.c:31
void CS_recursive_trans(CSptr target_cs, CSptr now_cs, double *x, double *y, double *theta)
Definition: libcarte2d.c:137
CSptr GL
CSptr LC2
CSptr LC
CSptr LC3
CSptr BS
int main(int argc, char *argv[])


yp-spur
Author(s):
autogenerated on Sat May 11 2019 02:08:24