MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / minDist

Method minDist

JSAT/src/jsat/linear/vectorcollection/RTree.java:863–880  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

searchMethod · 0.95

Calls 4

distMethod · 0.65
containsMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected