NAME
Geo::Spline - Calculate geographic locations between GPS fixes.
SYNOPSIS
use Geo::Spline;
my $p0={time=>1160449100.67,
lat=>39.197807,
lon=>-77.263510,
speed=>31.124,
heading=>144.8300};
my $p1={time=>1160449225.66,
lat=>39.167718,
lon=>-77.242278,
speed=>30.615,
heading=>150.5300};
my $spline=Geo::Spline->new($p0, $p1);
my $point=$spline->point(1160449150);
print "Lon", $pt->{"lat"}, "Lat", $pt->{"lon"}, "\n";
my $pointlistref=$spline->pointlist(); #default is int(t2-t1+.5)
DESCRIPTION
This program was developed to be able to calculate the position between two GPS fixes using a 2-dimintional 3rd order polynominal spline.
f(t) = A + B(t-t0) + C(t-t0)^2 + D(t-t0)^3 #position in X and Y
f'(t) = B + 2C(t-t0) + 3D(t-t0)^2 #velocity in X and Y
I did some simplae Math (for an engineer with a math minor) to come up with these formulas to calculate the unknowns from our knowns.
A = x0 # when (t-t0)=0 in f(t)
B = v0 # when (t-t0)=0 in f'(t)
C = (x1-A-B(t1-t0)-D(t1-t0)^3)/(t1-t0)^2 # solve for C from f(t)
C = (v1-B-3D(t1-t0)^2)/2(t1-t0) # solve for C from f'(t)
D = (v1(t1-t0)+B(t1-t0)-2x1+2A)/(t1-t0)^3 # equate C=C then solve for D
METHODS
TODO
Integrate a better lat,Lon to meter conversions.
Migrate certain hash reference variables to object methods.
Add a timeref method
BUGS
LIMITS
I use a very rough conversion from degrees to meters and then back. It is accurate for short distances.
AUTHOR
Michael R. Davis qw/perl michaelrdavis com/
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Net::GPSD Math::Spline