The maximal distance possible between the query point and the edge of the given rectangle farthest from the point. @param p the query point @param r the rectangle compute the distance to @return the maximum distance from the point to the rectangle
(Vec p, Rectangle r)
| 933 | * @return the maximum distance from the point to the rectangle |
| 934 | */ |
| 935 | @SuppressWarnings("unused") |
| 936 | private double maxDist(Vec p, Rectangle r) |
| 937 | { |
| 938 | if(r.contains(p)) |
| 939 | return 0; |
| 940 | //set up vector |
| 941 | for(int i = 0; i < dim; i++) |
| 942 | { |
| 943 | double pi = p.get(i); |
| 944 | double si = r.lB.get(i); |
| 945 | double ti = r.uB.get(i); |
| 946 | |
| 947 | if(pi < si) |
| 948 | dcScratch.set(i, ti); |
| 949 | else if(pi > ti) |
| 950 | dcScratch.set(i, si); |
| 951 | else |
| 952 | dcScratch.set(i, pi); |
| 953 | } |
| 954 | |
| 955 | return dm.dist(p, dcScratch); |
| 956 | } |
| 957 | |
| 958 | public static class RTreeFactory<V extends Vec> implements VectorCollectionFactory<V> |
| 959 | { |