MCPcopy Index your code
hub / github.com/VolmitSoftware/Adapt / closest

Method closest

src/main/java/com/volmit/adapt/util/Direction.java:103–118  ·  view source on GitHub ↗
(Vector v)

Source from the content-addressed store, hash-verified

101 }
102
103 public static Direction closest(Vector v) {
104 double m = Double.MAX_VALUE;
105 Direction s = null;
106
107 for (Direction i : values()) {
108 Vector x = i.toVector();
109 double g = x.dot(v);
110
111 if (g < m) {
112 m = g;
113 s = i;
114 }
115 }
116
117 return s;
118 }
119
120 public static Direction closest(Vector v, Direction... d) {
121 double m = Double.MAX_VALUE;

Callers

nothing calls this directly

Calls 3

toVectorMethod · 0.45
dotMethod · 0.45
distanceMethod · 0.45

Tested by

no test coverage detected