| 1496 | } |
| 1497 | |
| 1498 | bool MeshAlgorithm::NearestPointFromPoint( |
| 1499 | const Base::Vector3f& rclPt, |
| 1500 | FacetIndex& rclResFacetIndex, |
| 1501 | Base::Vector3f& rclResPoint |
| 1502 | ) const |
| 1503 | { |
| 1504 | if (_rclMesh.CountFacets() == 0) { |
| 1505 | return false; |
| 1506 | } |
| 1507 | |
| 1508 | // calc each facet |
| 1509 | float fMinDist = std::numeric_limits<float>::max(); |
| 1510 | FacetIndex ulInd = FACET_INDEX_MAX; |
| 1511 | MeshFacetIterator pF(_rclMesh); |
| 1512 | for (pF.Init(); pF.More(); pF.Next()) { |
| 1513 | float fDist = pF->DistanceToPoint(rclPt); |
| 1514 | if (fDist < fMinDist) { |
| 1515 | fMinDist = fDist; |
| 1516 | ulInd = pF.Position(); |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | MeshGeomFacet rclSFacet = _rclMesh.GetFacet(ulInd); |
| 1521 | rclSFacet.DistanceToPoint(rclPt, rclResPoint); |
| 1522 | rclResFacetIndex = ulInd; |
| 1523 | |
| 1524 | return true; |
| 1525 | } |
| 1526 | |
| 1527 | bool MeshAlgorithm::NearestPointFromPoint( |
| 1528 | const Base::Vector3f& rclPt, |
nothing calls this directly
no test coverage detected