ELASTICPATHING/SOURCECODE/UbiComp2014/Get_Map_Code/lib-Dist.rb
#A container for the two splies that make up a lat/lon function. Can calculate individual points on the spline, or fill in the points between a range
A container for the two splies that make up a lat/lon function. Can calculate individual points on the spline, or fill in the points between a range
A container for the two splies that make up a lat / lon function . Can calculate individual points on the spline or fill in the points between a range
def interpolate(points)
		Since latitude and longitude are not functionally realted to each other, it does not make sense to interpolate with either being the independant
		variable. Instead we will build two seperate functions and draw a paramentric curve. Thus the lat/lon pairs must be evaluated against values 
		of t. That is given a t, we will return (x(t),y(t),x'(t),y'(t),x''(t),y''(t)). We may have to revisit this later to return dy/dx
		lat_interp = @lat_spline.eval_arr(points)
		lon_interp = @lon_spline.eval_arr(points)
		return (0..lat_interp.length-1).map{|i| [lat_interp[i][0],lon_interp[i][0],lat_interp[i][1]]}
	end
def interpolate ( points ) lat_interp = @lat_spline . eval_arr ( points ) lon_interp = @lon_spline . eval_arr ( points ) return ( 0 .. lat_interp . length - 1 ) . map { | i | [ lat_interp [ i ] [ 0 ] , lon_interp [ i ] [ 0 ] , lat_interp [ i ] [ 1 ] ] } end
A container for the two splies that make up a lat/lon function.
A container for the two splies that make up a lat / lon function .
#points is an integer that is the number of points you want to fill in between the first and last index # #Since latitude and longitude are not functionally realted to each other, it does not make sense to interpolate with either being the independant #variable. Instead we will build two seperate functions and draw a paramentric curve. Thus the lat/lon pairs must be evaluated against values  #of t. That is given a t, we will return (x(t),y(t),x'(t),y'(t),x''(t),y''(t)). We may have to revisit this later to return dy/dx
points