public static ICurve CreateTrimmedCurve(this ICurve curve, double t0, double t1) { var p0 = curve.Evaluate2(t0, 0).CastArray <double>(); var p1 = curve.Evaluate2(t1, 0).CastArray <double>(); return((ICurve)curve.CreateTrimmedCurve(p0[0], p0[1], p0[2], p1[0], p1[1], p1[2])); }
public static Vector3[] GetTessPoints(this ICurve curve, double chordTol, double lengthTol, RangeDouble?domain = null) { bool isPeriodic; double end; bool isClosed; double start; if (domain == null) { curve.GetEndParams(out start, out end, out isClosed, out isPeriodic); } else { start = domain.Value.Min; end = domain.Value.Max; } var startPt = (double[])curve.Evaluate2(start, 0); var midPt = (double[])curve.Evaluate2((start + end) / 2, 0); var endPt = (double[])curve.Evaluate2(end, 0); var set0 = GetTessPotsAsVector3(curve, chordTol, lengthTol, startPt, midPt) .ToArray(); var set1 = GetTessPotsAsVector3(curve, chordTol, lengthTol, midPt, endPt) .ToArray(); return(set0.Concat(set1.Skip(1)).ToArray()); }
public static double[] CurveBoundsDoubleArray(this ICurve curve) { var start = curve.Evaluate2(curve.Domain().Min(), 0).CastArray <double>().Take(3); var end = curve.Evaluate2(curve.Domain().Max(), 0).CastArray <double>().Take(3); return(start.Concat(end).ToArray()); }
/// <summary> /// Return the point at parameter value t on the curve. /// </summary> /// <param name="curve"></param> /// <param name="t"></param> /// <param name="derivatives"></param> /// <returns></returns> public static List <Vector3> PointAt(this ICurve curve, double t, int derivatives) { var ret = ((double[])curve.Evaluate2(t, derivatives)) .Buffer(3, 3) .Take(derivatives + 1) .Select(p => p.ToVector3()) .ToList(); return(ret); }