feat(decart): interp

This commit is contained in:
gili8420 2026-08-03 22:10:10 +09:00
parent 1bd9143186
commit 19557f3a62
14 changed files with 681 additions and 208 deletions

View file

@ -7,7 +7,7 @@ import (
func TestRK4ExponentialDecay(t *testing.T) {
// dAlt/dt = -Alt → exact: Alt(t) = Alt0 * exp(-t).
f := func(_ float64, y GeoVec) GeoVec { return GeoVec{Altitude: -y.Altitude} }
f := func(_ float64, y GeoVec) Rate { return Rate{Vertical: -y.Altitude} }
y := GeoVec{Altitude: 1}
tnow, dt := 0.0, 0.01
@ -23,7 +23,7 @@ func TestRK4ExponentialDecay(t *testing.T) {
func TestRK4ReverseTime(t *testing.T) {
// dAlt/dt = Alt → exact: Alt(t) = Alt0 * exp(t).
f := func(_ float64, y GeoVec) GeoVec { return GeoVec{Altitude: y.Altitude} }
f := func(_ float64, y GeoVec) Rate { return Rate{Vertical: y.Altitude} }
y := GeoVec{Altitude: math.E}
tnow, dt := 1.0, -0.01
@ -50,13 +50,6 @@ func TestRefineCrossing(t *testing.T) {
}
}
func TestGeoAddWrapsLongitude(t *testing.T) {
y := GeoAdd(GeoVec{Lng: 350}, 1, GeoVec{Lng: 20})
if math.Abs(y.Lng-10) > 1e-9 {
t.Errorf("GeoAdd wrap: lng = %v, want 10", y.Lng)
}
}
func TestGeoLerpWrap(t *testing.T) {
mid := GeoLerp(GeoVec{Lng: 350}, GeoVec{Lng: 10}, 0.5)
if math.Abs(mid.Lng) > 1e-9 && math.Abs(mid.Lng-360) > 1e-9 {