def squareunitbars( w, d, h, legw, legd ): fbar = irit.box( ( legw, 0, 0 ), w - 2 * legw, legd, legw ) sbar = irit.box( ( 0, legd, 0 ), legd, d - 2 * legd, legw ) barframe = irit.list( fbar, sbar, fbar * irit.ty( d - legd ), sbar * irit.tx( w - legd ) ) retval = irit.list( barframe * irit.tz( 0.1 ), barframe * irit.tz( h - 0.1 ) ) irit.attrprop( retval, "ptexture", woodtext ) irit.attrprop( retval, "rgb", woodclr ) return retval
def cornerunitbars( w, h, legw, legd ): sbar = irit.box( ( legw, 0, 0 ), w - 2 * legw, legd, legw ) lbar = irit.box( ( legd, 0, 0 ), 2 * w - legd - legw, legd, legw ) arcbar1 = irit.arc( ( w, 0, 0 ), ( w, w, 0 ), ( 2 * w, w, 0 ) ) arcbar2 = irit.offset( arcbar1, (-legd ), 0.1, 0 ) arcbar = irit.list( irit.extrude( arcbar1 + (-arcbar2 ) + irit.ctlpt( irit.E3, w, 0, 0 ), ( 0, 0, legw ), 0 ), irit.ruledsrf( arcbar1, arcbar2 ), irit.ruledsrf( arcbar1, arcbar2 ) * irit.tz( legw ) ) barframe = irit.list( arcbar, sbar, sbar * irit.tx( w ) * irit.rz( 90 ) * irit.tx( 2 * w ), lbar * irit.rz( 90 ) * irit.tx( legd ), lbar * irit.tx( legw - legd ) * irit.ty( 2 * w - legd ) ) retval = irit.list( barframe * irit.tz( 0.1 ), barframe * irit.tz( h - 0.1 ) ) irit.attrprop( retval, "ptexture", woodtext ) irit.attrprop( retval, "rgb", woodclr ) return retval
def snakepiece(clr, xrot, ypos, zpos): retval = (irit.box((0, 0, (-0.1)), 1, 1.1, 1.1) - irit.box( (0, (-1), (-2)), 2, 3, 2) * irit.rx(45) * irit.tx((-0.5))) retval = retval * irit.sc(1.0 / math.sqrt(2)) * irit.rx( (-225)) * irit.trans(((-1) / (2.0 * math.sqrt(2)), 1, 0.5)) retval = retval * irit.rx(xrot) * irit.ty(ypos) * irit.tz(zpos) irit.color(retval, clr) return retval
def king(s, clr): kingbase = (-irit.surfprev( irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.001, 1.04 ), \ irit.ctlpt( irit.E2, 0.04, 1.04 ), \ irit.ctlpt( irit.E2, 0.04, 1.02 ), \ irit.ctlpt( irit.E2, 0.06, 1.02 ), \ irit.ctlpt( irit.E2, 0.06, 1 ), \ irit.ctlpt( irit.E2, 0.08, 1 ), \ irit.ctlpt( irit.E2, 0.08, 0.97 ), \ irit.ctlpt( irit.E2, 0.1, 0.97 ), \ irit.ctlpt( irit.E2, 0.1, 0.94 ), \ irit.ctlpt( irit.E2, 0.07, 0.82 ), \ irit.ctlpt( irit.E2, 0.07, 0.8 ), \ irit.ctlpt( irit.E2, 0.09, 0.8 ), \ irit.ctlpt( irit.E2, 0.09, 0.78 ), \ irit.ctlpt( irit.E2, 0.07, 0.78 ), \ irit.ctlpt( irit.E2, 0.07, 0.74 ), \ irit.ctlpt( irit.E2, 0.1, 0.72 ), \ irit.ctlpt( irit.E2, 0.1, 0.7 ), \ irit.ctlpt( irit.E2, 0.14, 0.67 ), \ irit.ctlpt( irit.E2, 0.14, 0.64 ), \ irit.ctlpt( irit.E2, 0.06, 0.57 ), \ irit.ctlpt( irit.E2, 0.09, 0.33 ), \ irit.ctlpt( irit.E2, 0.21, 0.14 ), \ irit.ctlpt( irit.E2, 0.21, 0 ) ), irit.list( irit.KV_OPEN ) ) * irit.rx( 90 ) ) ) kingcrosscrv = ( \ irit.ctlpt( irit.E2, (-0.07 ), 0 ) + \ irit.ctlpt( irit.E2, (-0.07 ), 0.53 ) + \ irit.ctlpt( irit.E2, (-0.3 ), 0.53 ) + \ irit.ctlpt( irit.E2, (-0.3 ), 0.67 ) + \ irit.ctlpt( irit.E2, (-0.07 ), 0.67 ) + \ irit.ctlpt( irit.E2, (-0.07 ), 1 ) + \ irit.ctlpt( irit.E2, 0, 1 ) ) kingcrosssrf1 = irit.ruledsrf(kingcrosscrv, kingcrosscrv * irit.sx((-1))) kingcrosssrf2 = (-kingcrosssrf1) * irit.tz(0.08) kingcrosscrv2 = (kingcrosscrv + (-kingcrosscrv) * irit.sx((-1))) kingcrosssrf3 = irit.ruledsrf(kingcrosscrv2, kingcrosscrv2 * irit.tz(0.08)) kingcross = irit.list( kingcrosssrf1, kingcrosssrf2, kingcrosssrf3) * irit.tz( (-0.04)) * irit.sc(0.16) * irit.rx(90) * irit.tz(1) irit.attrib(kingcross, "rgb", irit.GenStrObject("255,255,100")) irit.attrib(kingbase, "rgb", irit.GenStrObject(clr)) retval = irit.list(kingbase, kingcross) * irit.sc(s) return retval
def cornerunitshelf( w, h, legw, legd ): prof1 = ( irit.ctlpt( irit.E3, legd, legd, 0 ) + \ irit.ctlpt( irit.E3, legd, 2 * w - legd, 0 ) + \ irit.ctlpt( irit.E3, 2 * w - legd, 2 * w - legd, 0 ) ) prof2 = ( \ irit.ctlpt( irit.E3, legd, legd, 0 ) + irit.arc( ( w - legd, legd, 0 ), ( w, w, 0 ), ( 2 * w - legd, w - legd, 0 ) ) + \ irit.ctlpt( irit.E3, 2 * w - legd, 2 * w - legd, 0 ) ) shelfframe = irit.list( irit.extrude( prof1 + (-prof2 ), ( 0, 0, 0.03 ), 0 ), irit.ruledsrf( prof1, prof2 ), irit.ruledsrf( prof1, prof2 ) * irit.tz( 0.03 ) ) irit.attrib( shelfframe, "ptexture", woodtext ) irit.attrib( shelfframe, "rgb", woodclr ) retval = irit.list( shelfframe ) * irit.tz( h ) return retval
def drawbiarcs(crv, tol, maxangle): arcs = irit.cbiarcs(crv, tol, maxangle) * irit.tz(0.01) i = 1 while (i <= irit.SizeOf(arcs)): if (isodd(i)): irit.color(irit.nref(arcs, i), irit.YELLOW) else: irit.color(irit.nref(arcs, i), irit.MAGENTA) i = i + 1 irit.printf("%d arcs were used in this approximation\n", irit.list(irit.SizeOf(arcs))) irit.color(crv, irit.CYAN) irit.interact(irit.list(irit.GetAxes(), crv, arcs))
def cornerunitwalls( w, h, legw, legd ): lwall = irit.box( ( legd, 0, 0.2 ), 2 * w - 2 * legd, 0.002, h - 0.3 ) irit.attrib( lwall, "ptexture", woodtext ) irit.attrib( lwall, "rgb", woodclr ) swall = irit.box( ( legd, 0, 0.2 ), w - 2 * legd, 0.002, h - 0.3 ) irit.attrib( swall, "transp", irit.GenRealObject(0.3 )) arcbar1 = irit.arc( ( w, 0, 0 ), ( w, w, 0 ), ( 2 * w, w, 0 ) ) arcbar2 = irit.offset( arcbar1, irit.GenRealObject(-0.03 ), 0.1, 0 ) arcbar = irit.list( irit.extrude( arcbar1 + (-arcbar2 ) + irit.ctlpt( irit.E3, w, 0, 0 ), ( 0, 0, 0.03 ), 0 ), irit.ruledsrf( arcbar1, arcbar2 ), irit.ruledsrf( arcbar1, arcbar2 ) * irit.tz( 0.03 ) ) rdoorframe = irit.list( irit.box( ( w, 0, 0.2 ), 0.03, 0.03, h - 0.3 ),\ irit.box( ( 2 * w - 0.03, w - 0.03, 0.2 ), 0.03, 0.03, h - 0.3 ),\ arcbar * irit.tz( 0.2 ), arcbar * irit.tz( h - 0.1 - 0.03 ) ) irit.attrib( rdoorframe, "ptexture", woodtext ) irit.attrib( rdoorframe, "rgb", woodclr ) rdoorglass = irit.extrude( irit.offset( arcbar1, irit.GenRealObject(-0.02 ), 0.1, 0 ) + (-irit.offset( arcbar1, irit.GenRealObject(-0.03 ), 0.1, 0 ) ) + \ irit.ctlpt( irit.E3, w - 0.02, 0, 0 ), ( 0, 0, h - 0.3 - 0.04 ), 0 ) * irit.tz( 0.22 ) irit.attrib( rdoorglass, "transp", irit.GenRealObject(0.3 )) rdoor = irit.list( rdoorframe, rdoorglass ) rot_z = ( \ irit.ctlpt( irit.E1, 0 ) + \ irit.ctlpt( irit.E1, 130 ) ) irit.attrib( rdoor, "animation", irit.list( irit.tx( (-w ) ), rot_z, irit.tx( w ) ) ) retval = irit.list( lwall * irit.ty( 2 * w ), swall * irit.rz( 90 ) * irit.tx( 2 * w ) * irit.ty( w ), lwall * irit.rz( 90 ), swall, rdoor ) return retval
def buildoffsetvisibilitymap( c, step, ofst ): retval = irit.nil( ) co = irit.offset( c, irit.GenRealObject(ofst), 1e-006, 1 ) tmin = irit.nth( irit.pdomain( co ), 1 ) tmax = irit.nth( irit.pdomain( co ), 2 ) t = tmin while ( t <= tmax ): pt = irit.coerce( irit.ceval( co, irit.FetchRealObject(t) ), irit.POINT_TYPE ) * \ irit.tz( 1 ) crvs = irit.cvisible( c, irit.Fetch3TupleObject(pt) , 1e-005 ) crvdmn = cnvrtcrvs2domains( crvs, t ) irit.attrib( crvdmn, "width", irit.GenRealObject(0.01) ) irit.attrib( crvdmn, "gray", irit.GenRealObject(0.5) ) irit.attrib( crvdmn, "rgb", irit.GenStrObject("128, 128, 255" )) irit.snoc( crvdmn, retval ) t = t + step return retval
irit.interact( irit.list( irit.GetAxes(), apline2, c2 ) ) irit.save( "antipdl1", irit.list( irit.list( c1, apline1 ) * irit.tx( (-1 ) ), irit.list( c2, apline2 ) * irit.tx( 1 ) ) ) # ############################################################################ c1 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.7, 0.5 ), \ irit.ctlpt( irit.E2, (-0.4 ), 0.4 ), \ irit.ctlpt( irit.E2, (-0.4 ), (-0.4 ) ), \ irit.ctlpt( irit.E2, 0.7, (-0.5 ) ) ), irit.list( irit.KV_OPEN ) ) c2 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.7, 0.5 ), \ irit.ctlpt( irit.E2, (-0.4 ), (-0.8 ) ), \ irit.ctlpt( irit.E2, (-0.4 ), 0.8 ), \ irit.ctlpt( irit.E2, 0.7, (-0.5 ) ) ), irit.list( irit.KV_OPEN ) ) s1 = irit.sfromcrvs( irit.list( c1, c2 * irit.sc( 1.1 ) * irit.tx( (-0.2 ) ) * irit.tz( 0.2 ), c2 * irit.sx( 1.1 ) * irit.tx( (-0.2 ) ) * irit.tz( 0.4 ), c1 * irit.tz( 0.6 ) ), 3, irit.KV_OPEN ) apline1 = evalantipodalptsonsrf( s1 ) irit.interact( irit.list( irit.GetAxes(), apline1, s1 ) ) c1 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 1, 0.15 ), \ irit.ctlpt( irit.E2, (-0.4 ), 0.4 ), \ irit.ctlpt( irit.E2, (-0.4 ), (-0.4 ) ), \ irit.ctlpt( irit.E2, 1, (-0.15 ) ) ), irit.list( irit.KV_OPEN ) ) c2 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 1, 0.1 ), \ irit.ctlpt( irit.E2, 0.65, (-0.2 ) ), \ irit.ctlpt( irit.E2, (-0.2 ), 0.25 ), \ irit.ctlpt( irit.E2, (-0.2 ), (-0.252 ) ), \
# # Ruled surface. # printtest("ruled", irit.isgeom(irit.spheresrf(1), 13, 1e-010), 0) arc3 = irit.arc((0, 0, 1), (0.5, (-0.2), 1), (1, 0, 1)) ruled = irit.ruledsrf( arc3, irit.ctlpt( irit.E2, 0, 0 ) + \ irit.ctlpt( irit.E2, 1, 0 ) ) irit.free(arc3) printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2) printtest("ruled", irit.isgeom(irit.sreverse(ruled), irit.GEOM_RULED_SRF, 1e-010), 1) circ = irit.circle((0, 0, 0), 0.25) ruled = irit.ruledsrf(circ, circ * irit.rx(10) * irit.sc(0.5) * irit.tz(1)) printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2) printtest("ruled", irit.isgeom(irit.sreverse(ruled), irit.GEOM_RULED_SRF, 1e-010), 1) ruled = irit.ruledsrf(circ * irit.rotx(20), circ * irit.rotx((-20)) * irit.tz(1)) printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2) printtest("ruled", irit.isgeom(ruled, irit.GEOM_EXTRUSION, 1e-010), 0) irit.free(circ) # # Extrusion examples. # printtest("extrusion", irit.isgeom(ruled, irit.GEOM_EXTRUSION, 1e-010), 0)
irit.adwidth(zeroset, 3) irit.interact(irit.list(irit.GetAxes(), zerosetsrfe3, zeroset)) # ############################################################################ # # Case 3 # c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), (-1 ), (-1 ) ), \ irit.ctlpt( irit.E3, (-0.5 ), 1, (-1 ) ), \ irit.ctlpt( irit.E3, 0.3, (-2 ), (-1 ) ), \ irit.ctlpt( irit.E3, 0.5, 1, (-1 ) ), \ irit.ctlpt( irit.E3, 1, (-1 ), (-1 ) ) ) ) c2 = c1 * irit.sc(0.7) * irit.tz(1.7) r1 = irit.ruledsrf(c1, c2) c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0, (-1 ) ), \ irit.ctlpt( irit.E3, 0, 1, (-1 ) ), \ irit.ctlpt( irit.E3, 0.3, 0, (-1 ) ), \ irit.ctlpt( irit.E3, 1, 0, (-1 ) ) ) ) c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0, 1 ), \ irit.ctlpt( irit.E3, 0, 1, 1 ), \ irit.ctlpt( irit.E3, 0.3, 1, 1 ), \ irit.ctlpt( irit.E3, 1, 0, 1 ) ) ) r2 = irit.ruledsrf(c1, c2) * irit.rx(90)
irit.color( q1, irit.YELLOW ) irit.printf( "%d quadratic segements\n", irit.list( irit.SizeOf( q1 ) ) ) q2 = irit.quadcrvs( crv, 0.1, (-1 ) ) irit.color( q2, irit.CYAN ) irit.printf( "%d quadratic segements\n", irit.list( irit.SizeOf( q2 ) ) ) q3 = irit.cubiccrvs( crv, 0.02, (-1 ) ) irit.color( q3, irit.MAGENTA ) irit.printf( "%d cubic segements\n", irit.list( irit.SizeOf( q3 ) ) ) q4 = irit.cubiccrvs( crv, 0.1, (-1 ) ) irit.color( q4, irit.GREEN ) irit.printf( "%d cubic segements\n", irit.list( irit.SizeOf( q4 ) ) ) all = irit.list( crv, q1 * irit.tz( 0.1 ), q2 * irit.tz( 0.2 ), q3 * irit.tz( 0.3 ), q4 * irit.tz( 0.4 ) ) irit.interact( all ) irit.save( "pp1apprx", all ) # ################################ crv = irit.cbspline( 5, irit.list( irit.ctlpt( irit.E2, 0.5, (-1 ) ), \ irit.ctlpt( irit.E2, (-1.5 ), (-0.5 ) ), \ irit.ctlpt( irit.E2, 0.5, 0 ), \ irit.ctlpt( irit.E2, (-0.15 ), 2 ), \ irit.ctlpt( irit.E2, (-1.5 ), 2 ), \ irit.ctlpt( irit.E2, (-0.5 ), 1 ), \ irit.ctlpt( irit.E2, 0.5, 2 ) ), irit.list( irit.KV_OPEN ) ) irit.color( crv, irit.WHITE )
# # # The Blade # sec1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, (-0.525 ), (-0.041 ), 0 ), \ irit.ctlpt( irit.E2, (-0.0935 ), 0.102 ), \ irit.ctlpt( irit.E2, 0.487, 0.14 ), \ irit.ctlpt( irit.E2, 0.882, 0.112 ), \ irit.ctlpt( irit.E2, 0.878, 0.198 ), \ irit.ctlpt( irit.E2, 0.559, 0.403 ), \ irit.ctlpt( irit.E2, (-0.183 ), 0.252 ), \ irit.ctlpt( irit.E2, (-0.525 ), (-0.04 ) ) ), irit.list( irit.KV_OPEN ) ) * irit.tx( (-0.2 ) ) * irit.ty( (-0.2 ) ) sec2 = sec1 * irit.sy(0.5) * irit.sc(1.2) * irit.tz(2.5) * irit.rz(30) bladeside = irit.ruledsrf(sec1, sec2) bladetop = irit.ruledsrf(irit.cregion(sec2, 0, 0.5), (-irit.cregion(sec2, 0.5, 1))) blademain = irit.list(bladeside, bladetop) * irit.tz(0.2) irit.free(bladeside) irit.free(bladetop) bladefillet = irit.sfromcrvs( irit.list(sec1 * irit.sc(1.35) * irit.sy(1.5) * irit.tz((-0.1)), sec1, sec1 * irit.tz(0.2)), 3, irit.KV_OPEN) irit.free(sec1) irit.free(sec2)
# # An object that has three projections of a cross, circle and a square. # w = 0.4 cross = ( irit.ctlpt( irit.E3, 1, 0, 0 ) + \ irit.ctlpt( irit.E3, 1, w, 0 ) + \ irit.ctlpt( irit.E3, w, w, 0 ) + \ irit.ctlpt( irit.E3, w, 1, 0 ) + \ irit.ctlpt( irit.E3, 0, 1, 0 ) ) cross = (cross + cross * irit.rz(90) + cross * irit.rz(180) + cross * irit.rz(270)) s1 = irit.extrude(cross * irit.tz((-2)), (0, 0, 4), 0) irit.free(cross) s2 = irit.extrude(irit.circle((0, 0, 0), 0.999) * irit.tz((-2)), (0, 0, 4), 0) * irit.rx(90) s = s1 * s2 irit.free(s1) irit.free(s2) irit.view(irit.list(irit.GetAxes(), s), irit.ON) irit.save("crosplug", s) irit.pause() irit.free(s)
intercrvs = intercrvspaint(intercrvs) irit.adwidth(intercrvs, 3) all = irit.list(irit.GetAxes(), intercrvs) irit.interact(all) irit.save("crv2arng", all) # ############################################################################ crvs = randomcrvs(11, 3, 3, 0.8, 2) linearlowenv = irit.carrangmnt(crvs, 1e-012, 3, irit.GenRealObject(0)) irit.attrib(linearlowenv, "rgb", irit.GenStrObject("255, 255, 200")) irit.adwidth(linearlowenv, 5) all = irit.list(irit.GetAxes(), crvs, linearlowenv * irit.tz((-0.2))) irit.interact(all) irit.save("crv3arng", all) # ############################################################################ crvs = randomcrvs(8, 3, 3, 0.8, 2) b = irit.bbox(crvs) crvs = crvs * irit.ty(0.1 - irit.FetchRealObject(irit.coord(b, 3))) irit.free(b) radiallowenv = irit.carrangmnt(crvs, 1e-012, 4, irit.point(0, 0, 0)) irit.attrib(radiallowenv, "rgb", irit.GenStrObject("255, 255, 200")) irit.adwidth(radiallowenv, 5) all = irit.list(irit.GetAxes(), crvs, radiallowenv * irit.tz((-0.2)))
def antbody(): save_res = irit.GetResolution() c = irit.pcircle((0, 0, 0), 1) body = (-irit.sfromcrvs( irit.list( c * irit.sc(1e-006) * irit.ty((-0.1)) * irit.tz(0.19), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(0.19), c * irit.sy(0.8) * irit.sc(0.11) * irit.ty((-0.1)) * irit.tz(0.21), c * irit.sy(0.8) * irit.sc(0.14) * irit.ty((-0.1)) * irit.tz(0.23), c * irit.sy(0.8) * irit.sc(0.14) * irit.ty((-0.1)) * irit.tz(0.26), c * irit.sy(0.8) * irit.sc(0.11) * irit.ty((-0.1)) * irit.tz(0.28), c * irit.sy(0.8) * irit.sc(0.11) * irit.ty((-0.1)) * irit.tz(0.29), c * irit.sy(0.8) * irit.sc(0.24) * irit.ty( (-0.05)) * irit.tz(0.31), c * irit.sy(0.8) * irit.sc(0.27) * irit.ty( (-0.05)) * irit.tz(0.41), c * irit.sy(0.8) * irit.sc(0.19) * irit.ty( (-0.05)) * irit.tz(0.44), c * irit.sy(0.8) * irit.sc(0.19) * irit.ty( (-0.05)) * irit.tz(0.45), c * irit.sy(0.8) * irit.sc(0.3) * irit.ty( (-0.035)) * irit.tz(0.47), c * irit.sy(0.8) * irit.sc(0.32) * irit.ty( (-0.035)) * irit.tz(0.59), c * irit.sy(0.8) * irit.sc(0.24) * irit.ty( (-0.035)) * irit.tz(0.62), c * irit.sy(0.8) * irit.sc(0.24) * irit.ty( (-0.035)) * irit.tz(0.63), c * irit.sy(0.8) * irit.sc(0.3) * irit.ty((-0.03)) * irit.tz(0.65), c * irit.sy(0.8) * irit.sc(0.28) * irit.ty( (-0.03)) * irit.tz(0.76), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(0.85), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(0.87), c * irit.sy(0.8) * irit.sc(0.18) * irit.ty((-0.1)) * irit.tz(0.93), c * irit.sy(0.8) * irit.sc(0.18) * irit.ty((-0.1)) * irit.tz(1.03), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(1.1), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(1.12), c * irit.sy(0.8) * irit.sc(0.18) * irit.ty( (-0.06)) * irit.tz(1.18), c * irit.sy(0.8) * irit.sc(0.18) * irit.ty( (-0.03)) * irit.tz(1.32), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0)) * irit.tz(1.41), c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0)) * irit.tz(1.43), c * irit.sy(0.8) * irit.sc(0.22) * irit.ty(0.05) * irit.tz(1.5), c * irit.sy(0.8) * irit.sc(0.2) * irit.ty((-0)) * irit.tz(1.66), c * irit.sy(0.8) * irit.sc(0.05) * irit.ty( (-0.22)) * irit.tz(1.85), c * irit.sy(0.8) * irit.sc(1e-006) * irit.ty( (-0.22)) * irit.tz(1.86)), 3, irit.KV_OPEN)) irit.SetResolution(15) eye1 = irit.sphere((0, 0, 0), 0.08) * irit.rx(20) * irit.ry( (-20)) * irit.trans((0.15, 0.05, 1.59)) eye2 = eye1 * irit.sx((-1)) irit.SetResolution(20) bodycut = body / eye1 ^ eye2 irit.attrib(bodycut, "rgb", irit.GenStrObject("255,50,50")) eye1cut = eye1 / body irit.attrib(eye1cut, "reflection", irit.GenStrObject("0.85")) irit.attrib(eye1cut, "rgb", irit.GenStrObject("15,15,15")) eye2cut = eye2 / body irit.attrib(eye2cut, "reflection", irit.GenStrObject("0.85")) irit.attrib(eye2cut, "rgb", irit.GenStrObject("15,15,15")) irit.SetResolution(save_res) retval = irit.list(bodycut, irit.list(eye1cut, eye2cut)) return retval
irit.free(rot_y) irit.free(trns) # # Top round. # topround = irit.poly( lj8samplecurve( irit.cbezier( irit.list( irit.ctlpt( irit.E3, 0, (-0.7 ), 7.5 ), \ irit.ctlpt( irit.E3, 0, 2.5, 8 ), \ irit.ctlpt( irit.E3, 0, 5.7, 7.5 ) ) ), 10 ) + irit.list( ( 0, 5.7, 7.2 ), ( 0, 5.2, 7.2 ), irit.point( 0, 4.9, 6.8 ), irit.point( 0, 4.9, 6 ), irit.point( 0, 0.1, 6 ), irit.point( 0, 0.1, 6.3 ), irit.point( 0, (-0.2 ), 6.3 ), irit.point( 0, (-0.7 ), 7.1 ) ), 0 ) topround = irit.extrude(topround, (2, 0, 0), 3) * irit.tx(0.001) irit.SetResolution(4) screen = irit.con2((0, 0, 0), (0, 0, (-0.15)), 0.3, 0.2, 3) * irit.rz(45) topround = (topround - screen * irit.rx(5.5) * irit.sx(3) * irit.tx(1) * irit.tz(7.65)) irit.SetResolution(20) screen = irit.ruledsrf( irit.ctlpt( irit.E3, 0.1414, 0.1414, (-0.14 ) ) + \ irit.ctlpt( irit.E3, (-0.1414 ), 0.1414, (-0.14 ) ), \ irit.ctlpt( irit.E3, 0.1414, (-0.1414 ), (-0.14 ) ) + \ irit.ctlpt( irit.E3, (-0.1414 ), (-0.1414 ), (-0.14 ) ) ) * irit.rx( 5.5 ) * irit.sx( 3 ) * irit.tx( 1 ) * irit.tz( 7.65 ) irit.attrib(screen, "rgb", irit.GenStrObject("20,100,20")) tmpbody = irit.box((1, 0.75, 6.5), 2, 3.5, 0.15) z = 7.2 while (z <= 7.5): tmpbody = tmpbody ^ irit.box(((-0.1), 1, z), 0.2, 3, 0.05) z = z + 0.1 topround = topround / tmpbody
j = 1 while ( j <= irit.SizeOf( crvs ) ): c = irit.coerce( irit.nth( crvs, j ), irit.KV_OPEN ) irit.attrib( c, "rgb", irit.GenStrObject("0,255,128") ) irit.attrib( c, "gray", irit.GenRealObject(0.5) ) irit.awidth( c, 0.02 ) co = irit.offset( c, irit.GenRealObject(ofst), 0.001, 1 ) dms = buildoffsetvisibilitymap( c, step, ofst ) irit.attrib( dms, "rgb", irit.GenStrObject("128, 128, 255" )) views = computeviews( c, dms, "" ) viewptcurves = irit.nil( ) i = 1 while ( i <= irit.SizeOf( views ) ): t = irit.FetchRealObject(irit.nth( views, i ) * step) pt = irit.coerce( irit.ceval( co, t ), irit.POINT_TYPE ) * irit.tz( 1 ) v = offsetcrvlist( irit.cvisible( c, irit.Fetch3TupleObject(pt), 0.0001 ), 1/100.0 + i/130 ) irit.attrib( v, "dash", irit.nth( dashlist, i ) ) irit.awidth( v, 0.009 ) rgb = randrgb( ) pt = pt * irit.sz( 0.01 ) irit.attrib( v, "rgb", irit.GenStrObject(rgb )) irit.attrib( pt, "rgb", irit.GenStrObject(rgb )) irit.snoc( pt, viewptcurves ) irit.snoc( v, viewptcurves ) i = i + 1 irit.interact( irit.list( c, viewptcurves ) ) irit.save( "art" + str(j) + "glry", irit.list( c, viewptcurves ) ) j = j + 1 # ############################################################################
ptc = (0, 0, 0) pt1 = (math.cos(0), math.sin(0), 0) pt2 = (math.cos(d), math.sin(d), 0) pt3 = (math.cos(d * 2), math.sin(d * 2), 0) pt4 = (math.cos(d * 3), math.sin(d * 3), 0) pt5 = (math.cos(d * 4), math.sin(d * 4), 0) star = irit.list(irit.poly(irit.list(ptc, pt1, pt2), irit.FALSE), irit.poly(irit.list(ptc, pt2, pt3), irit.FALSE), irit.poly(irit.list(ptc, pt3, pt4), irit.FALSE), irit.poly(irit.list(ptc, pt4, pt5), irit.FALSE), irit.poly(irit.list(ptc, pt5, pt1), irit.FALSE)) * irit.rz(90) irit.color(star, irit.WHITE) irit.SetResolution(80) circ = irit.circpoly((0, 0, 1), (0, 0, 0), 1) * irit.tz((-0.01)) irit.color(circ, irit.BLUE) irit.attrib(circ, "rgb", irit.GenStrObject("0,0,8")) irit.SetResolution(20) logo1 = irit.list(circ, star) irit.interact(logo1) irit.save("logo1", logo1) irit.free(logo1) # ################################ eps = 0.12
pt3 = irit.point(irit.random((-0.5), 0.5), irit.random((-0.5), 0.5), 0) pl = irit.poly(irit.list(pt1, pt2, pt3), irit.FALSE) irit.color(pl, irit.GREEN) ellimp = irit.ellipse3pt(irit.Fetch3TupleObject(pt1), irit.Fetch3TupleObject(pt2), irit.Fetch3TupleObject(pt3), 0) ell = irit.conicsec(ellimp, 0, 0, 0) irit.color(ell, irit.YELLOW) irit.adwidth(ell, 2) i = 10 while (i <= n): m = irit.rz(i) * irit.rx(i * 2) * irit.ry(i * 3) * irit.sc( i / 360.0) * irit.tx(i / 360.0 - 1) * irit.tz(i / 720.0 - 0.5) ell3imp = irit.cnc2quad(ellimp, i / 1000.0) ell3imp = irit.implctrans(2, ell3imp, m) ell3 = irit.quadric(ell3imp) irit.color(ell3, irit.MAGENTA) all = irit.list(irit.GetAxes(), ell3, ell) irit.view(all, irit.ON) irit.milisleep(100) i = i + 10 irit.save("ellips4", all) # ############################################################################ irit.viewstate("widthlines", 0)
irit.ctlpt( irit.E2, 0.4, 0.4 ), \ irit.ctlpt( irit.E2, 0.5, 0 ) ), irit.list( irit.KV_OPEN ) ), 0, 2 ) crv2 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E3, (-0.5 ), 0, 0 ), \ irit.ctlpt( irit.E3, (-0.4 ), 0.3, 0 ), \ irit.ctlpt( irit.E3, (-0.3 ), 0.4, 0 ), \ irit.ctlpt( irit.E3, (-0.07 ), 0.46, 0 ), \ irit.ctlpt( irit.E3, 0, 0.75, 0 ), \ irit.ctlpt( irit.E3, 0.07, 0.46, 0 ), \ irit.ctlpt( irit.E3, 0.3, 0.4, 0 ), \ irit.ctlpt( irit.E3, 0.4, 0.3, 0 ), \ irit.ctlpt( irit.E3, 0.5, 0, 0 ) ), irit.list( 0, 0, 0, 0, 0.8, 0.85,\ 1, 1.15, 1.2, 2, 2, 2,\ 2 ) ) srf = irit.sfromcrvs( irit.list(crv2, crv2 * irit.tz(0.02), crv * irit.sc(0.96) * irit.tz(0.2), crv * irit.sc(0.87) * irit.tz(0.35), crv * irit.sc(0.7) * irit.tz(0.5)), 3, irit.KV_OPEN) irit.free(crv) irit.free(crv2) tcrvs1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.3, 1.4 ), \ irit.ctlpt( irit.E2, 0.7, 1.4 ), \ irit.ctlpt( irit.E2, 0.7, 2.2 ), \ irit.ctlpt( irit.E2, 0.3, 2.2 ) ), irit.list( irit.KV_PERIODIC ) ) tcrvs2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 1.3, 1.4 ), \ irit.ctlpt( irit.E2, 1.7, 1.4 ), \ irit.ctlpt( irit.E2, 1.7, 2.2 ), \ irit.ctlpt( irit.E2, 1.3, 2.2 ) ), irit.list( irit.KV_PERIODIC ) ) tcrvs3 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 0 ), \
# save_res = irit.GetResolution() save_mat = irit.GetViewMatrix() irit.SetViewMatrix( irit.GetViewMatrix() * irit.sc( 0.3 )) irit.viewobj( irit.GetViewMatrix() ) irit.SetViewMatrix( save_mat) # ############################################################################ # # Cylinder-Cylinder intersection # s1 = irit.cylinsrf( 4, 1 ) * irit.tz( (-2 ) ) irit.color( s1, irit.RED ) c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, 0, 0, (-1 ) ), \ irit.ctlpt( irit.E3, 0, 0, 1 ) ) ) r1 = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 1 ) ) ) s2 = irit.cylinsrf( 4, 1 ) * irit.tz( (-2 ) ) * irit.rx( 90 ) * irit.tx( 0.5 ) irit.color( s2, irit.MAGENTA ) c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, 0.5, (-1 ), 0 ), \ irit.ctlpt( irit.E3, 0.5, 1, 0 ) ) ) r2 = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 1 ) ) ) zerosetsrf = irit.coerce( irit.gginter( c1, r1, c2, r2, 10, 1 ),\ irit.E3 ) * irit.rotx( (-90 ) ) * irit.roty( (-90 ) ) irit.SetResolution( 100) zeroset = irit.contour( zerosetsrf, irit.plane( 0, 0, 1, 0 ) )
import math import irit # # # Combination of a square, triangle, and a circle # # Gershon Elber, Feb 2009. # # # The Sqriancle # c = irit.circle((0, 0, 0), 1) stc = irit.ruledsrf(c, c * irit.tz(2) * irit.sx(0.0001)) irit.attrib(stc, "rgb", irit.GenStrObject("255, 200, 200")) stcisos = irit.getisocurvetubes(stc, 8, 4, 0.03) irit.attrib(stcisos, "rgb", irit.GenStrObject("25, 20, 200")) irit.attrib(stcisos, "specilar", irit.GenRealObject(2)) irit.view(irit.list(stc, stcisos), irit.ON) irit.save("sqriacle", irit.list(stc, stcisos)) irit.pause() irit.free(c) irit.free(stc) irit.free(stcisos)
irit.color(wig, irit.RED) paramumb = irit.sumbilic(wig, 0.05, 0.0001) irit.interact(irit.list(evaltoeuclidean(wig, paramumb), wig)) irit.free(wig) irit.free(c) irit.free(s) irit.free(paramumb) # ############################################################################ # Mean curvature evolute of surfaces. # ############################################################################ c1 = irit.pcircle((0, 0, 0), 1) scone = irit.ruledsrf(c1, c1 * irit.sc(0.1) * irit.tz(1)) irit.color(scone, irit.YELLOW) sconeev = irit.evolute(scone) irit.color(sconeev, irit.GREEN) irit.interact(irit.list(irit.GetAxes(), scone, sconeev)) scylin = irit.ruledsrf(c1, c1 * irit.tz(1)) irit.color(scylin, irit.YELLOW) scylinev = irit.evolute(scylin) irit.color(scylinev, irit.GREEN) irit.interact(irit.list(irit.GetAxes(), scylin, scylinev)) irit.save("sevolute", irit.list(irit.GetAxes(), scylin, scylinev, scone, sconeev)) irit.free(scone)
all = irit.list( warpedteapot, prmdomain ) * irit.rx( 90 ) * irit.ry( 20 ) * irit.rx( 10 ) * irit.sc( 0.5 ) interact( irit.list( all, irit.GetViewMatrix() ) ) irit.save( "warp2trv", all ) # ############################################################################ # # Let the Genie come out of the teapot... # teapot = teapotorig * irit.sc( 0.2 ) * irit.sx( (-1 ) ) * irit.rx( 90 ) * irit.rz( 180 ) s = irit.planesrf( (-1 ), (-1 ), 1, 1 ) * irit.sc( 1.7 ) discs = irit.list( s * irit.sc( 0.01 ) * irit.sx( 2 ) * irit.tx( 0.58 ) * irit.tz( 0.42 ), s * irit.sc( 0.01 ) * irit.sx( 2 ) * irit.tx( 0.62 ) * irit.tz( 0.46 ), s * irit.sc( 0.05 ) * irit.sx( 1.5 ) * irit.tx( 0.65 ) * irit.tz( 0.55 ), s * irit.sc( 0.07 ) * irit.sx( 1.5 ) * irit.tx( 0.7 ) * irit.tz( 0.7 ), s * irit.sc( 0.09 ) * irit.sx( 1.5 ) * irit.tx( 0.65 ) * irit.tz( 0.85 ), s * irit.sc( 0.08 ) * irit.sx( 1.5 ) * irit.tx( 0.7 ) * irit.tz( 1 ), s * irit.sc( 0.07 ) * irit.tx( 0.7 ) * irit.tz( 1.1 ) ) tv = irit.tfromsrfs( discs, 3, irit.KV_OPEN ) # Create a refined cylinder to warp out of the teapot... c = irit.creparam( irit.pcircle( ( 0.5, 0.5, 0.001 ), 0.45 ), 0, 1 ) srf = irit.extrude( c, ( 0, 0, 0.99 ), 0 ) srf = irit.srefine( irit.srefine( srf, irit.COL, 0, irit.list( 0.1, 0.2, 0.3, 0.4, 0.6, 0.7,\ 0.8, 0.9 ) ), irit.ROW, 0, irit.list( 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,\ 0.7, 0.8, 0.9 ) ) warpedsrf = warpsurface( (-srf ), tv ) irit.attrib( warpedsrf, "ptexture", irit.GenStrObject("g.gif" )) irit.view( irit.list( teapot, warpedsrf ), irit.ON ) irit.save( "warp3trv", all )
irit.attrib(cntrs, "dwidth", irit.GenRealObject(3)) irit.color(cntrs, irit.RED) irit.interact(irit.list(c, p, cntrs)) irit.free(c) irit.free(p) irit.free(cntrs) # # Simple self intersecting surface. # c1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0, (-1 ), 0 ), \ irit.ctlpt( irit.E3, 0, 1, 0.2 ), \ irit.ctlpt( irit.E3, 1, 0, 0.4 ), \ irit.ctlpt( irit.E3, (-1 ), 0, 0.6 ) ), irit.list( irit.KV_OPEN ) ) s1 = irit.ruledsrf(c1, c1 * irit.tz(1) * irit.rz(10)) irit.color(s1, irit.GREEN) irit.SetResolution(30) # # Computing self intersection by a Boolean operation with itself - Parametric. # dummy = irit.iritstate("intercrv", irit.GenRealObject(1)) uvbool = irit.iritstate("uvboolean", irit.GenRealObject(1)) s1inter = (s1 + s1) irit.color(s1inter, irit.RED) irit.attrib(s1inter, "dwidth", irit.GenRealObject(3)) paramdomain = irit.poly(irit.list((0, 0, 0), (0, 1, 0), (2, 1, 0), (2, 0, 0)), irit.FALSE)
# Gershon Elber, May 1998 # ri = irit.iritstate("randominit", irit.GenRealObject(1964)) # Seed-initiate the randomizer, irit.free(ri) size = 0.25 v1 = (0, 0, 0) v2 = (size * 3, 0, 0) v3 = (size * 3, size * 3, 0) v4 = (0, size * 3, 0) plaux = irit.poly(irit.list(v1, v2, v3, v4, v1), irit.TRUE) cubebbox = irit.list(plaux, plaux * irit.tz(size * 3), plaux * irit.rx(90), plaux * irit.rx(90) * irit.ty(size * 3), plaux * irit.ry((-90)), plaux * irit.ry((-90)) * irit.tx(size * 3)) irit.attrib(cubebbox, "rgb", irit.GenStrObject("255, 255, 255")) irit.free(plaux) def cubeat(x, y, z): retval = irit.box((x - size / 2.0, y - size / 2.0, z - size / 2.0), size, size, size) irit.attrib( retval, "rgb", irit.GenStrObject( str(int(irit.random(64, 255))) + "," + str(int(irit.random(64, 255))) + "," +
# # Define the FFD trivariate # teapot = teapotorig * \ irit.sc( 0.2 ) * \ irit.sx( (-1 ) ) * \ irit.rx( 90 ) * \ irit.rz( 180 ) s = irit.planesrf((-1), (-1), 1, 1) * irit.sc(2.4) discs = irit.list( s * \ irit.sc( 0.02 ) * \ irit.sx( 2 ) * \ irit.tx( 0.56 ) * \ irit.tz( 0.42 ), s * \ irit.sc( 0.02 ) * \ irit.sx( 2 ) * \ irit.trans( ( 0.66, 0, 0.5 ) ), s * \ irit.sc( 0.04 ) * \ irit.sx( 1.5 ) * \ irit.trans( ( 0.66, 0, 0.7 ) ), s * \ irit.sc( 0.15 ) * \ irit.sx( 1.5 ) * \ irit.trans( ( 0.1, (-0.1 ), 1 ) ), s * \ irit.sc( 0.21 ) * \ irit.sx( 1.5 ) * \
irit.ctlpt( irit.E2, 0, 1 ) ) ) * irit.tx( 0.3 ) * irit.ty( 0.5 ) irit.adwidth( c, 3 ) k = irit.crvkernel( c, 15, 0, irit.GenIntObject(2), 2 ) irit.color( k, irit.YELLOW ) irit.interact( irit.list( c, k, irit.GetAxes() ) ) # ############################################################################ c = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-1 ), 1 ), \ irit.ctlpt( irit.E2, 0, (-1 ) ), \ irit.ctlpt( irit.E2, 1, 1 ) ) ) irit.adwidth( c, 3 ) irit.color( c, irit.RED ) ct = c * irit.tz( 1 ) k1 = irit.coerce( irit.crvkernel( c, 50, 0, irit.GenIntObject(1), 2 ), 13 ) * irit.sz( 0.7 ) irit.color( k1, irit.YELLOW ) k2 = irit.coerce( irit.crvkernel( c, (-50 ), 0, irit.GenIntObject(1), 2 ), 13 ) * irit.sz( 0.7 ) irit.color( k2, irit.CYAN ) # # The entire trivariate - paramterizing along the curve, gamma, and line. # irit.interact( irit.list( ct, k1, k2, irit.GetAxes() ) ) irit.save( "gama2krn", irit.list( ct, k1, k2 ) ) #
s = irit.spheresrf(1.1) * irit.sx(2) * irit.sy(1.2) d = irit.duality(s) irit.color(d, irit.YELLOW) view_mat1 = irit.GetViewMatrix() * irit.sc(0.5) irit.interact(irit.list(s, d, irit.GetAxes(), view_mat1)) # # A ruled surface # s = irit.ruledsrf( irit.ctlpt( irit.E3, (-1 ), (-1 ), 0.2 ) + \ irit.ctlpt( irit.E3, (-1 ), 1, (-0.2 ) ), \ irit.ctlpt( irit.E3, 1, (-1 ), (-0.2 ) ) + \ irit.ctlpt( irit.E3, 1, 1, 0.2 ) ) * irit.tz( 0.35 ) d = irit.duality(s) irit.color(d, irit.YELLOW) view_mat1 = irit.GetViewMatrix() * irit.sc(0.3) * irit.ty(0.5) irit.interact(irit.list(s, d, irit.GetAxes(), view_mat1)) # # A saddle surface # s = irit.sbezier( irit.list( irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \ irit.ctlpt( irit.E3, 0.05, 0.2, 0.1 ), \ irit.ctlpt( irit.E3, 0.1, 0.05, 0.2 ) ), irit.list( \ irit.ctlpt( irit.E2, 0.1, (-0.2 ) ), \ irit.ctlpt( irit.E3, 0.15, 0.05, 0.1 ), \