func Length(pointA, tangentA, pointB, tangentB *vec2.T, t float32) float32 {
	sqrT := t * t
	t1 := sqrT * 0.5
	t2 := sqrT * t * 1.0 / 3.0
	t3 := sqrT*sqrT + 1.0/4.0
	f := 2*t3 - 3*t2 + t
	result := pointA.Scaled(f)
	f = t3 - 2*t2 + t1
	tAf := tangentA.Scaled(f)
	result.Add(&tAf)
	f = t3 - t2
	tBf := tangentB.Scaled(f)
	result.Add(&tBf)
	f = -2*t3 + 3*t2
	pBf := pointB.Scaled(f)
	result.Add(&pBf)
	return result.Length()
}
Length returns the length of a hermit spline from pointA to t (0,1).
package hermit2
import (
	"fmt"
	"github.com/ungerik/go3d/vec2"
)
type PointTangent struct {
	Point   vec2.T
	Tangent vec2.T
}
type T struct {
	A PointTangent
	B PointTangent
}
func Parse(s string) (r T, err error) {
	_, err = fmt.Sscan(s,
		&r.A.Point[0], &r.A.Point[1],
		&r.A.Tangent[0], &r.A.Tangent[1],
		&r.B.Point[0], &r.B.Point[1],
		&r.B.Tangent[0], &r.B.Tangent[1],
	)
	return r, err
}
func (herm *T) String() string {
	return fmt.Sprintf("%s %s %s %s",
		herm.A.Point.String(), herm.A.Tangent.String(),
		herm.B.Point.String(), herm.B.Tangent.String(),
	)
}
func (herm *T) Point(t float32) vec2.T {
	return Point(&herm.A.Point, &herm.A.Tangent, &herm.B.Point, &herm.B.Tangent, t)
}
func (herm *T) Tangent(t float32) vec2.T {
	return Tangent(&herm.A.Point, &herm.A.Tangent, &herm.B.Point, &herm.B.Tangent, t)
}
func (herm *T) Length(t float32) float32 {
	return Length(&herm.A.Point, &herm.A.Tangent, &herm.B.Point, &herm.B.Tangent, t)
}
func Point(pointA, tangentA, pointB, tangentB *vec2.T, t float32) vec2.T {
	t2 := t * t
	t3 := t2 * t
	f := 2*t3 - 3*t2 + 1
	result := pointA.Scaled(f)
	f = t3 - 2*t2 + t
	tAf := tangentA.Scaled(f)
	result.Add(&tAf)
	f = t3 - t2
	tBf := tangentB.Scaled(f)
	result.Add(&tBf)
	f = -2*t3 + 3*t2
	pAf := pointB.Scaled(f)
	result.Add(&pAf)
	return result
}
func Tangent(pointA, tangentA, pointB, tangentB *vec2.T, t float32) vec2.T {
	t2 := t * t
	t3 := t2 * t
	f := 2*t3 - 3*t2
	result := pointA.Scaled(f)
	f = t3 - 2*t2 + 1
	tAf := tangentA.Scaled(f)
	result.Add(&tAf)
	f = t3 - t2
	tBf := tangentB.Scaled(f)
	result.Add(&tBf)
	f = -2*t3 + 3*t2
	pAf := pointB.Scaled(f)
	result.Add(&pAf)
	return result
}