MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / build2d

Method build2d

src/main/java/marc/math/Flann.java:148–165  ·  view source on GitHub ↗
(List<T> d, Function<T, Vec2> t)

Source from the content-addressed store, hash-verified

146 }
147
148 public <T> Flann build2d(List<T> d, Function<T, Vec2> t) {
149 free();
150
151 FloatBuffer f = (allocated == null || allocated.capacity() != d.size() * 2) ? ByteBuffer.allocateDirect(
152 4 * d.size() * 2)
153 .order(ByteOrder.nativeOrder())
154 .asFloatBuffer() : allocated;
155 for (T dd : d) {
156 Vec2 v = t.apply(dd);
157 f.put((float) v.x).put((float) v.y);
158 }
159 f.rewind();
160 cloud = build2(f, d.size());
161 is2d = true;
162 allocated = f;
163
164 return this;
165 }
166
167 public List<Integer> find3(Vec3 p, int n) {
168 if (cache == null || cache.capacity() < n) {

Callers

nothing calls this directly

Calls 6

freeMethod · 0.95
build2Method · 0.95
applyMethod · 0.65
sizeMethod · 0.45
orderMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected