# Translate Shape

This function block moves geometric shapes by the specified horizontal and vertical offsets. Use it when you need to shift points, rectangles, circles or contours within your image coordinate space.

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

`Shape` A shape to translate. Accepted types:

* Single point (x, y)
* Rectangle defined by two corner points
* Circle defined by center\_x, center\_y, radius
* Contour (an ordered list/array of (x,y) points)

`X` Horizontal translation value (optional). Integer pixels to move the shape along X. Default is 0 if not provided.

`Y` Vertical translation value (optional). Integer pixels to move the shape along Y. Default is 0 if not provided.

(All above are input sockets.)

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

`Shape` The translated shape returned in the same format as the input (point, rectangle, circle, or contour).

(This is an output socket.)

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

This function block has no additional controls or widgets. Provide translations through the input sockets.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

* When executed, the block reads the provided shape and the optional `X` and `Y` translation values.
* Translations are applied as integer pixel offsets. Positive values move the shape right/down, negative values move it left/up.
* The block returns the same shape type shifted by the given offsets. For contours, each vertex is shifted by the same (X, Y) offset.
* If an unsupported shape type or invalid data is supplied, the block will indicate a configuration error — ensure the shape input matches one of the accepted formats.

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

* Supports common shape types: point, rectangle, circle and contour.
* Keeps output format identical to input format for seamless chaining.
* Simple integer-based translation for deterministic positioning.
* Works with single shapes or contour arrays for batch geometry transforms.

## 📝 Usage instructions <a href="#usage" id="usage"></a>

1. Provide a shape to the `Shape` socket (for example, the contour returned from a detector).
2. Provide horizontal shift to the `X` socket (optional).
3. Provide vertical shift to the `Y` socket (optional).
4. Read the translated shape from the output `Shape` socket and use it for drawing, measurement or further processing.

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

* Combine with detection and ROI blocks:
  * Use `Find Contour`, `Find Object`, or `Approximate Contour` to obtain shapes, then feed them into this block to align or offset results.
  * Use `Image ROI`, `Image ROI Select` or `Get ROI` to crop or focus on a region before translating shapes so coordinates remain consistent within a working region.
* Working with multiple shapes or lists:
  * Use `Batch Processing`, `Debatch` or `Batch Concatenation` to translate a list of shapes iteratively.
  * To draw translated results for visual verification, send the output to `Draw Point`, `Draw Rectangle` or `Draw Result On Image`.
* For measurement workflows:
  * After translating shapes, use `Measure Position Distance` to compute distances between moved and reference positions.
  * Use `Minimum Rectangle`, `Hull Convex` or `Contour to Image` to convert and compare geometric summaries after translation.
* Visualization and debugging:
  * To visualize translated contours or rectangles on images, route the translated shape into `Draw Rectangle` or `Draw Result On Image` and preview with `Show Image`.

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

* No change visible after translation:
  * Verify that non-zero values are provided to `X` or `Y`.
  * Ensure the drawing/display block (for example `Show Image` or `Draw Rectangle`) is receiving the translated shape and the same coordinate system is used.
* Unexpected shape format errors:
  * Confirm that the input shape conforms to one of the supported formats (point, rectangle, circle, or contour).
  * If working with lists, ensure they are provided through batch or list-compatible flow (use `Batch Processing` / `Debatch` as needed).
* Out-of-bounds shapes:
  * Translations can move shapes outside the image area. If that is a concern, clamp coordinates using downstream checks or crop the ROI before translation.


---

# 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/detections-shapes/shape-analysis/translate-shape.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.
