import pycsoft # # Graphics Jungle Project # Use pybv to view this version of the dinosaur # converted from ~gl/models/pg/dino/grock.pg # Author : Brian Wyvill # This version October 1999 # title = "GraphicsJungle Implicit Dinosaur" def softy(o): o.sphere(0.5) def scaledSofty(o,x,y,z): o.push() o.scale(x,y,z) softy(o) o.pop() def pbline(o,n): o.push() o.scale( 0.68, 0.5, 0.5,) softy(o) o.pop() o.translate(0.5,0,0) if n>1: pbline(o, n-1) def bline(o): o.begin() pbline(o,3) o.blend() def showbline(): o = pycsoft.CSoft() bline(o) return o def showsofty(): o = pycsoft.CSoft() softy(o) return o def pb2line(o,n): o.push() o.scale( 0.68, 0.5, 0.5) softy(o) o.pop() o.translate(0.5,0,0) if n>1: pb2line(o, n-1) def b2line(o): o.begin() pb2line(o,3) o.blend() def showb2line(): o = pycsoft.CSoft() b2line(o) return o def d_hline(o): o.begin() bline(o) o.blend() def d_qline(o): o.begin() b2line(o) o.blend() def hline(o): d_hline(o) def qline(o): d_qline(o) ##### colour definitions ##### def mouth_col(o): o.colour(( 0, 1, 0 )) def nose_col(o): o.colour(( 1, 0, 0 )) def eye_col(o): o.colour(( 0, 0, 1 )) def hump_col(o): o.colour(( 0.7, 0.2, 0.2 )) def neck_col(o): o.colour(( 0.82, 0.63, 0.52 )) def body_col(o): o.colour((0.4, 0.82, 0.32)) def hed_col(o): o.colour((1, 0.45, 0.9)) def neck_col(o): o.colour((0.82, 0.63, 0.52)) def foot_col(o): o.colour((0, 1, 1)) def leg_col(o): o.colour((0.9, 0.55, 0.8)) def hump(o): hump_col(o) o.push() o.scale(1, 1, 0.4) softy(o) o.pop() def humpo(o): hump(o) def pneck(o,n, nr): o.push() o.scale( 1.2, 1.2, 1.2 ) qline(o) o.pop() o.push() o.translate( 0.5, 0, 0 ) o.scale( 0.6, 1.2, 0.6) hump(o) o.pop() #add the head in at the last level of recursion if (n==1): o.push() o.translate(3, 0, 0) o.rotate(2, -2*nr) o.scale(1.3,1.3,1.3) phead(o) o.pop() o.translate( 1.4, 0, 0 ) o.rotate(2, nr) if n>1: pneck(o, n-1, nr) def neck(o, nr): o.begin() neck_col(o) pneck(o, 5, nr) o.blend() def showneck(): o = pycsoft.CSoft() neck(o, 15) return o def foot(o): foot_col(o) o.push() o.translate(0.5, 0, 0) o.scale( 0.8, 0.5, 0.5) softy(o) o.pop() def pleg(o): leg_col(o) o.push() o.rotate(2, -90) o.scale(2.5,2.5,2.5) hline(o) o.pop() def fleg(o): pleg(o) o.push() o.translate(0, -2.87, 0) foot(o) o.pop() def leg(o): o.begin() fleg(o) o.blend() def showleg(): o = pycsoft.CSoft() leg(o) return o def pbody(o): o.push() o.translate(0, 2, 0) o.scale( 0.8, 0.8, 0.8) humpo(o) o.pop() o.push() o.rotate(2, -40) o.translate(0, 2.2, 0) o.scale(0.8, 1, 0.8) humpo(o) o.pop() o.push() o.rotate(2, -40) o.translate( 0, 2.2, 0) o.scale(0.8, 1, 0.8) humpo(o) o.pop() o.push() o.scale( 6, 4, 4) softy(o) o.pop() def body(o): body_col(o) o.begin() pbody(o) o.blend() def showbody(): o = pycsoft.CSoft() body(o) return o def hed(o): hed_col(o) scaledSofty(o,2,2,2) def eye(o): eye_col(o) scaledSofty(o,0.5,0.5,0.5) def nose(o): nose_col(o) scaledSofty(o,0.3,0.3,0.3) def mouth(o): mouth_col(o) scaledSofty(o,2,1,1) def phead(o): hed(o) o.push() o.translate(0.7, 0.6, -0.5) eye(o) o.pop() o.push() o.translate(0.7, 0.6, 0.5) eye(o) o.pop() o.push() o.translate(0.7, 0, 0) nose(o) o.pop() o.push() o.translate(0.7, -0.6, 0.0) mouth(o) o.pop() def head(o): o.begin() phead(o) o.blend() def showhead(): o = pycsoft.CSoft() head(o) return o def ptail(o,n,ta): o.push() scaledSofty(o, 2, 1.3, 1.3) o.pop() o.translate( 1.2, 1.4, 0.0) o.rotate(2, ta) o.scale( 0.92, 0.92, 0.92) if n>1: ptail(o, n-1, ta) def pptail(o,ta): o.translate(-3, 1, 0) o.rotate(1, 180) o.scale(0.9, 0.7, 0.7) o.rotate(2, -90) ptail(o,8,ta) def tail(o,ta): o.begin() pptail(o,ta) o.blend() def showtail(): o = pycsoft.CSoft() tail(o,22) return o def scalextransLeg(o,tx,ty,tz,rotx,sx,sy,sz): o.push() o.translate(tx,ty,tz) o.rotate(0,rotx) o.scale(sx,sy,sz) leg(o) o.pop() def pstand(o): scalextransLeg(o, -2, -1, 0.5, -10, 0.8, 1, 0.8) scalextransLeg(o, -2, -1, -0.5, 10, 0.8, 1, 0.8) scalextransLeg(o, 2, -1, 0.5, -10, 0.8, 1, 0.8) scalextransLeg(o, 2, -1, -0.5, 10, 0.8, 1, 0.8) def stand(o): o.begin() pstand(o) o.blend() def transneck(o, nr): o.push() o.translate(2, 1, 0) neck(o, nr) o.pop() def pre_grock(o, nr): o.begin() body(o) stand(o) transneck(o, nr) tail(o,22) o.blend() def grock(o): o.push() o.translate(0, 4.1307, 0) pre_grock(o, 15) o.pop() def showgrock(): o = pycsoft.CSoft() grock(o) return o