------------------------------------------------------------------------------
| 582 | |
| 583 | //------------------------------------------------------------------------------ |
| 584 | int vtkOctreePointLocator::FindClosestPointInRegion_( |
| 585 | int leafNodeId, double x, double y, double z, double& dist2) |
| 586 | { |
| 587 | int minId = 0; |
| 588 | |
| 589 | float fx = static_cast<float>(x); |
| 590 | float fy = static_cast<float>(y); |
| 591 | float fz = static_cast<float>(z); |
| 592 | |
| 593 | float minDistance2 = 4 * this->MaxWidth * this->MaxWidth; |
| 594 | |
| 595 | int idx = this->LeafNodeList[leafNodeId]->GetMinID(); |
| 596 | |
| 597 | float* candidate = this->LocatorPoints + (idx * 3); |
| 598 | |
| 599 | int numPoints = this->LeafNodeList[leafNodeId]->GetNumberOfPoints(); |
| 600 | for (int i = 0; i < numPoints; i++) |
| 601 | { |
| 602 | float diffx = fx - candidate[0]; |
| 603 | float diffy = fy - candidate[1]; |
| 604 | float diffz = fz - candidate[2]; |
| 605 | float dxyz = diffx * diffx + diffy * diffy + diffz * diffz; |
| 606 | if (dxyz < minDistance2) |
| 607 | { |
| 608 | minId = idx + i; |
| 609 | minDistance2 = dxyz; |
| 610 | if (dxyz == 0.0) |
| 611 | { |
| 612 | break; |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | candidate += 3; |
| 617 | } |
| 618 | |
| 619 | dist2 = minDistance2; |
| 620 | |
| 621 | return minId; |
| 622 | } |
| 623 | |
| 624 | //------------------------------------------------------------------------------ |
| 625 | int vtkOctreePointLocator::FindClosestPointInSphere( |
no test coverage detected