The minium distance from a query point to the given rectangle @param p the query point @param r the rectangle compute the distance to @return the minimum distance from the point to the rectangle
(Vec p, Rectangle r)
| 861 | * @return the minimum distance from the point to the rectangle |
| 862 | */ |
| 863 | private double minDist(Vec p, Rectangle r) |
| 864 | { |
| 865 | if(r.contains(p)) |
| 866 | return 0; |
| 867 | //Set up sctach vector |
| 868 | for(int i = 0; i < dim; i++) |
| 869 | { |
| 870 | double pi = p.get(i); |
| 871 | if(pi <r.lB.get(i)) |
| 872 | dcScratch.set(i, r.lB.get(i)); |
| 873 | else if(pi > r.uB.get(i)) |
| 874 | dcScratch.set(i, r.uB.get(i)); |
| 875 | else |
| 876 | dcScratch.set(i, pi); |
| 877 | } |
| 878 | |
| 879 | return dm.dist(p, dcScratch); |
| 880 | } |
| 881 | |
| 882 | /** |
| 883 | * The minimum of the maximum possible distance from the query to the rectangle |