# Measure Position Distance

This function block calculates the horizontal, vertical and straight-line distance between two image positions. Use it when you need pixel-level spacing information between two points (format: (x, y)).

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Point` First position (x, y) to compare.\
`Point` Second position (x, y) to compare.

(hint: both inputs accept a single coordinate pair. Provide the two positions in the order you want measured.)

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`X Distance` Horizontal difference between the two positions (absolute value, pixels).\
`Y Distance` Vertical difference between the two positions (absolute value, pixels).\
`Distance` Euclidean distance between the two positions (pixels).

## 🕹️ Controls <a href="#controls" id="controls"></a>

This block has no interactive controls or sliders — it simply computes distances from the provided inputs.

## 🎯 Features <a href="#features" id="features"></a>

* Straightforward distance calculation in image pixel coordinates.
* Returns both axis-wise distances and the combined Euclidean distance for easy downstream use.
* Works with results produced by detection and annotation blocks (centers, landmark points, etc.).

## 📝 How to use <a href="#usage" id="usage"></a>

1. Provide the first coordinate pair to the first `Point` input.
2. Provide the second coordinate pair to the second `Point` input.
3. Read results from the three outputs: `X Distance`, `Y Distance`, and `Distance`.
4. Use outputs directly for visualization, logic decisions, logging or export.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When evaluated, the block computes the absolute difference on X and Y axes and the Euclidean distance between the two provided positions, then outputs these numeric values.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* If you need coordinates from automatic detectors, combine with `Find Object` or `Object Detection` / `Object Detection - Custom` to obtain object centers, then feed those centers into this block.
* For tracked objects over time, use `Object_Detection_Tracker` to get position lists and measure distances between tracked IDs.
* Visualize results by connecting outputs to `Draw Point` or `Draw Line` (to draw the measured segment) and show the annotated image with `Show Image`.
* Plot live numeric values (for example distance over time) by sending the `Distance` output to `Scope`.
* To measure distances inside a cropped region, crop first with `Image ROI` or `Image ROI Select` and then feed coordinates in local ROI space.
* If you need to compare distances between two found objects directly, consider pairing this block with `Measure Object Distance` for higher-level object-based workflows.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* If distances look incorrect, confirm both inputs are valid `(x, y)` pairs and that they use the same coordinate system (full image vs. cropped ROI).
* If one input is missing, the block cannot compute meaningful distances — ensure both inputs are connected or guarded with blocks like `Is None` / `Replace None` in larger flows.
* Remember results are in pixels. Convert to real-world units externally if you have a calibration or scale factor.


---

# 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://docs.augelab.com/function-blocks/image-transformations/analysis/measure-position-distance.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.
