# Draw Line

This function block provides a platform for users to draw lines on an image by clicking with the mouse. It includes the ability to clear drawings and undo the last action.

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

`Image Any` The input image on which lines will be drawn.

`Calculate All Points` A boolean control that determines if all points on the line should be calculated when a line is drawn.

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

`Image Any` The modified image with drawn lines.

`Line Coordinates` The coordinates of the drawn lines, returned as a list.

`Angles` The angles of the drawn lines, calculated based on their slope.

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

`Press 'C'` To clear all lines from the image.

`Press 'U'` To undo the last drawn line.

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

`Interactive Drawing` Users can interactively draw lines by clicking on the image.

`Easy Clearing and Undoing` The ability to clear all drawings or undo the last action makes it easy to correct mistakes.

`Angle Calculation` The block computes and returns angles for each drawn line based on the direction.

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

1. **Connect Input Image**: Attach an image to the block through the `Image Any` input.
2. **Draw a Line**: Click on the image to draw a line at the clicked position. Each click defines a point of the line.
3. **Clear or Undo**: Use the keyboard:
   * Press `C` to clear all lines.
   * Press `U` to undo the last drawn line.
4. **Evaluate Output**: Run the block to retrieve the modified image, line coordinates, and angles of the drawn lines.

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

When evaluated, this block will show the updated image with drawn lines and provide details regarding their coordinates and angles.

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

<details>

<summary>Drawing Complex Shapes</summary>

To create complex shapes, draw multiple lines consecutively by clicking at distinct points on the image.

</details>

<details>

<summary>Utilize Undo Feature</summary>

If you make a mistake, make use of the `U` key to quickly remove the last line before completing your drawing.

</details>

<details>

<summary>Adjusting Line Thickness</summary>

You can modify the thickness of the lines by adjusting the `line_width` value in the code if you want thicker or thinner lines.

</details>

<details>

<summary>Reusable Coordinates</summary>

Keep track of the line coordinates; they can help draw the same lines later or for reference in another analysis.

</details>

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

<details>

<summary>No Image Displayed</summary>

If no image is displayed, ensure that a valid image has been connected to the input. The block requires an image to show the drawing interface.

</details>

<details>

<summary>Lines Not Visible</summary>

Ensure that the drawn lines are not overlapped by other elements. Draw lines on the desired visible areas of the image.

</details>
