# 3.9.2: Closest Points

Assume you have two sets of points: say **“P”** and **“C”**. Further imagine you want to have a network that connects each point of the first set with a predefined number of its nearest neighbors in the second set (input **“N”**) or to points in set two that lie within a given distance **“LDist”**. In that case the “Nearest Neighbor”-component will be the right choice (see fig. 3.9.2.1). It outputs at **“P”** a data tree with branches containing the points of set **“C”** which are closest to the **“P”**-points. The order of branches corresponds to the points in **“P”**. The output **“i”** returns the indexes of the nodes in **“C”**, and **“D”** the distances.

![Fig. 3.9.2.1: A grid of points where each point connects to one or two of its nearest neighbors](/files/-MCkE_rLBK9Fq4gB3LWq)

{% file src="/files/E2YSBftBcLAhMKsFzXXB" %}

{% file src="/files/EsboWYUGJg4ip1wJCw76" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.karamba3d.com/3-in-depth-component-reference/3.8-utilities/3.8.2-closest-points.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
