############################## No.2 Blazing Star# ##########################

## the basic diamond shape
def drawDiamond(diamondSide,fromCenter,clockwise):
	beginHeading = turtle.heading()
	cCenterPos = turtle.pos()
	turtle.penup()
	turtle.forward(diamondSide*fromCenter)
	turtle.pendown()
	turtle.forward(diamondSide)
	turtle.right(45*clockwise)
	turtle.forward(diamondSide)
	turtle.right(135*clockwise)
	turtle.forward(diamondSide)
	turtle.right(45*clockwise)
	turtle.forward(diamondSide)
	turtle.right(-45*clockwise)
	turtle.penup()
##    turtle.forward(diamondSide*fromCenter)
	turtle.goto(cCenterPos)
	turtle.pendown()
	turtle.seth(beginHeading)
	
def blazingStar(color1, color2, color3, color4, color5):
	beginPos = turtle.pos()
	turtle.write("Blazing Star")
	turtle.begin_fill()
	turtle.fillcolor(color1)
	drawBlockSq()
	turtle.end_fill()

	gotoBlockCenter(1,2)
	## define the side length of each diamond shape
	diamondSide = glbBlockLength/2/(1+1+1+math.sqrt(2)/2)


	#1st layer
	for i in range(0,8):
		turtle.begin_fill()
		turtle.fillcolor(color2)
		drawDiamond(diamondSide, 0, 1)
		turtle.right(45)
		turtle.end_fill()

	#2nd layer clockwise
	for i in range(0,8):
		turtle.begin_fill()
		turtle.fillcolor(color3)
		drawDiamond(diamondSide, 1, 1)
		turtle.right(45)
		turtle.end_fill()
	#2nd layer counter clockwise
	for i in range(0,8):
		turtle.begin_fill()
		turtle.fillcolor(color3)
		drawDiamond(diamondSide, 1, -1)
		turtle.right(45)
		turtle.end_fill()

	#3rd layer clockwise
	for i in range(0,8):
		turtle.begin_fill()
		turtle.fillcolor(color4)
		drawDiamond(diamondSide, 2, 1)
		turtle.right(45)
		turtle.end_fill()
	#3rd layer counter clockwise
	for i in range(0,8):
		turtle.begin_fill()
		turtle.fillcolor(color4)
		drawDiamond(diamondSide, 2, -1)
		turtle.right(45)
		turtle.end_fill()
	#3rd layer middle
	## use this offset function to draw the diamond shape into it's position
	def offsetMid(a,b):
		turtle.penup()
		turtle.forward(diamondSide*a)
		turtle.right(45)
		turtle.forward(diamondSide*b)
		turtle.left(45)
		turtle.pendown()
	for i in range(0,8):
		cCenterPos = turtle.pos()
		offsetMid(-1,1)
		turtle.begin_fill()
		turtle.fillcolor(color4)
		drawDiamond(diamondSide, 2, 1)
		turtle.end_fill()
		turtle.penup()
		turtle.goto(cCenterPos)
		turtle.pendown()
		turtle.right(45)


	#reset position
	gotoBeginPos()
