# 3.9.3: Closest Points Multi-dimensional

![Fig. 3.9.3.1: Random points in a unit volume connected to their nearest neighbor in a 5-D setting](/files/-MCkEYy-cmJMgu2wvEM5)

A nearest neighbor search can be generalized to any number of dimensions. Use the **“Closest Point Multi-Dimensional”**-component in case of more than three. Fig. 3.9.3.1 shows an example with five dimensions: Dimensions one to three represent space. Dimension four is the shortest distance between each point and the thick red guide line. The curve parameter of the guide line at the point where it meets the line of shortest distance acts as fifth dimension. Each of the randomly generated points is connected with its nearest neighbor. One can see from fig. 3.9.3.1 that the resulting line segments align to the guide curve – in some way.

There are three input-plugs on the component:

|         |                                                                                                                                                                                            |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **"P"** | Expects a data tree, where each branch contains n values which are the coordinates of the points. The **“P”**-input specifies points where nearest neighbor connections can start.         |
| **"C"** | Expects the same sort of input as **“P”**. It contains the points where nearest neighbor connections can end.                                                                              |
| **"N"** | number of nearest neighbor connections to be generated for each point in **“P”.** The output **“i”** of the **“Multi-dimensional Nearest Neighbors”**-component is a connectivity diagram. |

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


---

# 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.3-closest-points-multi-dimensional.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.
