def rook(s, clr): rookbase = (-irit.surfprev( ( irit.ctlpt( irit.E2, 0.001, 0.55 ) + \ irit.ctlpt( irit.E2, 0.11, 0.55 ) + \ irit.ctlpt( irit.E2, 0.11, 0.63 ) + \ irit.ctlpt( irit.E2, 0.13, 0.63 ) + irit.cbspline( 3, irit.list( \ irit.ctlpt( irit.E2, 0.13, 0.53 ), \ irit.ctlpt( irit.E2, 0.05, 0.51 ), \ irit.ctlpt( irit.E2, 0.07, 0.29 ), \ irit.ctlpt( irit.E2, 0.18, 0.12 ), \ irit.ctlpt( irit.E2, 0.18, 0 ) ), irit.list( irit.KV_OPEN ) ) ) * irit.rx( 90 ) ) ) axs = irit.crefine( irit.creparam( irit.pcircle( ( 0, 0, 0 ), 1 ), 0, 1 ),\ 0, irit.list( 0.05, 0.1, 0.15, 0.2, 0.3, 0.35,\ 0.4, 0.45, 0.55, 0.6, 0.65, 0.7,\ 0.8, 0.85, 0.9, 0.95 ) ) scl = irit.cbspline( 2, irit.list( \ irit.ctlpt( irit.E2, 0, 0.01 ), \ irit.ctlpt( irit.E2, 0.5, 0.01 ), \ irit.ctlpt( irit.E2, 0.5, 1 ), \ irit.ctlpt( irit.E2, 1, 1 ), \ irit.ctlpt( irit.E2, 0, 0.01 ) ), irit.list( 0, 0, 0.7, 0.701, 1.999, 2,\ 3 ) ) scl = irit.creparam( scl + scl * irit.tx( 1 ) + scl * irit.tx( 2 ) + scl * irit.tx( 3 ) + scl * irit.tx( 4 ) + scl * irit.tx( 5 ) + \ irit.ctlpt( irit.E2, 6, 0.01 ), 0, 1 ) rookwall = irit.swpsclsrf( \ irit.ctlpt( irit.E2, (-0.08 ), 0 ) + \ irit.ctlpt( irit.E2, 0.08, 0 ) + \ irit.ctlpt( irit.E2, 0.08, 0.6 ) + \ irit.ctlpt( irit.E2, (-0.08 ), 0.6 ) + \ irit.ctlpt( irit.E2, (-0.08 ), 0 ), axs, scl, irit.point( 0, 0, 1 ), 2 ) * irit.sc( 0.12 ) * irit.tz( 0.63 ) irit.attrib(rookwall, "rgb", irit.GenStrObject("255,255,100")) irit.attrib(rookbase, "rgb", irit.GenStrObject(clr)) retval = irit.list(rookbase, rookwall) * irit.sc(s) return retval
def makerottransanimobj(rot, trns): if (irit.SizeOf(rot) > 0): rot_z = irit.cbspline(2, rot, irit.list(irit.KV_OPEN)) mov_xyz = irit.cbspline(2, trns, irit.list(irit.KV_OPEN)) retval = irit.list(rot_z, mov_xyz) else: mov_xyz = irit.cbspline(2, trns, irit.list(irit.KV_OPEN)) retval = irit.list(mov_xyz) return retval
def bishop(s, clr): retval = (-irit.surfprev( irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.0001, 0.82 ), \ irit.ctlpt( irit.E2, 0.028, 0.82 ), \ irit.ctlpt( irit.E2, 0.028, 0.77 ), \ irit.ctlpt( irit.E2, 0.01, 0.77 ), \ irit.ctlpt( irit.E2, 0.01, 0.765 ), \ irit.ctlpt( irit.E2, 0.06, 0.76 ), \ irit.ctlpt( irit.E2, 0.09, 0.69 ), \ irit.ctlpt( irit.E2, 0.06, 0.625 ), \ irit.ctlpt( irit.E2, 0.02, 0.62 ), \ irit.ctlpt( irit.E2, 0.02, 0.61 ), \ irit.ctlpt( irit.E2, 0.08, 0.6 ), \ irit.ctlpt( irit.E2, 0.08, 0.59 ), \ irit.ctlpt( irit.E2, 0.03, 0.58 ), \ irit.ctlpt( irit.E2, 0.03, 0.56 ), \ irit.ctlpt( irit.E2, 0.12, 0.55 ), \ irit.ctlpt( irit.E2, 0.12, 0.53 ), \ irit.ctlpt( irit.E2, 0.05, 0.51 ), \ irit.ctlpt( irit.E2, 0.07, 0.29 ), \ irit.ctlpt( irit.E2, 0.18, 0.12 ), \ irit.ctlpt( irit.E2, 0.18, 0 ) ), irit.list( irit.KV_OPEN ) ) * irit.rx( 90 ) ) ) * irit.sc( s ) bishoptop = irit.sregion(retval, irit.ROW, 0, 0.1) bishopbody = irit.sregion(retval, irit.ROW, 0.1, 1) irit.attrib(bishoptop, "rgb", irit.GenStrObject("255,255,100")) irit.attrib(bishopbody, "rgb", irit.GenStrObject(clr)) retval = irit.list(bishopbody, bishoptop) return retval
def antrleganim(s): retval = antleg() * irit.ry(180) t = 0.2 * (s + 1) / 2 rot_y = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E1, 13 * s ), \ irit.ctlpt( irit.E1, (-13 ) * s ), \ irit.ctlpt( irit.E1, (-13 ) * s ), \ irit.ctlpt( irit.E1, 13 * s ) ), irit.list( 0, 0, 1.3, 1.7, 3, 3 ) ),\ 0 + t, 1 + t ) rot_z = irit.creparam( irit.cbspline( 2, irit.list( \ irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 7 + 7 * s ), \ irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 7 - 7 * s ), \ irit.ctlpt( irit.E1, 0 ) ), irit.list( irit.KV_OPEN ) ), 0 + t, 1 + t ) irit.attrib(retval, "animation", irit.list(rot_z, rot_y)) return retval
def getbisectcrv( crv1, crv2, cntr ): ptlist = irit.nil( ) i = 0 while ( i <= irit.SizeOf( cntr ) - 1 ): pt = irit.coord( cntr, i ) pt1 = irit.ceval( crv1, irit.coord( pt, 0 ) ) pt2 = irit.ceval( crv2, irit.coord( pt, 1 ) ) nrml1 = irit.cnormalplnr( crv1, irit.coord( pt, 0 ) ) nrml2 = irit.cnormalplnr( crv2, irit.coord( pt, 1 ) ) interpts = irit.ptslnln( irit.coerce( pt1, irit.POINT_TYPE ), nrml1, irit.coerce( pt2, irit.POINT_TYPE ), nrml2 ) irit.snoc( irit.nth( interpts, 1 ), ptlist ) i = i + 1 retval = irit.cbspline( 2, ptlist, irit.list( irit.KV_OPEN ) ) return retval
def genrandomcrv(d, n, size): ctlpts = irit.nil() i = 1 while (i <= n): irit.snoc( irit.ctlpt(irit.E2, irit.random((-size), size), irit.random((-size), size)), ctlpts) i = i + 1 retval = irit.cbspline( d, ctlpts * irit.tx(irit.random((-1), 1)) * irit.ty(irit.random((-1), 1)), irit.list(irit.KV_PERIODIC)) retval = irit.coerce(retval, irit.KV_OPEN) return retval
def marbleshelfunit( w, h ): prof1 = ( irit.ctlpt( irit.E3, 2 * w, 0, 0 ) + irit.cbspline( 3, irit.list( \ irit.ctlpt( irit.E3, 2 * w, w, 0 ), \ irit.ctlpt( irit.E3, 2 * w, 2 * w, 0 ), \ irit.ctlpt( irit.E3, w, 2 * w, 0 ) ), irit.list( irit.KV_OPEN ) ) + \ irit.ctlpt( irit.E3, 0, 2 * w, 0 ) ) prof2 = ( \ irit.ctlpt( irit.E3, 0, 2 * w, 0 ) + \ irit.ctlpt( irit.E3, 0, 0, 0 ) + \ irit.ctlpt( irit.E3, 2 * w, 0, 0 ) ) retval = irit.list( irit.extrude( prof1 + prof2, ( 0, 0, 0.025 ), 0 ), irit.ruledsrf( prof1, (-prof2 ) ), irit.ruledsrf( prof1, (-prof2 ) ) * irit.tz( 0.025 ) ) * irit.tz( h ) irit.attrprop( retval, "ptexture", marbletext ) irit.attrprop( retval, "rgb", marbleclr ) return retval
def computesphericalcrv(theta1, theta2, phi1, phi2): ptlist = irit.nil() t = 0 while (t <= 100): theta = (theta2 * t + theta1 * (100 - t)) * math.pi / (180 * 100) phi = (phi2 * t + phi1 * (100 - t)) * math.pi / (180 * 100) irit.snoc( irit.point( math.cos(theta) * math.cos(phi), math.cos(theta) * math.sin(phi), math.sin(theta)), ptlist) t = t + 1 retval = irit.cbspline(2, ptlist, irit.list(irit.KV_OPEN)) irit.attrib(retval, "dwidth", irit.GenRealObject(3)) irit.color(retval, irit.RED) return retval
def pawn(s, clr): retval = (-irit.surfprev( irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.0001, 0.635 ), \ irit.ctlpt( irit.E2, 0.06, 0.63 ), \ irit.ctlpt( irit.E2, 0.08, 0.56 ), \ irit.ctlpt( irit.E2, 0.06, 0.52 ), \ irit.ctlpt( irit.E2, 0.03, 0.5 ), \ irit.ctlpt( irit.E2, 0.03, 0.49 ), \ irit.ctlpt( irit.E2, 0.1, 0.48 ), \ irit.ctlpt( irit.E2, 0.1, 0.46 ), \ irit.ctlpt( irit.E2, 0.04, 0.44 ), \ irit.ctlpt( irit.E2, 0.05, 0.25 ), \ irit.ctlpt( irit.E2, 0.15, 0.1 ), \ irit.ctlpt( irit.E2, 0.15, 0 ) ), irit.list( irit.KV_OPEN ) ) * irit.rx( 90 ) ) ) * irit.sc( s ) irit.attrib(retval, "rgb", irit.GenStrObject(clr)) return retval
def queen(s, clr): queenbase = (-irit.surfprev( irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.001, 1.01 ), \ irit.ctlpt( irit.E2, 0.02, 1.01 ), \ irit.ctlpt( irit.E2, 0.02, 0.972 ), \ irit.ctlpt( irit.E2, 0.01, 0.972 ), \ irit.ctlpt( irit.E2, 0.01, 0.97 ), \ irit.ctlpt( irit.E2, 0.09, 0.96 ), \ irit.ctlpt( irit.E2, 0.1, 0.912 ), \ irit.ctlpt( irit.E2, 0.1, 0.911 ), \ irit.ctlpt( irit.E2, 0.12, 0.911 ), \ irit.ctlpt( irit.E2, 0.12, 0.91 ), \ irit.ctlpt( irit.E2, 0.09, 0.84 ), \ irit.ctlpt( irit.E2, 0.07, 0.76 ), \ irit.ctlpt( irit.E2, 0.07, 0.74 ), \ irit.ctlpt( irit.E2, 0.085, 0.74 ), \ irit.ctlpt( irit.E2, 0.085, 0.72 ), \ irit.ctlpt( irit.E2, 0.07, 0.72 ), \ irit.ctlpt( irit.E2, 0.07, 0.7 ), \ irit.ctlpt( irit.E2, 0.1, 0.68 ), \ irit.ctlpt( irit.E2, 0.1, 0.66 ), \ irit.ctlpt( irit.E2, 0.14, 0.64 ), \ irit.ctlpt( irit.E2, 0.14, 0.62 ), \ 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 ) ) ) queencrwn = (-irit.swpsclsrf( \ irit.ctlpt( irit.E2, (-0.1 ), 0 ) + \ irit.ctlpt( irit.E2, 0.1, 0 ) + \ irit.ctlpt( irit.E2, (-0.42 ), (-0.7 ) ) + \ irit.ctlpt( irit.E2, (-0.44 ), (-0.7 ) ) + \ irit.ctlpt( irit.E2, (-0.1 ), 0 ), irit.pcircle( ( 0, 0, 0 ), 1 ), irit.creparam( irit.coerce( irit.cbspline( 3, irit.list( \ irit.ctlpt( irit.E2, 0, (-0.3 ) ), \ irit.ctlpt( irit.E2, 1, 1.5 ), \ irit.ctlpt( irit.E2, 2, (-0.3 ) ), \ irit.ctlpt( irit.E2, 3, 1.5 ), \ irit.ctlpt( irit.E2, 4, (-0.3 ) ), \ irit.ctlpt( irit.E2, 5, 1.5 ), \ irit.ctlpt( irit.E2, 6, (-0.3 ) ), \ irit.ctlpt( irit.E2, 7, 1.5 ), \ irit.ctlpt( irit.E2, 8, (-0.3 ) ), \ irit.ctlpt( irit.E2, 9, 1.5 ), \ irit.ctlpt( irit.E2, 10, (-0.3 ) ), \ irit.ctlpt( irit.E2, 11, 1.5 ) ), irit.list( irit.KV_PERIODIC ) ), irit.KV_OPEN ), 0, 1 ), irit.point( 0, 0, (-1 ) ), 2 ) ) * irit.sc( 0.11 ) * irit.tz( 0.911 ) irit.attrib(queencrwn, "rgb", irit.GenStrObject("255,255,100")) irit.attrib(queenbase, "rgb", irit.GenStrObject(clr)) retval = irit.list(queenbase, queencrwn) * irit.sc(s) return retval
def genrandomcrv(d, n, size): ctlpts = irit.nil() i = 1 while (i <= n): irit.snoc( irit.ctlpt(irit.E2, irit.random((-size), size), irit.random((-size), size)), ctlpts) i = i + 1 if (irit.random(0, 1) > 0.3): kv = irit.KV_PERIODIC else: kv = irit.KV_OPEN retval = irit.cbspline( d, ctlpts * irit.tx(irit.random( (-0.2), 0.2)) * irit.ty(irit.random((-0.2), 0.2)), irit.list(kv)) retval = irit.coerce(retval, irit.KV_OPEN) 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
# Seed-initiate the randomizer, irit.free(ri) # ############################################################################ pts = irit.nil() len = 1 numpts = 5 i = 0 while (i <= numpts): r = irit.random(0, 2) pt = irit.ctlpt(irit.E2, len * r * math.cos(i * 2 * math.pi / numpts), len * r * math.sin(i * 2 * 3.14159 / numpts)) irit.snoc(pt, pts) i = i + 1 c0 = irit.coerce(irit.cbspline(4, pts, irit.list(irit.KV_PERIODIC)), irit.KV_OPEN) irit.color(c0, irit.RED) irit.adwidth(c0, 4) pts = irit.nil() len = 1 numpts = 7 i = 0 while (i <= numpts): r = irit.random(0, 2) pt = irit.ctlpt(irit.E2, len * r * math.cos(i * 2 * math.pi / numpts), len * r * math.sin(i * 2 * 3.14159 / numpts)) irit.snoc(pt, pts) i = i + 1 c1 = irit.coerce(irit.cbspline(4, pts, irit.list(irit.KV_PERIODIC)),
view_mat1 = irit.tx(0) irit.viewobj(view_mat1) # ############################################################################ c1 = ( irit.ctlpt( irit.E2, 0, 2 ) + \ irit.ctlpt( irit.E2, 0, (-2 ) ) ) irit.color(c1, irit.GREEN) c2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, (-0.0448 ), 0.808, 0 ), \ irit.ctlpt( irit.E2, (-0.193 ), 0.201 ), \ irit.ctlpt( irit.E2, (-0.867 ), 0.179 ), \ irit.ctlpt( irit.E2, (-0.151 ), (-0.309 ) ), \ irit.ctlpt( irit.E2, (-0.517 ), (-0.666 ) ), \ irit.ctlpt( irit.E2, 0.00856, (-0.84 ) ), \ irit.ctlpt( irit.E2, 0.327, (-0.704 ) ), \ irit.ctlpt( irit.E2, 0.147, (-0.109 ) ), \ irit.ctlpt( irit.E2, 0.33, (-0.0551 ) ), \ irit.ctlpt( irit.E2, 0.486, 0.142 ), \ irit.ctlpt( irit.E2, 0.393, 0.623 ) ), irit.list( irit.KV_PERIODIC ) ) c2 = irit.coerce(c2, irit.KV_OPEN) irit.color(c2, irit.YELLOW) r = 0.1 pts = irit.crc2crvtan(c1, c2, r, 1e-006) ptsdsp = displayptscrctan2crvs(pts, r, c1, c2) irit.interact(irit.list(c1, c2, ptsdsp)) irit.save("crv1tan", irit.list(c1, c2, ptsdsp))
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Approximation of curves using piecewise cubic/quadratic polynomials # # ################################ crv = irit.cbspline( 6, 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 ) irit.attrib( crv, "width", irit.GenRealObject(0.02 )) q1 = irit.quadcrvs( crv, 0.02, (-1 ) ) 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 ) )
l = l + 0.1 irit.interact(irit.list(irit.GetAxes(), x, allcntrs)) irit.save("contour2", irit.list(irit.GetAxes(), x, allcntrs)) irit.free(x) irit.free(c) irit.free(allcntrs) # ############################################################################ c = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.7, 0.6 ), \ irit.ctlpt( irit.E2, 0.17, (-0.13 ) ), \ irit.ctlpt( irit.E2, (-0.03 ), 0.7 ), \ irit.ctlpt( irit.E2, (-0.8 ), 0.7 ), \ irit.ctlpt( irit.E2, (-0.8 ), (-0.7 ) ), \ irit.ctlpt( irit.E2, (-0.03 ), (-0.7 ) ), \ irit.ctlpt( irit.E2, 0.17, 0.13 ), \ irit.ctlpt( irit.E2, 0.7, (-0.6 ) ) ), irit.list( irit.KV_OPEN ) ) irit.color(c, irit.RED) irit.view(irit.list(irit.GetAxes(), c), irit.ON) allcntrs = irit.nil() x = (-0.7) while (x <= 0.7): cntrpts = irit.contour(c, irit.plane(1, 0, 0, x)) cntr = irit.ceval( c, irit.FetchRealObject(irit.coord( irit.coord( cntrpts, 0 ), 0 ) )) + \ irit.ceval( c, irit.FetchRealObject(irit.coord( irit.coord( cntrpts, 1 ), 0 ) )) irit.viewobj(cntr) irit.milisleep(50)
block1 = (irit.box(((-3), (-3), (-3)), 2.5, 6, 6) - irit.box( ((-1), (-4), (-0.5)), 1, 8, 1) + irit.box( ((-5), (-0.5), (-4)), 6, 1, 8) + irit.box(((-1.001), (-1), (-0.5)), (-0.5), 2, 1)) irit.attrib(block1, "rgb", irit.GenStrObject("50, 100, 255")) block2 = block1 * irit.rz(180) irit.attrib(block2, "rgb", irit.GenStrObject("100, 50, 255")) # # Add the animation curves: # mov_xyz = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \ irit.ctlpt( irit.E3, 0, 0, 16 ), \ irit.ctlpt( irit.E3, 0, 4, 16 ) ), irit.list( irit.KV_OPEN ) ), 0, 2 ) irit.attrib(stick1, "animation", mov_xyz) irit.free(mov_xyz) mov_xyz = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \ irit.ctlpt( irit.E3, 0, 0, 16 ), \ irit.ctlpt( irit.E3, 0, (-2 ), 16 ) ), irit.list( irit.KV_OPEN ) ), 0, 2 ) irit.attrib(bar1, "animation", mov_xyz) irit.free(mov_xyz) mov_xyz = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \ irit.ctlpt( irit.E3, 0, (-1 ), 0 ), \ irit.ctlpt( irit.E3, 0, (-1 ), 12 ) ), irit.list( irit.KV_OPEN ) ), 2, 3 ) irit.attrib(bar2, "animation", mov_xyz) irit.free(mov_xyz)
import math import irit # # # A simple turbinee blade, Gershon Elber, Feb 2004 # # # 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)
c1 = ( irit.ctlpt( irit.E3, 0, 0, 0 ) + \ irit.ctlpt( irit.E3, 0, 1, 0 ) ) c2 = ( irit.ctlpt( irit.E3, 1, 0, 0 ) + \ irit.ctlpt( irit.E3, 1, 1, 0 ) ) d1 = ( irit.ctlpt( irit.E3, 1, 0, 1 ) + \ irit.ctlpt( irit.E3, 1, 0, 0.1 ) ) d2 = ( irit.ctlpt( irit.E3, 1, 0, (-0.1 ) ) + \ irit.ctlpt( irit.E3, 1, 0, (-1 ) ) ) s1 = irit.hermite(c1, c2, d1, d2) irit.color(s1, irit.RED) csec1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-1 ), 0 ), \ irit.ctlpt( irit.E2, (-1 ), 0 ), \ irit.ctlpt( irit.E2, 1, 0 ), \ irit.ctlpt( irit.E2, 1, 0 ) ), irit.list( irit.KV_OPEN ) ) csec2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-1 ), 0 ), \ irit.ctlpt( irit.E2, (-1 ), 0 ), \ irit.ctlpt( irit.E2, (-0.14 ), 0.26 ), \ irit.ctlpt( irit.E2, (-0.65 ), 0.51 ), \ irit.ctlpt( irit.E2, 0, 0.76 ), \ irit.ctlpt( irit.E2, 0.65, 0.51 ), \ irit.ctlpt( irit.E2, 0.14, 0.26 ), \ irit.ctlpt( irit.E2, 1, 0 ), \ irit.ctlpt( irit.E2, 1, 0 ) ), irit.list( irit.KV_OPEN ) ) n = ( irit.ctlpt( irit.E3, 0, 0, 1 ) + \ irit.ctlpt( irit.E3, 0, 0, 1 ) )
# ############################################################################ pl2 = irit.nil() x = 0 while (x <= 5): irit.snoc( irit.point(math.cos(x * math.pi / 10), math.sin(x * 3.14159 / 10), 0), pl2) x = x + 1 crv1 = irit.cinterp(pl2, 4, 4, irit.GenRealObject(irit.PARAM_UNIFORM), 0) irit.viewobj(irit.list(pl2, crv1)) crv2 = irit.cbspline( 5, irit.list( irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 0 ), \ irit.ctlpt( irit.E1, 1 ) ), irit.list( irit.KV_OPEN ) ) cbsp = irit.compose(crv1, crv2) irit.free(crv1) irit.free(crv2) steps = 8 pt_lst = irit.nil() i = 0 while (i <= steps - 1): pt = irit.ceval( cbsp, irit.FetchRealObject(irit.nth(irit.pdomain(cbsp), 2)) * i / (steps - 1)) irit.snoc(pt, pt_lst)
irit.snoc( crv1b, crvs ) i = 1 while ( i <= irit.SizeOf( crvs ) ): c = irit.nth( crvs, i ) irit.color( c, irit.YELLOW ) irit.view( irit.list( crv1a, crv1b, c ), irit.ON ) i = i + 1 irit.pause( ) # ############################################################################ crv1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 0 ), \ irit.ctlpt( irit.E2, 0, 0.1 ), \ irit.ctlpt( irit.E2, 0.1, 0.1 ), \ irit.ctlpt( irit.E2, 0.1, (-0.1 ) ), \ irit.ctlpt( irit.E2, (-0.1 ), (-0.1 ) ), \ irit.ctlpt( irit.E2, (-0.1 ), 0.2 ), \ irit.ctlpt( irit.E2, 0.2, 0.2 ), \ irit.ctlpt( irit.E2, 0.2, (-0.2 ) ), \ irit.ctlpt( irit.E2, (-0.2 ), (-0.2 ) ), \ irit.ctlpt( irit.E2, (-0.2 ), 0.3 ), \ irit.ctlpt( irit.E2, 0, 0.3 ) ), irit.list( irit.KV_OPEN ) ) crv1a = crv1 * irit.trans( ( (-0.4 ), 0, 0 ) ) crv1b = crv1a * irit.scale( ( (-1 ), 1, 1 ) ) irit.color( crv1a, irit.GREEN ) irit.color( crv1b, irit.GREEN ) irit.view( irit.list( crv1a, crv1b ), irit.ON ) i = 0 while ( i <= 300 ): c = irit.cmorph( crv1a, crv1b, 0, i/300.0 ) irit.color( c, irit.YELLOW )
irit.ctlpt( irit.E2, (-0.3 ), 0.5 ), \ irit.ctlpt( irit.E2, 0.3, (-2.5 ) ), \ irit.ctlpt( irit.E2, 0.9, (-0.2 ) ) ) ) bez_off = irit.loffset(bez, 0.5, 300, 64, 4) irit.attrib(bez_off, "width", irit.GenRealObject(0.02)) irit.save("bez_0.4_off", irit.list(bez, bez_off)) cmpoffalltols(bez, "bez_0.4", 0.4, 1, 6) cpawn = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.95, 0.05 ), \ irit.ctlpt( irit.E2, 0.95, 0.76 ), \ irit.ctlpt( irit.E2, 0.3, 1.52 ), \ irit.ctlpt( irit.E2, 0.3, 1.9 ), \ irit.ctlpt( irit.E2, 0.5, 2.09 ), \ irit.ctlpt( irit.E2, 0.72, 2.24 ), \ irit.ctlpt( irit.E2, 0.72, 2.32 ), \ irit.ctlpt( irit.E2, 0.38, 2.5 ), \ irit.ctlpt( irit.E2, 0.42, 2.7 ), \ irit.ctlpt( irit.E2, 0.57, 2.81 ), \ irit.ctlpt( irit.E2, 0.57, 3.42 ), \ irit.ctlpt( irit.E2, 0.19, 3.57 ), \ irit.ctlpt( irit.E2, 0, 3.57 ) ), irit.list( irit.KV_OPEN ) ) cpawn_off = irit.loffset(cpawn, 0.5, 300, 78, 4) irit.attrib(cpawn_off, "width", irit.GenRealObject(0.04)) irit.save("cpawn_0.5_off", irit.list(cpawn, cpawn_off)) cmpoffalltols(cpawn, "cpawn_0.5", 0.5, 1, 4) cpawn_off = irit.loffset(cpawn, 1.5, 300, 57, 4) irit.attrib(cpawn_off, "width", irit.GenRealObject(0.04)) irit.save("cpawn_1.5_off", irit.list(cpawn, cpawn_off))
irit.save( "ffptdst1", irit.list( e2pts, c1 ) ) pts = irit.ffptdist( c1, 1, 1000 ) e2pts = irit.nil( ) i = 1 while ( i <= irit.SizeOf( pts ) ): pt = irit.ceval( c1, irit.FetchRealObject(irit.coord( irit.nth( pts, i ), 0 ) )) irit.snoc( pt, e2pts ) i = i + 10 irit.interact( irit.list( e2pts, c1 ) ) irit.save( "ffptdst2", irit.list( e2pts, c1 ) ) c2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-0.8 ), 0 ), \ irit.ctlpt( irit.E2, (-1 ), 0.5 ), \ irit.ctlpt( irit.E2, (-0.8 ), (-0.5 ) ), \ irit.ctlpt( irit.E2, (-0.6 ), (-0 ) ), \ irit.ctlpt( irit.E2, 1, 0 ) ), irit.list( irit.KV_OPEN ) ) irit.color( c2, irit.MAGENTA ) pts = irit.ffptdist( c2, 0, 1000 ) e2pts = irit.nil( ) i = 1 while ( i <= irit.SizeOf( pts ) ): pt = irit.ceval( c2, irit.FetchRealObject(irit.coord( irit.nth( pts, i ), 0 ) )) irit.snoc( pt, e2pts ) i = i + 10 irit.interact( irit.list( e2pts, c2 ) ) irit.save( "ffptdst3", irit.list( e2pts, c2 ) )
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))) irit.interact(all) irit.save("crv4arng", all) # ############################################################################ c1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-0.2 ), 0.5 ), \ irit.ctlpt( irit.E2, 0.2, 0.5 ), \ irit.ctlpt( irit.E2, 0.1, 0.2 ) ), irit.list( irit.KV_PERIODIC ) ) c1 = irit.coerce(c1, irit.KV_OPEN) crvs = irit.list(c1, c1 * irit.tx(0.1), c1 * irit.tx(0.3), c1 * irit.tx(0.45), c1 * irit.tx(0.5), c1 * irit.tx(0.61), c1 * irit.tx(1)) irit.color(crvs, irit.RED) # ################################ intercrvs = irit.carrangmnt(crvs, 1e-012, 2, irit.point(0, 0, 0)) intercrvs = intercrvspaint(intercrvs) all1 = irit.list(irit.GetAxes(), intercrvs) irit.free(intercrvs)
t4 = irit.surfrevax2(plgcross, 90, 360, (1, 0, 1)) irit.interact(irit.list(pllcross, irit.GetAxes(), t4)) # T9 = surfRevAxs( PlgCross, vector( 0, 1, 0 ) ); irit.free(pllcross) irit.free(plgcross) # # Surface of revolution of freeform curves. # gcross = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.3, 0, 0 ), \ irit.ctlpt( irit.E3, 0.3, 0, 0.05 ), \ irit.ctlpt( irit.E3, 0.1, 0, 0.05 ), \ irit.ctlpt( irit.E3, 0.1, 0, 0.4 ), \ irit.ctlpt( irit.E3, 0.5, 0, 0.4 ), \ irit.ctlpt( irit.E3, 0.6, 0, 0.8 ) ), irit.list( 0, 0, 0, 1, 2, 3,\ 4, 4, 4 ) ) irit.color(gcross, irit.GREEN) irit.adwidth(gcross, 5) glass1 = irit.surfrev(gcross) irit.interact(irit.list(gcross, irit.GetAxes(), glass1)) glass2 = irit.surfrev2(gcross, 45, 180) irit.interact(irit.list(gcross, irit.GetAxes(), glass2)) glass3 = irit.surfrevaxs(gcross, (1, 0, 1)) irit.interact(irit.list(gcross, irit.GetAxes(), glass3))
irit.color( p, irit.RED ) irit.snoc( p * irit.tx( 0 ), pts ) i = i + 1 irit.interact( irit.list( view_mat0, pl1, pts ) ) irit.save( "pt_inpl1", irit.list( irit.GetViewMatrix(), pl1, pts ) ) irit.free( pl1 ) # ############################################################################# # # Point inclusion in a curve: # crv1 = irit.cbspline( 4, irit.list( ( 0, 0, 0 ), ( 0.3, 0, 0 ), irit.point( 0.3, 0.1, 0 ), irit.point( 0.2, 0.1, 0 ), irit.point( 0.2, 0.5, 0 ), irit.point( 0.3, 0.5, 0 ), irit.point( 0.3, 0.6, 0 ), irit.point( 0, 0.6, 0 ), irit.point( 0, 0.5, 0 ), irit.point( 0.1, 0.5, 0 ), irit.point( 0.1, 0.1, 0 ), irit.point( 0, 0.1, 0 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.tx( (-0.15 ) ) * irit.ty( (-0.3 ) ) irit.view( irit.list( irit.GetAxes(), crv1 ), irit.ON ) pts = irit.nil( ) i = 0 while ( i <= 1000 ): p = irit.point( irit.random( (-0.5 ), 0.5 ), irit.random( (-0.5 ), 0.5 ), 0 ) if ( irit.FetchRealObject(irit.cpinclude( crv1, irit.Fetch3TupleObject(p), 1e-006 )) == 1 ): irit.color( p, irit.GREEN ) else: irit.color( p, irit.RED ) irit.snoc( p * irit.tx( 0 ), pts ) i = i + 1 irit.interact( irit.list( view_mat0, crv1, pts ) )
irit.free(leg2) skel = irit.list( irit.box( ( (-1 ), (-1 ), 25 ), 80, 2, 20 ),\ irit.box( ( (-1 ), (-1 ), 25 ), 2, 190, 20 ),\ irit.box( ( (-1 ), 189, 25 ), 80, 2, 20 ),\ irit.box( ( 79, (-1 ), 25 ), 2, 190, 20 ),\ irit.box( ( (-1 ), 90, 25 ), 80, 2, 20 ) ) irit.attrib(skel, "rgb", irit.GenStrObject("255,255,100")) irit.viewobj(skel) cover = irit.box((0, 0, 45), 80, 190, 1) irit.attrib(cover, "rgb", irit.GenStrObject("244,164,96")) backcross = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0, 0, 75 ), \ irit.ctlpt( irit.E3, 15, 0, 75 ), \ irit.ctlpt( irit.E3, 30, 0, 95 ), \ irit.ctlpt( irit.E3, 50, 0, 95 ), \ irit.ctlpt( irit.E3, 65, 0, 75 ), \ irit.ctlpt( irit.E3, 80, 0, 75 ) ), irit.list( irit.KV_OPEN ) ) backcrosspts = irit.list(irit.vector(80, 0, 75), irit.vector(80, 0, 45), irit.vector(0, 0, 45)) heartcross = ( irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0, 0, (-10 ) ), \ irit.ctlpt( irit.E3, 3, 0, 0 ), \ irit.ctlpt( irit.E3, 12, 0, 5 ), \ irit.ctlpt( irit.E3, 12, 0, 15 ), \ irit.ctlpt( irit.E3, 3, 0, 15 ), \ irit.ctlpt( irit.E3, 0, 0, 10 ) ), irit.list( irit.KV_OPEN ) ) + irit.cbspline( 3, irit.list( \ irit.ctlpt( irit.E3, 0, 0, 10 ), \ irit.ctlpt( irit.E3, (-2 ), 0, 15 ), \ irit.ctlpt( irit.E3, (-13 ), 0, 15 ), \ irit.ctlpt( irit.E3, (-13 ), 0, 5 ), \
import math import irit # # # Curve - point/line/curve closest/"farest" location/intersection. # # Gershon Elber, May 1993. # # # Curve point distance. # crv1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.5, (-1 ) ), \ irit.ctlpt( irit.E2, (-1.5 ), (-0.5 ) ), \ irit.ctlpt( irit.E2, 1.5, 0 ), \ irit.ctlpt( irit.E2, (-0.5 ), 2 ), \ irit.ctlpt( irit.E2, (-0.5 ), 1 ) ), irit.list( irit.KV_OPEN ) ) irit.color(crv1, irit.GREEN) irit.attrib(crv1, "width", irit.GenRealObject(0.02)) pt_param = irit.crvptdst(crv1, (0, 0, 0), 0, (-0.001)) pt_extrem = irit.nil() i = 1 while (i <= irit.SizeOf(pt_param)): pt = irit.ceval(crv1, irit.FetchRealObject(irit.nth(pt_param, i))) irit.snoc(irit.coerce(pt, irit.VECTOR_TYPE), pt_extrem) i = i + 1 irit.interact(irit.list(irit.GetAxes(), crv1, pt_extrem)) irit.save("crv1dist", irit.list(irit.GetAxes(), crv1, pt_extrem))
irit.save( "gama3krn", irit.list( ct, extractgammasrf( k1, 0.1, 14 ), extractgammasrf( k2, 0.1, 3 ) ) ) # # Iterating along different Gamma values: # gamma = 1 while ( gamma <= 50 ): irit.view( irit.list( ct, extractgammasrf( k1, gamma/50.0, 14 ), extractgammasrf( k2, gamma/50.0, 3 ), irit.GetAxes() ), irit.ON ) gamma = gamma + 1 irit.pause( ) # ############################################################################ c = irit.cbspline( 3, irit.list( ( 0.9, 0, 0 ), ( 0, (-0.9 ), 0 ), irit.point( (-0.8 ), 0, 0 ), irit.point( (-0.5 ), 0, 0 ), irit.point( 0, 1, 0 ), irit.point( 0.5, 0, 0 ) ), irit.list( irit.KV_PERIODIC ) ) c = irit.coerce( c, irit.KV_OPEN ) irit.adwidth( c, 3 ) irit.color( c, irit.RED ) ct = c * irit.tz( 1 ) k1 = irit.coerce( irit.crvkernel( c, 50, 0, irit.GenIntObject(2), 2 ), 13 ) * irit.sz( 0.7 ) irit.color( k1, irit.YELLOW ) k2 = irit.coerce( irit.crvkernel( c, (-50 ), 0, irit.GenIntObject(2), 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() ) )
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # A trimmed surface in the shape of a mask. # # Gershon Elber, March 1999 # crv = irit.creparam( irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, (-0.5 ), 0 ), \ irit.ctlpt( irit.E2, (-0.4 ), 0.4 ), \ irit.ctlpt( irit.E2, 0, 0.5 ), \ 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),