16 void cfnewpm(
double *
par,
const double *xyzStart,
double *xyzEnd,
const double ustep,
double *parn,
double *closePoint,
VKalVrtControlBase * CONTROL)
18 double d__1, d__2,dist_left;
19 double vect[7], stmg, vout[7]={0.}, dpar0[5];
20 double perig[3], dstep, xyzst[3],
charge;
21 double posold, poscur, totway,
dp;
38 totway = (ustep) * sqrt(1. / (d__1 * d__1) + 1.);
40 if (fabs(ustep) < 10. && fabs(totway) < 20.)
return;
44 vect[0] =
sin(
par[4]) *
par[1] +xyzStart[0];
45 vect[1] = -
cos(
par[4]) *
par[1] +xyzStart[1];
46 vect[2] =
par[2] +xyzStart[2];
50 double pt = constB / fabs(
par[5]);
64 while(fabs(poscur) < fabs(totway)) {
66 d__1 = fabs(poscur) + stmg;
68 poscur = d__1 < d__2 ? d__1 : d__2;
69 poscur =
d_sign(poscur, totway);
70 dstep = poscur - posold;
79 dX = vect[0]-xyzEnd[0];
80 dY = vect[1]-xyzEnd[1];
81 dZ = vect[2]-xyzEnd[2];
82 dist_left = sqrt( dX*dX + dY*dY + dZ*dZ);
83 if(dist_left < stmg)
break;
90 if(std::abs(constB)<0.001)constB=0.001;
94 dpar0[2] = acos(vout[5]);
95 dpar0[3] = atan2(vout[4], vout[3]);
98 px = vect[3] * vect[6];
99 py = vect[4] * vect[6];
102 xyzst[0] = xyzEnd[0] - vout[0];
103 xyzst[1] = xyzEnd[1] - vout[1];
104 xyzst[2] = xyzEnd[2] - vout[2];
106 cfnewp(ich, dpar0, xyzst, &
dp, parn, perig);
107 closePoint[0] = perig[0] + vout[0];
108 closePoint[1] = perig[1] + vout[1];
109 closePoint[2] = perig[2] + vout[2];