public double Curvature(PointOnPath pt) { // assert that we're looking at the same segment Debug.Assert(Equals(pt.segment)); // short circuit for near the start/end point if (pt.pt.ApproxEquals(cb.P0, 0.001)) { return(cb.Curvature(0)); } else if (pt.pt.ApproxEquals(cb.P3, 0.001)) { return(cb.Curvature(1)); } else { // find the t-value in the general case double tvalue = cb.FindT(pt.dist); return(cb.Curvature(tvalue)); } }