double splineXMax(double Sx, double a, double Ex) {
double c=Sx-a, d=c+Ex-a, F, X, max=Sx ;
if (Ex>Sx) max=Ex;
if (d!=0.) {
F=c/d;
if (F>0. && F<1.) {
X=Sx-c*F; if (X>max) max=X; }}
return max; }
double splineXMin(double Sx, double a, double Ex) {
double c=Sx-a, d=c+Ex-a, F, X, min=Sx ;
if (Ex<Sx) min=Ex;
if (d!=0.) {
F=c/d;
if (F>0. && F<1.) {
X=Sx-c*F; if (X<min) min=X; }}
return min; }
double splineYMax(double Sy, double b, double Ey) {
double c=Sy-b, d=c+Ey-b, F, Y, max=Sy ;
if (Ey>Sy) max=Ey;
if (d!=0.) {
F=c/d;
if (F>0. && F<1.) {
Y=Sy-c*F; if (Y>max) max=Y; }}
return max; }
double splineYMin(double Sy, double b, double Ey) {
double c=Sy-b, d=c+Ey-b, F, Y, min=Sy ;
if (Ey<Sy) min=Ey;
if (d!=0.) {
F=c/d;
if (F>0. && F<1.) {
Y=Sy-c*F; if (Y<min) min=Y; }}
return min; }
|