rectangles module#
- compute_led_orientations(rects, width, height, led_diam=6.0, led_extra=2.0, clearance=0.25, rng=None)[source]#
Assign Rect.angle so Øled_diam + led_extra tail avoids edges/other LEDs. Coordinates are JITX (y-up).
- validate_led_layout(rects, width, height, led_diam=6.0, led_extra=2.0, clearance=0.25)[source]#
Return list of violations (empty if OK). Coordinates are JITX (y-up).
- mondrian_bsp(width=180.0, height=300.0, line_thickness=3.0, min_size=22.0, target_count=70, irregularity=0.35, avoid_align_eps=1.5, role_weights=None, colors=None, seed=None, snap_step=0.25, led_diam=6.0, led_extra=2.0, led_clearance=0.25, led_count=None)[source]#
Mondrian-ish BSP subdivision. Returns rectangles only, in JITX coords (y-up).
- Parameters:
width (
float) – Board width in mmheight (
float) – Board height in mmline_thickness (
float) – Thickness of lines between rectanglesmin_size (
float) – Minimum rectangle sizetarget_count (
int) – Target number of rectangles to generateirregularity (
float) – How irregular the splits should be (0.0-1.0)avoid_align_eps (
float) – Minimum distance between split linesrole_weights (
Optional[Dict[str,float]]) – Probability weights for rectangle roles (mask, void, led)colors (
Optional[Dict[str,str]]) – Colors for each role typesnap_step (
float) – Grid snapping step sizeled_diam (
float) – LED diameter for clearance calculationsled_extra (
float) – LED tail length for clearance calculationsled_clearance (
float) – Minimum clearance around LEDsled_count (
Optional[int]) – Exact number of LEDs to generate (if specified, overrides probability-based assignment)
- Return type:
- Returns:
List of Rect objects with assigned roles and orientations