---
name: Rect
lang: cpp
domain: core
version: "0.1.0"
algebraic: product
definition: "struct Rect { float x, y, w, h; }"
description: "Rectangulo axis-aligned de floats (x, y, w, h). Usado por sprite_batch, tilemap, hit-tests y AABB queries del stack gamedev (issue 0072b)."
tags: [gamedev, math, 2d, primitive, aabb]
uses_types:
  - Vec2_cpp_core
file_path: "cpp/functions/core/math2d.h"
examples: |
  Rect r{10.0f, 20.0f, 100.0f, 50.0f};
  Vec2 c = r.center();
  bool inside = r.contains({50.0f, 30.0f});
  bool hit = r.overlaps(other);
notes: |
  - Helpers: `right()`, `bottom()`, `center()`, `min()`, `max()`.
  - `overlaps()` es AABB intersection (no-touch = no-overlap).
  - `contains()` usa half-open `[x, x+w)` como ImGui / texture coords.
---

# Rect

Rectangulo axis-aligned usado para sprites, hit-tests, AABB queries y tilemaps.
