tracksperanto 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +1 -1
- data/Manifest.txt +1 -0
- data/lib/tracksperanto.rb +1 -1
- data/lib/tracksperanto/uv_coordinates.rb +20 -0
- metadata +2 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/tracksperanto.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Y down X right, 0 is center and values are UV float -1 to 1, doubled
|
2
|
+
module Tracksperanto::UVCoordinates
|
3
|
+
|
4
|
+
# UV coords used by Syntheyes and it's lens distortion algos.
|
5
|
+
def absolute_to_uv(abs_x, abs_y, w, h)
|
6
|
+
[convert_to_uv(abs_x, w), convert_to_uv(abs_y, h) * -1]
|
7
|
+
end
|
8
|
+
|
9
|
+
def convert_to_uv(absolute_value, absolute_side)
|
10
|
+
x = (absolute_value / absolute_side.to_f) - 0.5
|
11
|
+
# .2 to -.3, y is reversed and coords are double
|
12
|
+
x * 2
|
13
|
+
end
|
14
|
+
|
15
|
+
def convert_from_uv(absolute_side, uv_value)
|
16
|
+
# First, start from zero (-.1 becomes .4)
|
17
|
+
value_off_corner = (uv_value.to_f / 2) + 0.5
|
18
|
+
absolute_side * value_off_corner
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracksperanto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/tracksperanto/safety.rb
|
94
94
|
- lib/tracksperanto/simple_export.rb
|
95
95
|
- lib/tracksperanto/tracker.rb
|
96
|
+
- lib/tracksperanto/uv_coordinates.rb
|
96
97
|
- lib/tracksperanto/zip_tuples.rb
|
97
98
|
- test/.DS_Store
|
98
99
|
- test/export/.DS_Store
|