29 Hep3Vector lineDir = vectLine;
32 Hep3Vector planeDir( plane.a(), plane.b(), plane.c() );
34 lineDir.setMag( 1.0 );
35 planeDir.setMag( 1.0 );
40 double distance, denominator;
42 denominator = planeDir.dot( lineDir );
44 if ( denominator != 0 )
47 distance = ( planeDir.dot( basePoint ) ) / denominator;
48 cross = linePoint + lineDir * distance;
64 Hep3Vector lineDir = vectLine;
67 Hep3Vector planeDir( plane.a(), plane.b(), plane.c() );
69 lineDir.setMag( 1.0 );
70 planeDir.setMag( 1.0 );
73 double distance, denominator;
75 denominator = planeDir.dot( lineDir );
76 if ( denominator != 0 )
78 distance = ( planeDir.dot( basePoint ) ) / denominator;
79 cross = linePoint + lineDir * distance;
83 double x0 = pLine.x();
84 double y0 = pLine.y();
85 double z0 = pLine.z();
87 double vx = vectLine.x();
88 double vy = vectLine.y();
89 double vz = vectLine.z();
91 double dx0 = pLineSigma.x();
92 double dy0 = pLineSigma.y();
93 double dz0 = pLineSigma.z();
95 double dvx = vectLineSigma.x();
96 double dvy = vectLineSigma.y();
97 double dvz = vectLineSigma.z();
99 double pa = plane.a();
100 double pb = plane.b();
101 double pc = plane.c();
103 double Const1 = planeDir.dot( planePoint );
104 double Const2 = pa * vx + pb * vy + pc * vz;
105 double Const3 = pa * x0 + pb * y0 + pc * z0;
107 double sigmaX_1 = dx0 * dx0 * ( pb * vy + pc * vz ) / Const2;
108 double sigmaX_2 = ( -1 ) * dy0 * dy0 * pb * vx / Const2;
109 double sigmaX_3 = ( -1 ) * dz0 * dz0 * pc * vx / Const2;
111 dvx * dvx * ( Const1 - Const3 ) * ( pb * vy + pc * vz ) / Const2 / Const2;
112 double sigmaX_5 = ( -1 ) * dvy * dvy * vx * ( Const1 - Const3 ) * pb / Const2 / Const2;
113 double sigmaX_6 = ( -1 ) * dvz * dvz * vx * ( Const1 - Const3 ) * pc / Const2 / Const2;
115 double sigmaX = sigmaX_1 + sigmaX_2 + sigmaX_3 + sigmaX_4 + sigmaX_5 + sigmaX_6;
117 double sigmaY_1 = ( -1 ) * dx0 * dx0 * pa * vy / Const2;
118 double sigmaY_2 = dy0 * dy0 * ( 1 - pb * vy / Const2 );
119 double sigmaY_3 = ( -1 ) * dz0 * dz0 * pc * vy / Const2;
120 double sigmaY_4 = ( -1 ) * dvx * dvx * ( Const1 - Const3 ) * pa * vy / Const2 / Const2;
122 dvy * dvy * ( Const1 - Const3 ) * ( pa * vx + pc * vz ) / Const2 / Const2;
123 double sigmaY_6 = ( -1 ) * dvz * dvz * ( Const1 - Const3 ) * pc * vy / Const2 / Const2;
125 double sigmaY = sigmaY_1 + sigmaY_2 + sigmaY_3 + sigmaY_4 + sigmaY_5 + sigmaY_6;
127 double sigmaZ_1 = ( -1 ) * dx0 * dx0 * pa * vz / Const2;
128 double sigmaZ_2 = ( -1 ) * dy0 * dy0 * pb * vz / Const2;
129 double sigmaZ_3 = dz0 * dz0 * ( 1 - pc * vz / Const2 );
130 double sigmaZ_4 = ( -1 ) * dvx * dvx * ( Const1 - Const3 ) * pa * vz / Const2 / Const2;
131 double sigmaZ_5 = ( -1 ) * dvy * dvy * ( Const1 - Const3 ) * pb * vz / Const2 / Const2;
133 dvz * dvz * ( Const1 - Const3 ) * ( pa * vx + pb * vy ) / Const2 / Const2;
135 double sigmaZ = sigmaZ_1 + sigmaZ_2 + sigmaZ_3 + sigmaZ_4 + sigmaZ_5 + sigmaZ_6;
147 const float b,
const float c,
158 Hep3Vector planeDir( plane.a(), plane.b(), plane.c() );
164 D = planeDir.dot( planePoint );
171 float b1 = B * b + A;
172 float c1 = B * c - D;
174 float b2sub4ac = b1 * b1 - 4 * a1 * c1;
178 float x1 = 0.0, x2 = 0.0, y1 = 0.0, y2 = 0.0, z1 = 0.0, z2 = 0.0;
179 if (
abs( a1 ) > 10E-10 )
183 x1 = ( -b1 + sqrt( b2sub4ac ) ) / ( 2 * a1 );
184 x2 = ( -b1 - sqrt( b2sub4ac ) ) / ( 2 * a1 );
185 y1 = a * x1 * x1 + b * x1 + c;
186 y2 = a * x2 * x2 + b * x2 + c;
189 cross1.set( x1, y1, z1 );
190 cross2.set( x2, y2, z2 );
196 cross1.set( -9999, -9999, -9999 );
197 cross2.set( -9999, -9999, -9999 );
204 y1 = a * x1 * x1 + b * x1 + c;
206 cross1.set( x1, y1, z1 );
207 cross2.set( x1, y1, z1 );
214 const float vy,
const float y0,
216 const float b,
const float c,
227 Hep3Vector planeDir( plane.a(), plane.b(), plane.c() );
233 D = planeDir.dot( planePoint );
237 float a1 = ( B +
C / vy ) * a;
238 float b1 = ( B +
C / vy ) * b + A;
239 float c1 = ( B +
C / vy ) * c -
C / y0 - D;
241 float b2sub4ac = b1 * b1 - 4 * a1 * c1;
243 float x1, x2, y1, y2, z1, z2;
244 if (
abs( a1 ) > 10E-10 )
248 x1 = ( -b1 + sqrt( b2sub4ac ) ) / ( 2 * a1 );
249 x2 = ( -b1 - sqrt( b2sub4ac ) ) / ( 2 * a1 );
250 y1 = a * x1 * x1 + b * x1 + c;
251 y2 = a * x2 * x2 + b * x2 + c;
252 z1 = ( y1 - y0 ) / vy;
253 z2 = ( y2 - y0 ) / vy;
256 cross1.set( x1, y1, z1 );
257 cross2.set( x2, y2, z2 );
263 cross1.set( -9999, -9999, -9999 );
264 cross2.set( -9999, -9999, -9999 );
271 y1 = a * x1 * x1 + b * x1 + c;
272 z1 = ( y1 - y0 ) / vy;
274 cross1.set( x1, y1, z1 );
275 cross2.set( x1, y1, z1 );
bool GetIntersectionQuadPlane(const HepPoint3D pLine, const float vy, const float y0, const float a, const float b, const float c, const HepPlane3D plane, HepPoint3D &cross1, HepPoint3D &cross2)
bool GetIntersectionLinePlane(const HepPoint3D pLine, const Hep3Vector vectLine, const HepPlane3D plane, HepPoint3D &cross)
Get intersection of a line and a plane.
bool GetIntersectionQuadPlaneLocal(const int part, const int orient, const float a, const float b, const float c, const HepPlane3D plane, HepPoint3D &cross1, HepPoint3D &cross2)
bool GetIntersectionLinePlaneWithSigma(const HepPoint3D pLine, const Hep3Vector vectLine, const HepPoint3D pLineSigma, const Hep3Vector vectLineSigma, const HepPlane3D plane, HepPoint3D &cross, HepPoint3D &crossSigma)