Pookkalam by Sudev Suresh Sreedevi

Code

import math
def part_of_ellips(w, h, theta):
    return point(math.sin(theta)*(w), math.cos(theta)*h)

jamanthi = color(223, 174, 10)
rosapoo = color(161, 23, 21)
mullappoo = color(207, 195, 137)
pachela = color(21, 42, 3)
vadaamalli = color(85, 47, 99)
bendi = color(193, 80, 13)

# Outer Border Rings
outerYellow = Circle(fill=jamanthi, stroke="transparent", radius=150)
outerRed = Circle(fill=rosapoo, stroke="transparent", radius=142)

# Chains of rings
chainRingUnitOffset = Point(x=94, y=0)
chainRingUnit = Circle(center=chainRingUnitOffset, radius=48, fill=vadaamalli, stroke="transparent")\
    + Circle(center=chainRingUnitOffset, radius=40, fill=jamanthi, stroke="transparent")\
    + Circle(center=chainRingUnitOffset, radius=32, fill=pachela, stroke="transparent")\
    + Circle(center=chainRingUnitOffset, radius=24,
             fill=mullappoo, stroke="transparent")
chainRing = chainRingUnit | repeat(12, rotate(360/12))

# Chains of rings semicircle
points = [point(0, 0)]

w = 48  # Width of ellipse
h = 48  # Height of ellipse
part = 0.5  # 1 => full ellipse, 0.25 => quarter and so on

step = 0.005  # Increase to make ellipse smoother (will take more time)

i = 0
while i < (3.14*(part*2)):
    points.append(part_of_ellips(w, h, i))
    i = i+step  # Step size

semi = polygon(points, fill=vadaamalli, stroke="transparent") + \
    (polygon(points, fill=jamanthi, stroke="transparent") | scale(0.833)) + \
    (polygon(points, fill=pachela, stroke="transparent") | scale(0.666)) + \
    (polygon(points, fill=mullappoo, stroke="transparent")
     | scale(0.5)) | Rotate(-90) | Translate(94, 0)

# Inner Red Cricle
innerRed = Circle(fill=rosapoo, stroke="transparent", radius=96)

# Orange Star
orangeStarUnit = Rectangle(
    width=136, height=136, fill=bendi, stroke="transparent")
orangeStar = orangeStarUnit | repeat(2, rotate(45))

# Yellow Star
yellowStarUnit = Rectangle(
    width=120, height=120, fill=jamanthi, stroke="transparent")
yellowStar = yellowStarUnit | repeat(2, rotate(45))

# White Star
whiteStarUnit = Rectangle(
    width=104, height=104, fill=mullappoo, stroke="transparent")
whiteStar = whiteStarUnit | repeat(2, rotate(45))

# Purple Star
purpleStarUnit = Rectangle(
    width=88, height=88, fill=vadaamalli, stroke="transparent")
purpleStar = purpleStarUnit | repeat(2, rotate(45))

# Green Circle
innerGreen = Circle(stroke="transparent", fill=pachela, radius=44)

# Interlocking Orange star
p1 = point(x=-30, y=22)
p2 = point(x=-22, y=22)
p3 = point(x=-30, y=14)
orangeTriangle1 = polygon([p1, p2, p3], fill=bendi, stroke="transparent")
orangeRect = Rectangle(
    width=30,
    height=8,
    center=Point(-15, 26), fill=bendi, stroke="transparent")
p4 = point(x=0, y=30)
p5 = point(x=0, y=22)
p6 = point(x=8, y=22)
orangeTriangle2 = polygon([p4, p5, p6], fill=bendi, stroke="transparent")
orangeHook = orangeTriangle1 + orangeRect + orangeTriangle2
orangeInterlock = orangeHook | Repeat(4, rotate(90))

# Interlocking Yellow Star
q1 = point(x=-30, y=22)
q2 = point(x=-22, y=22)
q3 = point(x=-30, y=14)
yellowTriangle1 = polygon(
    [q1, q2, q3], fill=jamanthi, stroke="transparent") | Translate(0, 0.5)
yellowRect = Rectangle(
    width=30,
    height=8,
    center=Point(-15, 26), fill=jamanthi, stroke="transparent")
q4 = point(x=0, y=30)
q5 = point(x=0, y=22)
q6 = point(x=8, y=22)
yellowTriangle2 = polygon(
    [q4, q5, q6], fill=jamanthi, stroke="transparent") | Translate(-0.5, 0)
yellowHook = yellowTriangle1 + yellowRect + yellowTriangle2 | Rotate(45)
yellowInterlock = yellowHook | Repeat(4, rotate(90))

# Centre pottu
pottuBorder = Circle(radius=16, fill=mullappoo, stroke="transparent")
pottuCentre = Circle(radius=8, fill=rosapoo, stroke="transparent")
pottu = pottuBorder + pottuCentre
show(outerYellow, outerRed,
                chainRing, semi, innerRed, orangeStar, yellowStar, whiteStar, purpleStar, innerGreen, orangeInterlock, yellowInterlock, pottu)