internal static Pair <IList <double>, IList <WW.Math.Point3D> > smethod_3( KnotParameterization parameterization, IList <WW.Math.Point3D> points) { IList <double> uBar = DxfSpline.smethod_8(parameterization, points); IList <double> doubleList = DxfSpline.smethod_7(uBar); BSplineD bsplineD = new BSplineD(3, doubleList); double[] result = new double[4]; bsplineD.EvaluateBasisFunctions(4, doubleList[4], result); double num1 = uBar[1] - uBar[0]; double num2 = uBar[2] - uBar[1]; Vector3D point1 = (Vector3D)points[0]; Vector3D point2 = (Vector3D)points[1]; Vector3D point3 = (Vector3D)points[2]; Vector3D vector3D1 = (point2 - point1 * (result[0] * (num1 + num2) / (2.0 * num1 + num2)) - point3 * (result[2] * (num1 + num2) / (num1 + 2.0 * num2))) / (result[0] * num1 / (2.0 * num1 + num2) + result[1] + result[2] * num2 / (num1 + 2.0 * num2)); Vector3D vector3D2 = vector3D1 - point1; Vector3D vector3D3 = vector3D1 - point3; IList <WW.Math.Point3D> second = (IList <WW.Math.Point3D>) new List <WW.Math.Point3D>() { points[0], (WW.Math.Point3D)point1 + vector3D2 * (num1 / (2.0 * num1 + num2)), (WW.Math.Point3D)vector3D1, (WW.Math.Point3D)point3 + vector3D3 * (num2 / (num1 + 2.0 * num2)), points[2] }; return(new Pair <IList <double>, IList <WW.Math.Point3D> >(doubleList, second)); }
internal static Pair <IList <double>, IList <WW.Math.Point3D> > smethod_2( KnotParameterization parameterization, IList <WW.Math.Point3D> points) { IList <double> first = DxfSpline.smethod_7(DxfSpline.smethod_8(parameterization, points)); Vector3D vector3D = (points[1] - points[0]) / 3.0; IList <WW.Math.Point3D> second = (IList <WW.Math.Point3D>) new List <WW.Math.Point3D>() { points[0], points[0] + vector3D, points[1] - vector3D, points[1] }; return(new Pair <IList <double>, IList <WW.Math.Point3D> >(first, second)); }
internal static Pair <IList <double>, IList <WW.Math.Point3D> > smethod_4( KnotParameterization parameterization, IList <WW.Math.Point3D> points) { if (points.Count < 4) { throw new ArgumentException("Not enough fit points, need at least 4!"); } IList <double> uBar = DxfSpline.smethod_8(parameterization, points); int index = uBar.Count - 1; IList <double> doubleList = DxfSpline.smethod_7(uBar); double num1 = 3.0 / (uBar[1] - uBar[0]); Vector3D start = num1 * (1.0 * (points[1] - points[0]) - 0.5 * (points[2] - points[1])); double num2 = 3.0 / (uBar[index] - uBar[index - 1]); Vector3D end = num2 * (1.0 * (points[index] - points[index - 1]) - 0.5 * (points[index - 1] - points[index - 2])); double num3 = 1.0 / start.GetLengthSquared(); double num4 = 1.0 / end.GetLengthSquared(); double num5 = (uBar[1] + uBar[2] - 2.0 * uBar[0]) / (uBar[1] - uBar[0]); double num6 = (2.0 * uBar[index] - uBar[index - 1] - uBar[index - 2]) / (uBar[index] - uBar[index - 1]); double num7 = 8.98846567431158E+307; double num8 = 8.98846567431158E+307; int num9 = 1024; IList <WW.Math.Point3D> second = (IList <WW.Math.Point3D>)null; while (num7 + num8 > 1E-19) { Vector3D vector3D1 = start; Vector3D vector3D2 = end; second = DxfSpline.smethod_9(doubleList, points, start, end); WW.Math.Point3D point3D1 = second[0]; WW.Math.Point3D point3D2 = second[1]; WW.Math.Point3D point3D3 = second[2]; start = 0.5 * (point3D2 - point3D1 + (point3D3 - point3D1) / num5) * num1; num7 = num3 * (start - vector3D1).GetLengthSquared(); WW.Math.Point3D point3D4 = second[second.Count - 1]; WW.Math.Point3D point3D5 = second[second.Count - 2]; WW.Math.Point3D point3D6 = second[second.Count - 3]; end = 0.5 * (point3D4 - point3D5 + (point3D4 - point3D6) / num6) * num2; num8 = num4 * (end - vector3D2).GetLengthSquared(); if (--num9 <= 0) { throw new Exception("Cannot determine spline interpolation!"); } } return(new Pair <IList <double>, IList <WW.Math.Point3D> >(doubleList, second)); }
private static IList <double> smethod_6( KnotParameterization parameterization, IList <WW.Math.Point3D> points) { return(DxfSpline.smethod_7(DxfSpline.smethod_8(parameterization, points))); }