# Draw

**Draw:**

`Draw.Line(Min, Max, Color, thickness)`: Draws a straight line from `Min` to `Max`.

```lua
Draw.Line(Vector2(0, 0), Vector2(100, 100), Color(255, 0, 0, 255), 1)
```

`Draw.Rect(Min, Max, Color, rounding, thickness)`: Draws an outlined rectangle.

```lua
Draw.Rect(Vector2(0, 0), Vector2(100, 100), Color(255, 0, 0, 255), 0, 1)
```

`Draw.RectFilled(Min, Max, Color, rounding)`: Draws a filled rectangle.

```lua
Draw.RectFilled(Vector2(0, 0), Vector2(100, 100), Color(255, 0, 0, 255), 0)
```

`Draw.Text(Position, Color, font, style, text)`: Renders text at a screen position. `font` can be `"Default"`, `"Bold"`, `"Pixel"`, or `"FontAwesome"`. `style` can be `"Shadow"`, `"Outlined"`, or `"None"`.

```lua
Draw.Text(Vector2(100, 100), Color(255, 255, 255, 255), "Default", "Shadow", "Hello World")
```

`Draw.CalculateTextSize(font, text)`: Returns a `Vector2` representing the width and height of the given text in the given font. Useful for centering or anchoring text.

```lua
local size = Draw.CalculateTextSize("Default", "Hello World")
print(size.x, size.y)
```

`Draw.Circle(Center, radius, Color, segments, thickness)`: Draws an outlined circle.

```lua
Draw.Circle(Vector2(100, 100), 50, Color(255, 0, 0, 255), 32, 1)
```

`Draw.CircleFilled(Center, radius, Color, segments)`: Draws a filled circle.

```lua
Draw.CircleFilled(Vector2(100, 100), 50, Color(255, 0, 0, 255), 32)
```

`Draw.Triangle(P1, P2, P3, Color, thickness)`: Draws an outlined triangle from three screen-space points.

```lua
Draw.Triangle(Vector2(0, 0), Vector2(50, 100), Vector2(100, 0), Color(255, 0, 0, 255), 1)
```

`Draw.TriangleFilled(P1, P2, P3, Color)`: Draws a filled triangle.

```lua
Draw.TriangleFilled(Vector2(0, 0), Vector2(50, 100), Vector2(100, 0), Color(255, 0, 0, 255))
```

`Draw.Ngon(center, radius, Color, numSegments, thickness)`: Draws an outlined regular N-sided polygon.

```lua
Draw.Ngon(Vector2(200, 200), 40, Color(0, 255, 0, 255), 6, 1)
```

`Draw.NgonFilled(center, radius, Color, numSegments)`: Draws a filled regular N-sided polygon.

```lua
Draw.NgonFilled(Vector2(200, 200), 40, Color(0, 255, 0, 255), 6)
```

`Draw.BezierCubic(P1, P2, P3, P4, Color, thickness, numSegments)`: Draws a cubic Bezier curve through four control points.

```lua
Draw.BezierCubic(Vector2(0,0), Vector2(50,100), Vector2(100,100), Vector2(150,0), Color(255,255,0,255), 1, 0)
```

`Draw.Polyline(points, Color, thickness, closed)`: Draws a connected series of lines through a table of `Vector2` points. Pass `true` for `closed` to connect the last point back to the first.

```lua
local pts = { Vector2(0,0), Vector2(50,100), Vector2(100,0) }
Draw.Polyline(pts, Color(255, 0, 0, 255), 1, true)
```

`Draw.ConvexPolyFilled(points, Color)`: Draws a filled convex polygon from a table of `Vector2` points. The points must form a convex shape.

```lua
local pts = { Vector2(0,0), Vector2(50,100), Vector2(100,0) }
Draw.ConvexPolyFilled(pts, Color(255, 0, 0, 255))
```

`Draw.CalculatePartCorners(primitive)`: Takes a `Primitive` and returns a table with two sub-tables: `World` (8 `Vector3` world-space corners) and `Screen` (8 `Vector2` screen-space corners) of the part's bounding box. Useful for drawing 3D box ESP.

```lua
local corners = Draw.CalculatePartCorners(prim)
for i = 1, 8 do
    print(corners.Screen[i].x, corners.Screen[i].y)
end
```


---

# 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://yerba-1.gitbook.io/yerba-docs/api/draw.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.
