aUCBLogo Demos and Tests / house
to house [size 300]
local
[ hsize
doorwitdh doorheight doorx doorstep doorpos doorori
]
ht
horizon=1e4
hsize=size/2
wall=hsize/10
setLightAmbient rgb .4 .4 .4
perspective
green=hsb 60 0.4 0.1
setPC green
pu rr 30 down 180 fd hsize up 90
draw_plane
lt 180 fd hsize rt 90 fd hsize lr 90 rt 90
openpos=[]
openori=[]
pink=hsb 0 0.3 0.7
setpc pink
double [draw_front] down 90 fd size up 90 lr 90
double [draw_side] down 90 fd size up 90 lr 90
double [draw_back] down 90 fd size up 90 lr 90
double [draw_side]
fd hsize down 30 bk wall lt 90 fd wall rt 90
draw_roof
fd size+wall down 120 fd size+wall rt 90 fd size+2*wall rt 90
draw_roof
setpc pink
draw_openings
; rotateScene2
end
to double runlist
double? = false
run runlist
down 90 fd wall up 90
double? = true
run runlist
down 90 bk wall up 90
end
to add_open
if not double?
[ push "openpos posXYZ
push "openori Orientation
push "openheight height
push "openwidth width
]
end
to save_pos
opos=posXYZ
oori=Orientation
end
to reset_pos
pu
setPosXYZ opos
setOrientation oori
end
to draw_plane
save_pos
fd horizon rt 90 fd horizon rt 90
setpc hsb 60 0.3 0.7
pd PolyStart repeat 4 [fd horizon*2 rt 90] PolyEnd
reset_pos
end
to draw_openings
while [not empty? openpos]
[ setPosXYZ pop "openpos
setOrientation pop "openori
width=pop "openwidth
height=pop "openheight
rr 90
pd
repeat 2
[ PolyStart
fd height rt 90 fd wall rt 90
fd height rt 90 fd wall rt 90
PolyEnd
pu fd height up 90 pd
PolyStart
fd width rt 90 fd wall rt 90
fd width rt 90 fd wall rt 90
PolyEnd
pu fd width up 90 pd
]
pu
]
end
to draw_front
TessStart
save_pos
pd fd hsize rt 30 fd size rt 120 fd size rt 30 fd hsize
rt 90 fd size rt 90
TessContour
height=size*3/8
width=height*1/2
doorx=size/4
doorstep=height/8
pu rt 90 fd doorx lt 90 fd doorstep
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessContour
height=size*3/12
width=height*3/2
winx=size*9/16
winsill=height*6/8
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessContour
height=size*3/12
width=height*3/2
winx=size*5/16
winsill=hsize+winsill
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessEnd
reset_pos
end
to draw_back
TessStart
save_pos
pd fd hsize rt 30 fd size rt 120 fd size rt 30 fd hsize
rt 90 fd size
TessContour
height=size*3/12
width=height*3/2
winx=size*1/16
winsill=height*6/8
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessContour
winx=size*9/16
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessContour
height=size*3/12
width=height*3/2
winx=size*5/16
winsill=hsize+winsill
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessEnd
reset_pos
end
to draw_side
TessStart
save_pos
pd fd hsize rt 90 fd size rt 90 fd hsize rt 90 fd size rt 90
TessContour
height=size*3/12
width=height*3/2
winx=size*1/16
winsill=height*6/8
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessContour
winx=size*9/16
reset_pos
rt 90 fd winx lt 90 fd winsill
add_open
pd fd height rt 90 fd width rt 90
fd height rt 90 fd width
TessEnd
reset_pos
end
to draw_roof
pd
red=hsb 0 1 1
setPC red
PolyStart
repeat 2 [fd size+wall rt 90 fd size+2*wall rt 90]
PolyEnd
pu
end