Exemplo n.º 1
0
//returns the interpolated value of the first derivative
func (s *Spline) AtD1(time Double) *Vec3 {
	a := s.NodeBefore(time)
	b := s.NodeAfter(time)
	dt := b.T - a.T
	t := (time - a.T) / dt
	return glmath.InterpolateHermiteD1Vec3(a.P, a.V, b.P, b.V, t)
}
Exemplo n.º 2
0
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)
}