//returns the interpolated position value func (s *Spline) At(time Double) *Vec3 { a := s.NodeBefore(time) b := s.NodeAfter(time) dt := b.T - a.T t := (time - a.T) / dt return glmath.InterpolateHermiteVec3(a.P, a.V, b.P, b.V, t) }
func (n *Node) InterpolateV(o *Node, t Double) *Node { p := glmath.InterpolateHermiteVec3(n.P, n.Tv, o.P, o.Tv, t) tu := n.Tu.Interpolate(o.Tu, t) tv := glmath.InterpolateHermiteD1Vec3(n.P, n.Tv, o.P, o.Tv, t) tc := n.Tc.Interpolate(o.Tc, t) u, v := n.U+(o.U-n.U)*t, n.V+(o.V-n.V)*t return NewNode(p, tu, tv, tc, u, v) }