Pookkalam by VAISHAKH V

Code

#vaishakh v S4EB NSSCE PALAKKAD


#all details in fig matter
#outer muticolor

co1 = circle(r=157,stroke=color(255,250,250,.7),fill=color(139,0,139),stroke_width=3)
co2 = circle(r=145,stroke="none",fill=color(255,0,255))
co3 = circle(r=140,stroke="none",fill=color(0,255,255))
co=combine([co1,co2,co3])

ie1=ellipse(w=2,h=200,x=0,y=0,fill="Fuchsia",stroke="none",stroke_width=1)|repeat(180,rotate(1))

ode11=circle(r=3.7,x=150,y=0,fill="GreenYellow",stroke="#F775B0",stroke_width=2)|repeat(12,rotate(30))
ode1=ode11|rotate(15)
ode2=circle(r=3.7,x=137,y=0,fill="Yellow",stroke="none",stroke_width=2)|repeat(12,rotate(30))

or1 = rectangle(w=209,h=209,fill="#a30800",stroke="#a30800")|repeat(50,rotate(60))
or2 = rectangle(w=194,h=194,fill="red",stroke="red")|rotate(15)|repeat(30,rotate(50))
or3 = rectangle(w=178,h=178,fill="orange",stroke="orange")|rotate(20)|repeat(30,rotate(50))
or4 = rectangle(w=164,h=164,fill="yellow",stroke="yellow")|rotate(15)|repeat(30,rotate(50))
or5 = rectangle(w=151,h=151,fill="white",stroke="white")|rotate(20)|repeat(30,rotate(50))
otf=combine([co,or1,or2,or3,or4,or5,ie1,ode1,ode2])
#show(otf)

#------------------------------------------------------------------------------
# middle 

crc=[]
R=55
crf=85
ro=45
#def
cb=circle(r=R-0,x=crf,y=0,fill="#F2030F", stroke="none")
co=circle(r=R-10,x=crf,y=0,fill="#E9821B", stroke="none")
cy=circle(r=R-20,x=crf,y=0,fill="#FEE519", stroke="none")
cg=circle(r=R-30,x=crf,y=0,fill="#228B22", stroke="none")
cw=circle(r=R-40,x=crf,y=0,fill="white", stroke="none")

ode=circle(r=5,x=149,y=0,fill="PeachPuff",stroke="#F775B0",stroke_width=2.5)|repeat(11,rotate(30))

shp=combine([cb,co,cy,cg,cw])
shpf=shp|repeat(10,rotate(35))|scale(.7)|rotate(360)


       
out=shpf
#show(out)

# --------------------------------------------------------------------------------
# head ring
# TRIANGLE
def tri(side,x,y,fil,rot):
    s=polygon([point(-1*(side/2),side/2),point((side/2),side/2),point((0),side*1.118033989)],fill=fil,stroke="none") |rotate(rot)| translate(x,y)
    return s

# star
def star(s,x,y,clr):
    tr1=tri(s,0,0,clr,0)
    tr2=tri(s,0,0,clr,180)|translate(0,s+4)
    tre=combine([tr1,tr2])|translate(x,y)
    return tre

# kathakali circles head
c1 = circle(x=0,y =0,r=100,fill="orange",stroke="orange")
c2 = circle(x=0,y =0,r=80,fill="#06AF57",stroke="#06AF57")
c3 = circle(x=0,y =0,r=75,fill="red",stroke="red")
c4 = circle(x=0,y =0,r=70,fill="#FFFFFF",stroke="#FFFFFF")
c5 = circle(x=0,y =0,r=55,fill="#A2CD39",stroke="#A2CD39")
c6 = circle(x=0,y =-8,r=45,fill="#958561",stroke="#958561")
h_ring=combine([c1,c2,c3,c4,c5,c6])
# h_ring combined all the rings

#designs
sr=star(10,62.5,0,"Gold")|repeat(25,rotate(20))
c7 = circle(x=90,y=0,r=2,fill="white",stroke="white")|repeat(25,rotate(20))
des=combine([c7,sr])
headrnf=combine([h_ring,des])

#show(headrnf)

# ------------------------------------------------------------------------------------
# headcap
# headcone
def square(color, side):
    return rectangle(w=side, h=side, fill=color, stroke='none')

import math


def path(d, stroke_width=1, fill="Crimson", stroke="Crimson"):
    return Shape("path", d=d, stroke_width=stroke_width, fill=fill, stroke=stroke)

def arc(angle, **kwargs):
    x = 100 * math.cos(math.radians(angle))
    y = 100 * math.sin(math.radians(angle))
    long_flag = int(angle > 180)
    d = f"M 100 0 A 100 100 0 {long_flag} 1 {x} {y}"
    return path(d, **kwargs)

def tri(side,x,y):
    s=polygon([point(-1*(side/2),side/2),point((side/2),side/2),point((0),side*1.118033989)]) | translate(x,y)
    t=show(s)
    return t

#hatcone_design
rede2 = rectangle(w=200,h=50,x=0,y=-28,fill="#F58223",stroke="none")
rede3=rectangle(w=195,h=35,x=0,y=14,fill="#D51E26",stroke="none")
sq1=(square("#FDCE05",7)|rotate(45))|repeat(10,translate(10,0))|translate(-45,-15)|scale(2)
crde2=(circle(r=5,x=0,y=9,fill="#FDCE05",stroke="none"))|repeat(7,translate(14,0))|translate(-42,0)|scale(2)
rede4=rectangle(w=170,h=20,x=0,y=43,fill="#1CB81A",stroke="none")
tri1 = polygon([point(x=0, y=0), point(x=10, y=0),point(x=0, y=20) ],fill="#1CB81A",stroke="none")
tri2=tri1|scale(x=-1)|translate(-85.1,33)

ln1=line(-86,50,86,50,stroke_width=5,stroke="white")
strip_1=combine([rede4,tri1|translate(85.1,33),tri2,ln1])

ln2=line(-86,-85,86,-85,stroke_width=8,stroke="#0060FF")

lnde1=line(-100,0,100,0,stroke_width=6,stroke="#1CB81A")
des2=combine([rede2,rede3,sq1,crde2,strip_1,lnde1,ln2])

#hatcone
ar1 = arc(180)
re1 = rectangle(w=200,h=80,x=0,y=-28,fill="#F21429",stroke="none")
# topcone
# botom
e1=ellipse(w=40,h=80,x=77,y=-125,fill="#F21429",stroke="none")|rotate(15)
e2=e1|scale(x=-1)
re2=rectangle(w=200,h=80,x=0,y=-80,fill="#F21429",stroke="none")
#bottom ring
btcr=combine([circle(x=0,y =0,r=40,fill=color(240,128,128),stroke="#B83436"),circle(x=0,y =0,r=34,stroke="PapayaWhip",stroke_width=2.5)])
btln=line(3,3,15,15,stroke="PapayaWhip",stroke_width=1)|repeat(30,rotate(30))
btrn=combine([btcr,btln,btln|scale(1.3)|rotate(45)])|translate(-150,-158)
btrnf=combine([btrn,btrn|scale(.7)])
btrnf=combine([btrnf,btrnf|scale(x=-1)])

#topcon
retp1=rectangle(w=38,h=200,x=0,y=0,fill="#DC143C",stroke="none")|rotate(5)|translate(8,160)
retp2=retp1|scale(x=-1)
lnt=rectangle(w=70,h=10,x=0,y=100,fill="Violet",stroke="white",stroke_width=2)
ct = ellipse(w=5,h=80,fill="LavenderBlush",stroke="none")|repeat(20, rotate(20))|translate(-80,145)|repeat(3,translate(80,0))|scale(.5)
chand=ellipse(w=35,h=80,x=0,y=160,fill="white",stroke="none")
retp=combine([retp1,retp2,lnt,ct,chand])

#extrude
f4=ellipse(w=101,h=60,x=-49,y=-145,fill=color(131,182,61),stroke="none")
f5=f4|scale(x=-1)
fce=combine([f4,f5])
ref1=rectangle(w=45,h=67,x=0,y=-130,fill="#FCE302",stroke="none")
ref2=rectangle(w=35,h=40,x=0,y=-130,fill="#F58223",stroke="none")
#tp_co=combine(arc(30))

#reddot
dt=circle(r=5,x=0,y=-155,stroke="none",fill="red")
#underface

h_cone=combine([ar1,ref1,ref2,re2,des2,e1,e2,btrnf,dt,retp])|scale(.5)
#face
#nose
ns1=ellipse(w=18,h=48,x=0,y=0,fill=color(146, 204, 67),stroke=color(146, 204, 67),stroke_width=7)
ns2=ellipse(w=30,h=20,x=0,y=-15,fill=color(146, 204, 67),stroke=color(146, 204, 67),stroke_width=3)
ns=combine([ns1,ns2])|translate(0,-30)|scale(.7)
#eyes
eye1=ellipse(w=30,h=12,x=30,y=-5,fill="white",stroke="black",stroke_width=1)
eye2=eye1|scale(x=-1)
eye3=combine([circle(r=5,x=28,y=-5,fill="black"),circle(r=2,x=26,y=-3,fill="white")])
eye4=eye3|scale(x=-1)
ln2=line(0,0,25,0,stroke_width=2)|translate(20,-4)|rotate(18)
eyebr11=combine([ln2,ln2|scale(x=-1)])
ln3=line(0,0,9,0,stroke_width=4)|translate(33,24)|rotate(339)
eyebr22=combine([ln3,ln3|scale(x=-1)])
eyebr1=combine([eyebr11,eyebr22])
eyebr2=eyebr1|scale(y=-1,x=-1)|translate(-3,-5)
eyebr=combine([eyebr1,eyebr2])
eye=combine([eye1,eye2,eye3,eye4,eyebr])

#mouth
mr=arc(36)|translate(-40,-15)|rotate(253)
el1=ellipse(w=22,h=8,x=15,y=-50,fill="#C32E00",stroke="Crimson")|rotate(355.5)
el2=el1|scale(x=-1) 
dot1=circle(r=3,x=27,y=-50,fill="#C32E00",stroke=color(195,46,0,.2))
dot2=dot1|scale(x=-1)

mt=combine([mr,el1,el2,dot1,dot2])
#underchin
uct1=ellipse(w=150,h=60,x=10,y=-68,fill="white", stroke=color(192,192,192),stroke_width=2)|rotate(15)
uct2=uct1|scale(x=-1)
uc1=uct1|scale(.9)|rotate(-10)
uc2=uct2|scale(.9)|rotate(10)
ucom=ellipse(w=70,h=30,x=10,y=-75,fill="white", stroke=color(192,192,192),stroke_width=2)|rotate(15)

fe1=ellipse(w=120,h=150,x=0,y=10,fill=color(131,182,61), stroke="none")
fe2=ellipse(w=120,h=93,x=0,y=-32,fill=color(131,182,61),stroke="none")
fe3=ellipse(w=60,h=45,x=0,y=-62,fill=color(131,182,61),stroke="none")


face=combine([uct1,uct2,uc2,uc1,ucom,fe1,fe2,fe3,eye,mt,ns])

katha1=combine([face,h_cone|translate(0,75)])
katha=katha1|translate(0,-75)
#show(katha)
#frame---------------------------------------------------------------
rndst=[]
i=0
for i in range(400):
    rc=random(100,255)
    gc=random(100,255)
    bc=random(100,150)
    oe1=ellipse(w=2,h=450,x=0,y=0,fill=color(255, 255, 255),stroke="none",stroke_width=1)|rotate(ro)
    ro=ro+.5
    rndst.append(oe1)
    rnsp=combine(rndst)
ext=circle(r=180,stroke_width=100)
frm=combine([ext,rnsp])
#show(rnsp)
# final out----------------------------------------------------------------------------------------
kl=combine([headrnf|translate(0,40),katha|scale(.8)|translate(0,25)])|scale(.5)|translate(0,-30) 
kerala=combine([frm,otf,out|rotate(300)|scale(.9),kl])|scale(.95)
show(kerala)
#-------------

#vaishakh v S4EB NSSCE palakkad