repo.or.cz
/
xcsoar.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Android release v6.7_preview1
[xcsoar.git]
/
tools
/
convplane.pl
blob
780b4b331fa5056d15e800a9313167367085bc93
1
#!/usr/bin/perl
2
3
print
"plane
\n
"
;
4
drawme
(
"Data/other/plane.txt"
);
5
print
"canopy
\n
"
;
6
drawme
(
"Data/other/canopy.txt"
);
7
8
sub
drawme
{
9
my
(
$file
) =
@_
;
10
open
(
INFILE
,
"<
$file
"
);
11
my
$i
=
0
;
12
while
(<
INFILE
>) {
13
if
(
/(\S+)\s(\S+)/
) {
14
$x
[
$i
] =
$1
;
15
$y
[
$i
] =
$2
;
16
$i
=
$i
+
1
;
17
}
18
}
19
close
INFILE
;
20
for
(
$j
=
0
;
$j
<
$i
;
$j
++) {
21
$xx
=
$x
[
$j
]-
32
;
22
$yy
=
$y
[
$j
]-
10
;
23
print
"{
$xx
,
$yy
},
\n
"
;
24
}
25
for
(
$j
=
$i
-
1
;
$j
>=
0
;
$j
--) {
26
$xx
=
32
-
$x
[
$j
];
27
$yy
=
$y
[
$j
]-
10
;
28
print
"{
$xx
,
$yy
},
\n
"
;
29
}
30
}
31
32