/************************************************************************* * This function calculates arc length, i.e. length of curve between t=a * and t=b. * * INPUT PARAMETERS: * P - parametric spline interpolant * A,B - parameter values corresponding to arc ends: * B>A will result in positive length returned * B<A will result in negative length returned * * RESULT: * length of arc starting at T=A and ending at T=B. * * * -- ALGLIB PROJECT -- * Copyright 30.05.2010 by Bochkanov Sergey *************************************************************************/ public static double pspline3arclength(ref pspline3interpolant p, double a, double b) { double result = 0; autogk.autogkstate state = new autogk.autogkstate(); autogk.autogkreport rep = new autogk.autogkreport(); double sx = 0; double dsx = 0; double d2sx = 0; double sy = 0; double dsy = 0; double d2sy = 0; double sz = 0; double dsz = 0; double d2sz = 0; autogk.autogksmooth(a, b, ref state); while (autogk.autogkiteration(ref state)) { spline1d.spline1ddiff(ref p.x, state.x, ref sx, ref dsx, ref d2sx); spline1d.spline1ddiff(ref p.y, state.x, ref sy, ref dsy, ref d2sy); spline1d.spline1ddiff(ref p.z, state.x, ref sz, ref dsz, ref d2sz); state.f = apserv.safepythag3(dsx, dsy, dsz); } autogk.autogkresults(ref state, ref result, ref rep); System.Diagnostics.Debug.Assert(rep.terminationtype > 0, "PSpline3ArcLength: internal error!"); return(result); }
/************************************************************************* * This function calculates the value of the parametric spline for a given * value of parameter T. * * INPUT PARAMETERS: * P - parametric spline interpolant * T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of * the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] * by making T=T-floor(T). * * OUTPUT PARAMETERS: * X - X-position * Y - Y-position * Z - Z-position * * * -- ALGLIB PROJECT -- * Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3calc(ref pspline3interpolant p, double t, ref double x, ref double y, ref double z) { if (p.periodic) { t = t - (int)Math.Floor(t); } x = spline1d.spline1dcalc(ref p.x, t); y = spline1d.spline1dcalc(ref p.y, t); z = spline1d.spline1dcalc(ref p.z, t); }
/************************************************************************* * This function returns vector of parameter values correspoding to points. * * Same as PSpline2ParameterValues(), but for 3D. * * -- ALGLIB PROJECT -- * Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3parametervalues(ref pspline3interpolant p, ref int n, ref double[] t) { int i_ = 0; System.Diagnostics.Debug.Assert(p.n >= 2, "PSpline3ParameterValues: internal error!"); n = p.n; t = new double[n]; for (i_ = 0; i_ <= n - 1; i_++) { t[i_] = p.p[i_]; } t[0] = 0; if (!p.periodic) { t[n - 1] = 1; } }
/************************************************************************* * This function calculates derivative, i.e. it returns (dX/dT,dY/dT,dZ/dT). * * INPUT PARAMETERS: * P - parametric spline interpolant * T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of * the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] * by making T=T-floor(T). * * OUTPUT PARAMETERS: * X - X-value * DX - X-derivative * Y - Y-value * DY - Y-derivative * Z - Z-value * DZ - Z-derivative * * * -- ALGLIB PROJECT -- * Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3diff(ref pspline3interpolant p, double t, ref double x, ref double dx, ref double y, ref double dy, ref double z, ref double dz) { double d2s = 0; if (p.periodic) { t = t - (int)Math.Floor(t); } spline1d.spline1ddiff(ref p.x, t, ref x, ref dx, ref d2s); spline1d.spline1ddiff(ref p.y, t, ref y, ref dy, ref d2s); spline1d.spline1ddiff(ref p.z, t, ref z, ref dz, ref d2s); }
/************************************************************************* * This function calculates tangent vector for a given value of parameter T * * INPUT PARAMETERS: * P - parametric spline interpolant * T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of * the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] * by making T=T-floor(T). * * OUTPUT PARAMETERS: * X - X-component of tangent vector (normalized) * Y - Y-component of tangent vector (normalized) * Z - Z-component of tangent vector (normalized) * * NOTE: * X^2+Y^2+Z^2 is either 1 (for non-zero tangent vector) or 0. * * * -- ALGLIB PROJECT -- * Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3tangent(ref pspline3interpolant p, double t, ref double x, ref double y, ref double z) { double v = 0; double v0 = 0; double v1 = 0; double v2 = 0; if (p.periodic) { t = t - (int)Math.Floor(t); } pspline3diff(ref p, t, ref v0, ref x, ref v1, ref y, ref v2, ref z); if ((double)(x) != (double)(0) | (double)(y) != (double)(0) | (double)(z) != (double)(0)) { v = apserv.safepythag3(x, y, z); x = x / v; y = y / v; z = z / v; } }
/************************************************************************* * This function builds periodic 3-dimensional parametric spline which * starts at (X[0],Y[0],Z[0]), goes through all points to (X[N-1],Y[N-1],Z[N-1]) * and then back to (X[0],Y[0],Z[0]). * * Same as PSpline2Build() function, but for 3D, so we won't duplicate its * description here. * * -- ALGLIB PROJECT -- * Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3buildperiodic(double[,] xy, int n, int st, int pt, ref pspline3interpolant p) { double[,] xyp = new double[0, 0]; double[] tmp = new double[0]; double v = 0; int i = 0; int i_ = 0; xy = (double[, ])xy.Clone(); System.Diagnostics.Debug.Assert(st >= 1 & st <= 2, "PSpline3BuildPeriodic: incorrect spline type!"); System.Diagnostics.Debug.Assert(pt >= 0 & pt <= 2, "PSpline3BuildPeriodic: incorrect parameterization type!"); System.Diagnostics.Debug.Assert(n >= 3, "PSpline3BuildPeriodic: N<3!"); // // Prepare // p.n = n; p.periodic = true; tmp = new double[n + 1]; xyp = new double[n + 1, 3]; for (i_ = 0; i_ <= n - 1; i_++) { xyp[i_, 0] = xy[i_, 0]; } for (i_ = 0; i_ <= n - 1; i_++) { xyp[i_, 1] = xy[i_, 1]; } for (i_ = 0; i_ <= n - 1; i_++) { xyp[i_, 2] = xy[i_, 2]; } for (i_ = 0; i_ <= 2; i_++) { xyp[n, i_] = xy[0, i_]; } // // Build parameterization, check that all parameters are distinct // pspline3par(ref xyp, n + 1, pt, ref p.p); System.Diagnostics.Debug.Assert(apserv.apservaredistinct(p.p, n + 1), "PSplineBuild2Periodic: consequent (or first and last) points are too close!"); // // Build splines // if (st == 1) { for (i_ = 0; i_ <= n; i_++) { tmp[i_] = xyp[i_, 0]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n + 1, -1, 0.0, ref p.x); for (i_ = 0; i_ <= n; i_++) { tmp[i_] = xyp[i_, 1]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n + 1, -1, 0.0, ref p.y); for (i_ = 0; i_ <= n; i_++) { tmp[i_] = xyp[i_, 2]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n + 1, -1, 0.0, ref p.z); } if (st == 2) { for (i_ = 0; i_ <= n; i_++) { tmp[i_] = xyp[i_, 0]; } spline1d.spline1dbuildcubic(p.p, tmp, n + 1, -1, 0.0, -1, 0.0, ref p.x); for (i_ = 0; i_ <= n; i_++) { tmp[i_] = xyp[i_, 1]; } spline1d.spline1dbuildcubic(p.p, tmp, n + 1, -1, 0.0, -1, 0.0, ref p.y); for (i_ = 0; i_ <= n; i_++) { tmp[i_] = xyp[i_, 2]; } spline1d.spline1dbuildcubic(p.p, tmp, n + 1, -1, 0.0, -1, 0.0, ref p.z); } }
/************************************************************************* * This function builds non-periodic 3-dimensional parametric spline which * starts at (X[0],Y[0],Z[0]) and ends at (X[N-1],Y[N-1],Z[N-1]). * * Same as PSpline2Build() function, but for 3D, so we won't duplicate its * description here. * * -- ALGLIB PROJECT -- * Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3build(double[,] xy, int n, int st, int pt, ref pspline3interpolant p) { double[] tmp = new double[0]; double v = 0; int i = 0; int i_ = 0; xy = (double[, ])xy.Clone(); System.Diagnostics.Debug.Assert(st >= 0 & st <= 2, "PSpline3Build: incorrect spline type!"); System.Diagnostics.Debug.Assert(pt >= 0 & pt <= 2, "PSpline3Build: incorrect parameterization type!"); if (st == 0) { System.Diagnostics.Debug.Assert(n >= 5, "PSpline3Build: N<5 (minimum value for Akima splines)!"); } else { System.Diagnostics.Debug.Assert(n >= 2, "PSpline3Build: N<2!"); } // // Prepare // p.n = n; p.periodic = false; tmp = new double[n]; // // Build parameterization, check that all parameters are distinct // pspline3par(ref xy, n, pt, ref p.p); System.Diagnostics.Debug.Assert(apserv.apservaredistinct(p.p, n), "PSpline3Build: consequent points are too close!"); // // Build splines // if (st == 0) { for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 0]; } spline1d.spline1dbuildakima(p.p, tmp, n, ref p.x); for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 1]; } spline1d.spline1dbuildakima(p.p, tmp, n, ref p.y); for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 2]; } spline1d.spline1dbuildakima(p.p, tmp, n, ref p.z); } if (st == 1) { for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 0]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n, 0, 0.0, ref p.x); for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 1]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n, 0, 0.0, ref p.y); for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 2]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n, 0, 0.0, ref p.z); } if (st == 2) { for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 0]; } spline1d.spline1dbuildcubic(p.p, tmp, n, 0, 0.0, 0, 0.0, ref p.x); for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 1]; } spline1d.spline1dbuildcubic(p.p, tmp, n, 0, 0.0, 0, 0.0, ref p.y); for (i_ = 0; i_ <= n - 1; i_++) { tmp[i_] = xy[i_, 2]; } spline1d.spline1dbuildcubic(p.p, tmp, n, 0, 0.0, 0, 0.0, ref p.z); } }
/************************************************************************* This function calculates arc length, i.e. length of curve between t=a and t=b. INPUT PARAMETERS: P - parametric spline interpolant A,B - parameter values corresponding to arc ends: * B>A will result in positive length returned * B<A will result in negative length returned RESULT: length of arc starting at T=A and ending at T=B. -- ALGLIB PROJECT -- Copyright 30.05.2010 by Bochkanov Sergey *************************************************************************/ public static double pspline3arclength(pspline3interpolant p, double a, double b) { double result = 0; autogk.autogkstate state = new autogk.autogkstate(); autogk.autogkreport rep = new autogk.autogkreport(); double sx = 0; double dsx = 0; double d2sx = 0; double sy = 0; double dsy = 0; double d2sy = 0; double sz = 0; double dsz = 0; double d2sz = 0; autogk.autogksmooth(a, b, state); while( autogk.autogkiteration(state) ) { spline1d.spline1ddiff(p.x, state.x, ref sx, ref dsx, ref d2sx); spline1d.spline1ddiff(p.y, state.x, ref sy, ref dsy, ref d2sy); spline1d.spline1ddiff(p.z, state.x, ref sz, ref dsz, ref d2sz); state.f = apserv.safepythag3(dsx, dsy, dsz); } autogk.autogkresults(state, ref result, rep); alglib.ap.assert(rep.terminationtype>0, "PSpline3ArcLength: internal error!"); return result; }
/************************************************************************* This function calculates derivative, i.e. it returns (dX/dT,dY/dT,dZ/dT). INPUT PARAMETERS: P - parametric spline interpolant T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] by making T=T-floor(T). OUTPUT PARAMETERS: X - X-value DX - X-derivative Y - Y-value DY - Y-derivative Z - Z-value DZ - Z-derivative -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3diff(ref pspline3interpolant p, double t, ref double x, ref double dx, ref double y, ref double dy, ref double z, ref double dz) { double d2s = 0; if( p.periodic ) { t = t-(int)Math.Floor(t); } spline1d.spline1ddiff(ref p.x, t, ref x, ref dx, ref d2s); spline1d.spline1ddiff(ref p.y, t, ref y, ref dy, ref d2s); spline1d.spline1ddiff(ref p.z, t, ref z, ref dz, ref d2s); }
/************************************************************************* This function calculates tangent vector for a given value of parameter T INPUT PARAMETERS: P - parametric spline interpolant T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] by making T=T-floor(T). OUTPUT PARAMETERS: X - X-component of tangent vector (normalized) Y - Y-component of tangent vector (normalized) Z - Z-component of tangent vector (normalized) NOTE: X^2+Y^2+Z^2 is either 1 (for non-zero tangent vector) or 0. -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3tangent(pspline3interpolant p, double t, ref double x, ref double y, ref double z) { double v = 0; double v0 = 0; double v1 = 0; double v2 = 0; x = 0; y = 0; z = 0; if( p.periodic ) { t = t-(int)Math.Floor(t); } pspline3diff(p, t, ref v0, ref x, ref v1, ref y, ref v2, ref z); if( ((double)(x)!=(double)(0) || (double)(y)!=(double)(0)) || (double)(z)!=(double)(0) ) { v = apserv.safepythag3(x, y, z); x = x/v; y = y/v; z = z/v; } }
/************************************************************************* This function calculates the value of the parametric spline for a given value of parameter T. INPUT PARAMETERS: P - parametric spline interpolant T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] by making T=T-floor(T). OUTPUT PARAMETERS: X - X-position Y - Y-position Z - Z-position -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3calc(pspline3interpolant p, double t, ref double x, ref double y, ref double z) { x = 0; y = 0; z = 0; if( p.periodic ) { t = t-(int)Math.Floor(t); } x = spline1d.spline1dcalc(p.x, t); y = spline1d.spline1dcalc(p.y, t); z = spline1d.spline1dcalc(p.z, t); }
/************************************************************************* This function returns vector of parameter values correspoding to points. Same as PSpline2ParameterValues(), but for 3D. -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3parametervalues(pspline3interpolant p, ref int n, ref double[] t) { int i_ = 0; n = 0; t = new double[0]; alglib.ap.assert(p.n>=2, "PSpline3ParameterValues: internal error!"); n = p.n; t = new double[n]; for(i_=0; i_<=n-1;i_++) { t[i_] = p.p[i_]; } t[0] = 0; if( !p.periodic ) { t[n-1] = 1; } }
/************************************************************************* This function builds periodic 3-dimensional parametric spline which starts at (X[0],Y[0],Z[0]), goes through all points to (X[N-1],Y[N-1],Z[N-1]) and then back to (X[0],Y[0],Z[0]). Same as PSpline2Build() function, but for 3D, so we won't duplicate its description here. -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3buildperiodic(double[,] xy, int n, int st, int pt, pspline3interpolant p) { double[,] xyp = new double[0,0]; double[] tmp = new double[0]; int i_ = 0; xy = (double[,])xy.Clone(); alglib.ap.assert(st>=1 && st<=2, "PSpline3BuildPeriodic: incorrect spline type!"); alglib.ap.assert(pt>=0 && pt<=2, "PSpline3BuildPeriodic: incorrect parameterization type!"); alglib.ap.assert(n>=3, "PSpline3BuildPeriodic: N<3!"); // // Prepare // p.n = n; p.periodic = true; tmp = new double[n+1]; xyp = new double[n+1, 3]; for(i_=0; i_<=n-1;i_++) { xyp[i_,0] = xy[i_,0]; } for(i_=0; i_<=n-1;i_++) { xyp[i_,1] = xy[i_,1]; } for(i_=0; i_<=n-1;i_++) { xyp[i_,2] = xy[i_,2]; } for(i_=0; i_<=2;i_++) { xyp[n,i_] = xy[0,i_]; } // // Build parameterization, check that all parameters are distinct // pspline3par(xyp, n+1, pt, ref p.p); alglib.ap.assert(apserv.aredistinct(p.p, n+1), "PSplineBuild2Periodic: consequent (or first and last) points are too close!"); // // Build splines // if( st==1 ) { for(i_=0; i_<=n;i_++) { tmp[i_] = xyp[i_,0]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n+1, -1, 0.0, p.x); for(i_=0; i_<=n;i_++) { tmp[i_] = xyp[i_,1]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n+1, -1, 0.0, p.y); for(i_=0; i_<=n;i_++) { tmp[i_] = xyp[i_,2]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n+1, -1, 0.0, p.z); } if( st==2 ) { for(i_=0; i_<=n;i_++) { tmp[i_] = xyp[i_,0]; } spline1d.spline1dbuildcubic(p.p, tmp, n+1, -1, 0.0, -1, 0.0, p.x); for(i_=0; i_<=n;i_++) { tmp[i_] = xyp[i_,1]; } spline1d.spline1dbuildcubic(p.p, tmp, n+1, -1, 0.0, -1, 0.0, p.y); for(i_=0; i_<=n;i_++) { tmp[i_] = xyp[i_,2]; } spline1d.spline1dbuildcubic(p.p, tmp, n+1, -1, 0.0, -1, 0.0, p.z); } }
/************************************************************************* This function builds non-periodic 3-dimensional parametric spline which starts at (X[0],Y[0],Z[0]) and ends at (X[N-1],Y[N-1],Z[N-1]). Same as PSpline2Build() function, but for 3D, so we won't duplicate its description here. -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3build(double[,] xy, int n, int st, int pt, pspline3interpolant p) { double[] tmp = new double[0]; int i_ = 0; xy = (double[,])xy.Clone(); alglib.ap.assert(st>=0 && st<=2, "PSpline3Build: incorrect spline type!"); alglib.ap.assert(pt>=0 && pt<=2, "PSpline3Build: incorrect parameterization type!"); if( st==0 ) { alglib.ap.assert(n>=5, "PSpline3Build: N<5 (minimum value for Akima splines)!"); } else { alglib.ap.assert(n>=2, "PSpline3Build: N<2!"); } // // Prepare // p.n = n; p.periodic = false; tmp = new double[n]; // // Build parameterization, check that all parameters are distinct // pspline3par(xy, n, pt, ref p.p); alglib.ap.assert(apserv.aredistinct(p.p, n), "PSpline3Build: consequent points are too close!"); // // Build splines // if( st==0 ) { for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,0]; } spline1d.spline1dbuildakima(p.p, tmp, n, p.x); for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,1]; } spline1d.spline1dbuildakima(p.p, tmp, n, p.y); for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,2]; } spline1d.spline1dbuildakima(p.p, tmp, n, p.z); } if( st==1 ) { for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,0]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n, 0, 0.0, p.x); for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,1]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n, 0, 0.0, p.y); for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,2]; } spline1d.spline1dbuildcatmullrom(p.p, tmp, n, 0, 0.0, p.z); } if( st==2 ) { for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,0]; } spline1d.spline1dbuildcubic(p.p, tmp, n, 0, 0.0, 0, 0.0, p.x); for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,1]; } spline1d.spline1dbuildcubic(p.p, tmp, n, 0, 0.0, 0, 0.0, p.y); for(i_=0; i_<=n-1;i_++) { tmp[i_] = xy[i_,2]; } spline1d.spline1dbuildcubic(p.p, tmp, n, 0, 0.0, 0, 0.0, p.z); } }
public override alglib.apobject make_copy() { pspline3interpolant _result = new pspline3interpolant(); _result.n = n; _result.periodic = periodic; _result.p = (double[])p.Clone(); _result.x = (spline1d.spline1dinterpolant)x.make_copy(); _result.y = (spline1d.spline1dinterpolant)y.make_copy(); _result.z = (spline1d.spline1dinterpolant)z.make_copy(); return _result; }
/************************************************************************* This function calculates first and second derivative with respect to T. INPUT PARAMETERS: P - parametric spline interpolant T - point: * T in [0,1] corresponds to interval spanned by points * for non-periodic splines T<0 (or T>1) correspond to parts of the curve before the first (after the last) point * for periodic splines T<0 (or T>1) are projected into [0,1] by making T=T-floor(T). OUTPUT PARAMETERS: X - X-value DX - derivative D2X - second derivative Y - Y-value DY - derivative D2Y - second derivative Z - Z-value DZ - derivative D2Z - second derivative -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3diff2(pspline3interpolant p, double t, ref double x, ref double dx, ref double d2x, ref double y, ref double dy, ref double d2y, ref double z, ref double dz, ref double d2z) { x = 0; dx = 0; d2x = 0; y = 0; dy = 0; d2y = 0; z = 0; dz = 0; d2z = 0; if( p.periodic ) { t = t-(int)Math.Floor(t); } spline1d.spline1ddiff(p.x, t, ref x, ref dx, ref d2x); spline1d.spline1ddiff(p.y, t, ref y, ref dy, ref d2y); spline1d.spline1ddiff(p.z, t, ref z, ref dz, ref d2z); }
/************************************************************************* This function returns vector of parameter values correspoding to points. Same as PSpline2ParameterValues(), but for 3D. -- ALGLIB PROJECT -- Copyright 28.05.2010 by Bochkanov Sergey *************************************************************************/ public static void pspline3parametervalues(ref pspline3interpolant p, ref int n, ref double[] t) { int i_ = 0; System.Diagnostics.Debug.Assert(p.n>=2, "PSpline3ParameterValues: internal error!"); n = p.n; t = new double[n]; for(i_=0; i_<=n-1;i_++) { t[i_] = p.p[i_]; } t[0] = 0; if( !p.periodic ) { t[n-1] = 1; } }