Code Sketch


Nagesh
By: Nagesh Bhat
cleari()

//showAxes()
//showGrid()


tangram.draw

def tangram = picStack(
    Picture {},
    square.thatsFilledWith(red).thatsRotated(180).thatsTranslated(0,70),
   triangle1.thatsFilledWith(green).thatsTranslated(0, -100).thatsRotated(135).thatsTranslated(0,40),
    triangle2.thatsFilledWith(Color(246, 103, 14)).thatsRotated(225).thatsTranslated(0,0),
  triangle2.thatsFilledWith(Color(0, 186, 242)).thatsRotated(-45).thatsTranslated(0,0),
   triangle3.thatsFilledWith(Color(0, 186, 242)).thatsRotated(-45).thatsTranslated(70,70),
    parallelogram.thatsFilledWith(blue).thatsRotated(45).thatsTranslated(-70,70),
    triangle4.thatsFilledWith(orange).thatsTranslated(100, 0).thatsRotated(45).thatsTranslated(0,0),
)



def square = Picture{
    right(135)
    forward(70.71)
    right(90)
    forward(70.71)
    right(90)
    forward(70.71)
    right(90)
    forward(70.71)
    right(90)
}.thatsStrokeColored(black)

def triangle1 = Picture{
    left(45)
    forward(40.71)
    left(135)
    forward(57)
    left(135)
    forward(40.71)
}.thatsStrokeColored(black)

def triangle2 = Picture{
    right(135)
    forward(141.42)
    left(135)
    forward(200)
    left(135)
    forward(141.42)
}.thatsStrokeColored(black)

def triangle3 = Picture{
    left(45)
    forward(40.71)
    left(135)
    forward(57)
    left(135)
    forward(40.71)
    
    
}.thatsStrokeColored(black)

def parallelogram = Picture{
    forward(52)
    right(135)
    forward(52)
    right(45)
    forward(52)
    right(135)
    forward(52)
}.thatsStrokeColored(black)

def triangle4 = Picture {
    left(45)
    forward(141.42)
    left(135)
    forward(100)
    left(90)
    forward(100)
}.thatsStrokeColored(black)