-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
31 lines (25 loc) · 825 Bytes
/
Copy pathutils.py
File metadata and controls
31 lines (25 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
AlponaGen v1
---------------------
Fractal based mathematical generation of alpona/mandala style images
Author: Aritro Shome
Date: 2025-10-09
"""
import os
import random
import numpy as np
def ensure_dir(path: str):
"""Ensure the output directory exists."""
if not os.path.exists(path):
os.makedirs(path)
# def random_color(palette=None):
# """Return a random color from a palette or RGB if none provided."""
# if palette:
# return random.choice(palette)
# return tuple(np.random.randint(0, 256, 3))
def lerp(a, b, t):
"""Linear interpolation between a and b by factor t."""
return a + (b - a) * t
def get_line_width(is_filled):
"""Returns a line width to draw the shapes of the current layer."""
return random.randint(1, 2) if is_filled else random.randint(2, 4)