Pookkalam by Nithi Santhosh

Code

import math

def triangle(x1,y1,x2,y2,x3,y3,f):
    p1=point(x=x1, y=y1)
    p2=point(x=x2,y=y2)
    p3=point(x=x3,y=y3)
    return polygon([p1,p2,p3], fill =f,stroke = "none" )

bg = rectangle(w=300,h=300, fill = "black")
show(bg)
c1= circle(r=150) 
des1 = ellipse(w=60,h=300,fill="#800000",stroke_width=0.3)+ ellipse(w=60,h=280,fill="#DC143C",stroke_width=0.3) +ellipse(w=60,h=260,fill="#FF4500",stroke_width=0.3)+ellipse(w=40,h=240,fill="#FF8C00",stroke_width=0.3)+ellipse(w=60,h=220,fill="YELLOW",stroke_width=0.3)
des2 = des1 | repeat(30,rotate(24))
cc = circle(x=125,y=0,r=25,fill = "#FFFF00",stroke="green")+ circle(x=125,y=0,r=18,fill = "#FF4500",stroke="none") +circle(x=125,y=0,r=12,fill = "#8B0000",stroke="none") 
cc1 = cc | repeat(27,rotate(13.2))

c2= circle(r=100,fill = "white",stroke = "none")
col = color(r=0,g= 77,b= 0, a=0.8)
s = triangle(0,100,50,50,-50,50,col)
tri = s | repeat(18,rotate(20))

c3 = circle(r=75,fill="#F0FFFF",stroke = "#87CEFA", stroke_width =4) |repeat(60, rotate(5)|scale(0.92))

show (c1,des2,c2,tri,c3)


#theme: maaveli and kerala scenery
#Umberalla
umb = (ellipse(w=100,h=80,fill="#8B4513") |repeat(60, rotate(5)|scale(0.92))) | rotate(140)
umb_1 =  umb| translate(x=42.5,y=32)
hndl = (line(x1=40,y1=0,x2=-40,y2=0,stroke ="#8B4513",stroke_width = 4)| rotate(60)) |translate(x=37.5,y=5)


#semi-circle
def semiconstructor(rad,xco,yco,colo):
        def part_of_circle(r,theta):
            return point(math.sin(theta)*r,math.cos(theta)*r)
        points = [point(0,0)]
        r = rad
        part = 0.5 
        step = 0.01  
        i = 0.00
        while i < 3.14*2*(part):
            points.append(part_of_circle(r,i))
            i = i+step 
        return polygon(points,fill=colo)  | rotate(90) | translate ( x=xco, y= yco)


#face
face = circle(x= 22.5,y= 24,r=22.5,fill = "#FFDEAD",stroke_width=0.5)
p_1=point(x=0, y=0)
p_2=point(x=-15,y=3)
p_3=point(x=-5,y=-6)
p22=point(x=15,y=3)
p33=point(x=5,y=-6)
eye = ((circle(x=5,y=0,r=2,fill = "black") + circle(x=-5,y=0,r=2,fill="black"))|rotate(-13))|translate(x=22,y=20)
mush=polygon([p_1,p_2,p_3], fill ="black" ) + polygon([p_1,p22,p33], fill ="black" )
mush_f = (mush | rotate(-13))|translate(x=21,y=14)
lip = (semiconstructor(5,0,0,"orange") | rotate(180))| translate(x=21,y=14)


#crown
p1=point(x=2.5, y=24)
p2=point(x=-2.5,y=24)
p3=point(x=0,y=29)
s=polygon([p1,p2,p3], fill ="#FFD700",stroke = "#FFD700" )
tri = (s | repeat(50,rotate(10))) | translate(x= 23.5,y= 32)
crown = circle(r=24, stroke = "#FFD700",stroke_width=3.5) | translate(x= 23.5,y= 32)
  
crown1 = (semiconstructor(22.5,0,0,"#FFD700") + (circle(x=-18,y=4.5,r=2, fill="#006400") | repeat(6,translate(7)))| rotate(-13)) | translate(x= 22.5,y= 26)  
    
#body
stmh = circle(x=10,y=-32,r=40,fill = "#FFD700",stroke_width = 0.5) + (ellipse(x=14,y=-30,w=74,h=80,fill = "#FFFFF0",stroke_width = 0.5) | rotate(-13))+ (ellipse(x=14,y=-32,w=50,h=80,fill = "#FFD700",stroke_width = 0.5) | rotate(-13))+ (ellipse(x=14,y=-32,w=40,h=80,fill = "#FFDEAD",stroke_width = 0.5) | rotate(-13))
d1=point(x=0,y=0)
d2=point(x=-5,y=45)
d3=point(x=5,y=45)
dhoti =( (semiconstructor(40,0,0,"#FF4500")+semiconstructor(40,0,5,"ORANGE") +polygon([d1,d2,d3],fill = "#FF4500"))| rotate(167))| translate(x=10,y=-34)

#hair
hair = circle(x= 21.5,y= 15,r=25,fill = "black",stroke_width=0.5)

#boat
b1=point(x=0,y=0)
b2=point(x=-50,y=0)
b3=point(x=-60,y=50)
b4=point(x=-45,y=20)
b5=point(x=-53,y=25)
b6=point(x=-45,y=10)
boat1=((polygon([b1,b2,b3,b4,b5,b6],fill ="#8B4513")|translate(x=5,y=-30) )|rotate(-10))|scale(1.5)
boat2 = (polygon([b1,b2,b3,b4,b5,b6],fill ="#8B4513")|translate(x=-10,y=-50)|rotate(-3))

#sun
sun=(circle(r=20,fill="yellow",stroke="orange",stroke_width=2)|repeat(60, rotate(5)|scale(0.92)))|translate(x=-40,y=25)

#hand
h1=point(x=0,y=5)
h2=point(x=20,y=10)
h3=point(x=30,y=0)
h4=point(x=25,y=-10)
h5=point(x=0,y=-5)
h6=point(x=-5,y=-10)
h7=point(x=-10,y=-5)
h8=point(x=-10,y=5)
h9=point(x=-5,y=10)
hand = (polygon([h1,h2,h3,h4,h5,h6,h7,h8,h9],fill="#FFDEAD")|rotate(-20))|translate(x=30,y=-20)


show(umb_1,tri,crown,hair,boat1,boat2,sun,stmh,dhoti,face,lip,mush_f,eye, crown1,hndl,hand)