View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014887 | VTK | (No Category) | public | 2014-07-25 00:00 | 2014-10-02 15:53 | ||||
Reporter | Justin Hallet | ||||||||
Assigned To | Andy Bauer | ||||||||
Priority | high | Severity | minor | Reproducibility | have not tried | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | 6.0.0 | ||||||||
Target Version | Fixed in Version | 6.2.0 | |||||||
Summary | 0014887: vtkCellTreeLocator::FindCell causes redundant calculation of closest point | ||||||||
Description | Here is my patched code.... vtkIdType vtkCellTreeLocator::FindCell( double pos[3], double , vtkGenericCell *cell, double pcoords[3], double* weights ) { if( this->Tree == 0 ) { return -1; } // ADSK, JNH, closestPoint is redundant! double /*closestPoint[3],*/ dist2; int subId; const float _pos[3] = { static_cast<float>(pos[0]), static_cast<float>(pos[1]), static_cast<float>(pos[2]) }; vtkCellPointTraversal pt( *(this->Tree), _pos ); //bool found = false; while( const vtkCellTreeNode* n = pt.Next() ) { const unsigned int* begin = &(this->Tree->Leaves[n->Start()]); const unsigned int* end = begin + n->Size(); for( ; begin!=end; ++begin ) { this->DataSet->GetCell(*begin, cell); // ADSK, JNH, closestPoints is redundant! if( cell->EvaluatePosition(pos, 0 /*closestPoint*/, subId, pcoords, dist2, weights)==1 ) { return *begin; } } } return -1; } | ||||||||
Tags | hackaton | ||||||||
Project | TBD | ||||||||
Type | performance | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0033095) Justin Hallet (reporter) 2014-07-25 19:40 |
Actually the same speed up, optimization can be made to vtkCellLocator to. |
(0033097) Justin Hallet (reporter) 2014-07-25 20:58 |
Fix required to vtkLine, since closestPoint is optional (NULL), it should still calculate pcoords and weights. 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, 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; } } |
(0033537) Andy Bauer (developer) 2014-10-02 15:53 |
commit d21be2bd36ca75712c669477722cd9209b51aaa9 Author: Andrew Bauer <andy.bauer@kitware.com> Date: Thu Oct 2 13:58:20 2014 -0400 Making some cell locators more efficient. Skipping an unneeded calculation for finding the closest point since the result isn't being used. Also fixed the name of the file in vtkCellTreeLocator.*. Change-Id: Ia0f0ea70a0ab852d74c1dd116db4f374f021aead |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-07-25 00:00 | Justin Hallet | New Issue | |
2014-07-25 19:40 | Justin Hallet | Note Added: 0033095 | |
2014-07-25 20:58 | Justin Hallet | Note Added: 0033097 | |
2014-10-01 12:43 | Berk Geveci | Tag Attached: hackaton | |
2014-10-01 12:43 | Berk Geveci | Assigned To | => Berk Geveci |
2014-10-01 12:43 | Berk Geveci | Status | backlog => tabled |
2014-10-02 13:42 | Andy Bauer | Assigned To | Berk Geveci => Andy Bauer |
2014-10-02 13:42 | Andy Bauer | Status | tabled => backlog |
2014-10-02 13:54 | Andy Bauer | Status | backlog => active development |
2014-10-02 14:37 | Andy Bauer | Status | active development => gerrit review |
2014-10-02 15:53 | Andy Bauer | Note Added: 0033537 | |
2014-10-02 15:53 | Andy Bauer | Status | gerrit review => closed |
2014-10-02 15:53 | Andy Bauer | Resolution | open => fixed |
2014-10-02 15:53 | Andy Bauer | Fixed in Version | => 6.2.0 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |