| 165 | } |
| 166 | |
| 167 | public List<Integer> find3(Vec3 p, int n) { |
| 168 | if (cache == null || cache.capacity() < n) { |
| 169 | cache = ByteBuffer.allocateDirect(8 * n).order(ByteOrder.nativeOrder()).asLongBuffer(); |
| 170 | } |
| 171 | |
| 172 | if (cloud == -1 || is2d) throw new IllegalArgumentException(); |
| 173 | |
| 174 | |
| 175 | closestN3(cloud, (float) p.x, (float) p.y, (float) p.z, cache, n); |
| 176 | |
| 177 | List<Integer> r = new ArrayList<Integer>(n); |
| 178 | for (int i = 0; i < n; i++) { |
| 179 | r.add((int) cache.get(i)); |
| 180 | } |
| 181 | return r; |
| 182 | } |
| 183 | |
| 184 | public int[] find3(Vec3 p, int n, int[] r) { |
| 185 | if (cache == null || cache.capacity() < n) { |