Module: GPSTool::Filters::Velocity

Defined in:
lib/gpstool/filters/velocity.rb

Class Method Summary collapse

Class Method Details

.filter_points(points, options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gpstool/filters/velocity.rb', line 8

def self.filter_points(points, options)
	filtered_points = []
	i = 0
	
	while i < points.size
		current = points[i]
		
		filtered_points << current
		
		j = i + 1
		
		while j < points.size
			step = points[j]
			speed = current.averageSpeedTo(step)
			
			break if speed < options[:speed]
			
			j += 1
		end
		
		i = j
	end
	
	return filtered_points
end