Pookkalam by Abhinav Rajesh

Code

import math

# Constants
outside_flower = ["#FFD72F", "#fedde1"]
middle_color = ["#F62C2C", "#1D4B00"]
triangle_points = [point(0,75), point(-64.95, -37.5), point(64.95, -37.5)]

points = [
    (125/math.sqrt(2), 125/math.sqrt(2)),
    (125, 0),
    (125/math.sqrt(2), -125/math.sqrt(2)),
    (0, -125),
    (-125/math.sqrt(2), -125/math.sqrt(2)),
    (-125, 0),
    (-125/math.sqrt(2), 125/math.sqrt(2)),
]

# Utility functions
def getInnerFlower(fill_color):
    return rectangle(h=90, w=90, stroke_width=0, fill=fill_color)
    
def getOuterFlower():
    flower_petals = ellipse(fill="#FF4D00", stroke_width=0, w=200, h=40) | repeat(8, rotate(22.5))
    inner_flower = getInnerFlower(outside_flower[1])
    for i in range(1, 9):
        inner_flower += getInnerFlower(outside_flower[i%2]) | rotate(22.5 * i)
    return flower_petals + inner_flower | scale(1/4)

def getMiddleTriangles():
    middle_triangles = polygon(triangle_points, stroke_width=0, fill=middle_color[1]) 
    for i in range(8):
        middle_triangles += polygon(triangle_points, stroke_width=0, fill=middle_color[i%2]) | rotate(15*i)
    return middle_triangles

def getMiddleCircles(): 
    middle_circles = circle(r=37, fill="#8B9EFF", stroke_width=0) + circle(r=27, fill="#FFE98D", stroke_width=0) + circle(r=17,  fill="#5E0000", stroke_width=0) + (polygon(triangle_points, stroke_width=0, fill="ghostwhite") | scale(1/5)) + (polygon(triangle_points, stroke_width=0, fill="hotpink") | rotate(180) | scale(1/5))
    return middle_circles

# Assembling Pookkalam
middle_ellipse = ellipse(h=190, w=30, stroke="#FFD93C", stroke_width=2) | repeat(36, rotate(145))
outer_squares =  circle(r=110, fill="#FFE98D", stroke_width=0) + (rectangle(h=155, w=155, fill="#8B9EFF", stroke_width=0) | repeat(32, rotate(11.25)))
background = circle(r=125, fill="#5E0000", stroke_width=0)

middle = circle(r=75, fill="ghostwhite", stroke_width=0) + getMiddleTriangles() + getMiddleCircles()
layer_1 = background + outer_squares + circle(r=95, fill="#FF4D00", stroke_width=0) + middle_ellipse + middle    
flower_outer = getOuterFlower() 

flower_outer_group = flower_outer | translate(0, 125)

for i, j in points:
    flower_outer_group += flower_outer | translate(i, j)

pookkalam = layer_1 + flower_outer_group

# Display Pookkalam
show(pookkalam)