summaryrefslogtreecommitdiffstats
path: root/fiz/naloga/transformirane/pari.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-06-01 03:24:04 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-06-01 03:24:04 +0200
commit324e498c63145c6612ba8142ddd4e59670108582 (patch)
tree6e6fda75695bae205bf790d73f9f1cfa47846907 /fiz/naloga/transformirane/pari.php
parentmeritev (diff)
downloadsola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.tar
sola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.tar.gz
sola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.tar.bz2
sola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.tar.lz
sola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.tar.xz
sola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.tar.zst
sola-gimb-3-324e498c63145c6612ba8142ddd4e59670108582.zip
Diffstat (limited to 'fiz/naloga/transformirane/pari.php')
-rwxr-xr-xfiz/naloga/transformirane/pari.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/fiz/naloga/transformirane/pari.php b/fiz/naloga/transformirane/pari.php
new file mode 100755
index 0000000..57e9542
--- /dev/null
+++ b/fiz/naloga/transformirane/pari.php
@@ -0,0 +1,46 @@
+#!/usr/bin/env php
+<?php
+$meritev = $argv[1];
+$positions_unpa = explode("\n", file_get_contents($meritev.".tsv"));
+$fields_unpa = explode("\n", file_get_contents("../meritve-polje/".$meritev.".tsv"));
+$positions = [];
+foreach ($positions_unpa as $position) {
+ if ($position == "")
+ continue;
+ $posdata = explode("\t", $position);
+ $positions[$posdata[1]] = ["frame" => $posdata[0], "x" => $posdata[2], "y" => $posdata[3]];
+}
+$fields = [];
+$iter = 0;
+foreach ($fields_unpa as $field) {
+ if ($field == "")
+ continue;
+ $fiedata = explode("\t", $field);
+ if (!$iter++)
+ $starting_time = $fiedata[0];
+ $fields[intval($fiedata[0]) - intval($starting_time)] = ["x" => $fiedata[2], "y" => $fiedata[3], "z" => $fiedata[4], "izpusti" => str_contains($field, "izpusti") ? true : false];
+}
+foreach ($positions as $position_time => $position) {
+ $closest = [];
+ foreach ($fields as $field_time => $field) {
+ $closest[$field_time] = abs($position_time - $field_time);
+ }
+ asort($closest);
+ if (isset($fields[key($closest)]["taken"]))
+ continue;
+ $fields[key($closest)]["taken"] = true;
+ if ($fields[key($closest)]["izpusti"])
+ continue;
+ echo key($closest)/1000 ."\t"
+ .$position["x"]."\t"
+ .$position["y"]."\t"
+ .$fields[key($closest)]["x"]."\t"
+ .$fields[key($closest)]["y"]."\t"
+ .$fields[key($closest)]["z"]."\t"
+ .sqrt($fields[key($closest)]["x"]**2
+ +$fields[key($closest)]["y"]**2
+ +$fields[key($closest)]["z"]**2)."\t"
+ .explode("\t", shell_exec("../a.out enkrat 0.088 ".$position["x"]." ".$position["y"]." 30"))[3]."\t"
+ ."\n";
+}
+?>