vtkLine::EvaluatePosition can be called with NULL (closetPoint)
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Changes to use local cp when closestPoint is null -
int vtkLine::EvaluatePosition(double x[3], double* closestPoint, int& subId, double pcoords[3], double& dist2, double *weights) { double a1[3], a2[3];
subId = 0; pcoords[0] = pcoords[1] = pcoords[2] = 0.0;
this->Points->GetPoint(0, a1); this->Points->GetPoint(1, a2);
// ADSK, JNH, calculate pcoords & weights regardless of closestPoint double cp[3]; // DistanceToLine sets pcoords[0] to a value t, 0 <= t <= 1 dist2 = this->DistanceToLine(x,a1,a2,pcoords[0],cp); if (closestPoint) { closestPoint[0]=cp[0]; closestPoint[1]=cp[1]; closestPoint[2]=cp[2]; }
// pcoords[0] == t, need weights to be 1-t and t weights[0] = 1.0 - pcoords[0]; weights[1] = pcoords[0];
if ( pcoords[0] < 0.0 || pcoords[0] > 1.0 ) { return 0; } else { return 1; } }