Exemplo n.º 1
0
def subdivtodepth(tsrf, dpth, vu, vv):
    if (dpth <= 0):
        retval = tsrf
    else:
        if (dpth / 2.0 != math.floor(dpth / 2.0)):
            v = vu * (2 ^ (dpth - 1))
            umin = irit.FetchRealObject(irit.nth(irit.pdomain(tsrf), 1))
            umax = irit.FetchRealObject(irit.nth(irit.pdomain(tsrf), 2))
            tsrfs = irit.sdivide(tsrf, irit.COL, umin * 0.4999 + umax * 0.5001)
        else:
            v = vv * (2 ^ (dpth - 1))
            vmin = irit.FetchRealObject(irit.nth(irit.pdomain(tsrf), 3))
            vmax = irit.FetchRealObject(irit.nth(irit.pdomain(tsrf), 4))
            tsrfs = irit.sdivide(tsrf, irit.ROW, vmin * 0.4999 + vmax * 0.5001)
        if (irit.SizeOf(tsrfs) == 2):
            retval = irit.list( subdivtodepth( irit.nth( tsrfs, 1 ) * \
              irit.trans( irit.Fetch3TupleObject(-v) ),
              dpth - 1,
              vu,
              vv ),
            subdivtodepth( irit.nth( tsrfs, 2 ) * \
              irit.trans( irit.Fetch3TupleObject(v) ),
              dpth - 1,
              vu,
              vv ) )
        else:
            retval = subdivtodepth(irit.nth(tsrfs, 1), dpth - 1, vu, vv)
    return retval
Exemplo n.º 2
0
def ant(scl):
    save_res = irit.GetResolution()
    bodyall = antbody()
    body = irit.nth(bodyall, 1)
    eyes = irit.nth(bodyall, 2)
    leg = antleg()
    llegs = irit.list(
        leg * irit.sc(1.1) * irit.sx(1.3) * irit.ry((-45)) * irit.trans(
            (0.1, 0, 1.02)),
        leg * irit.sc(1.3) * irit.ry(10) * irit.trans((0.1, 0.05, 1)),
        leg * irit.sc(1.2) * irit.sx(1.4) * irit.ry(40) * irit.trans(
            (0.1, 0.02, 0.95)))
    irit.SetResolution(20)
    irit.attrprop(llegs, "u_resolution", irit.GenRealObject(0.2))
    antennas = irit.list(
        antantenna() * irit.ry((-110)) * irit.trans(((-0.02), 0.2, 1.6)),
        antantenna() * irit.ry((-70)) * irit.trans((0.02, 0.2, 1.6)))
    irit.attrprop(antennas, "u_resolution", irit.GenRealObject(0.2))
    body = (body + irit.gpolygon(llegs, 1) + irit.gpolygon(llegs, 1) * irit.sx(
        (-1)) + irit.gpolygon(antennas, 1))
    irit.attrib(body, "rgb", irit.GenStrObject("255,50,50"))
    irit.SetResolution(save_res)
    retval = irit.list(
        body,
        eyes) * irit.sz(1.3) * irit.sc(1) * irit.ty(0.28785) * irit.rx(90)
    return retval
Exemplo n.º 3
0
def positioncurvature(srf, u, v):
    eps = 1e-012
    c = irit.circle((0, 0, 0), 1)
    k = irit.scrvtreval(srf, u, v, 1)
    r1 = irit.max(
        irit.min(1.0 / (irit.FetchRealObject(irit.nth(k, 1)) + eps), 1000),
        (-1000))
    r2 = irit.max(
        irit.min(1.0 / (irit.FetchRealObject(irit.nth(k, 3)) + eps), 1000),
        (-1000))
    v1 = irit.nth(k, 2)
    v2 = irit.nth(k, 4)
    p = irit.seval(srf, u, v)
    n = irit.snormal(srf, u, v)
    d1 = v1 ^ n
    d2 = v2 ^ n
    c1 = c * \
   irit.sc( r1 ) * \
   irit.rotz2v( irit.Fetch3TupleObject(d1) ) * \
   irit.trans( irit.Fetch3TupleObject(irit.coerce( p, irit.VECTOR_TYPE ) + n * r1 ))
    c2 = c * \
   irit.sc( r2 ) * \
   irit.rotz2v( irit.Fetch3TupleObject(d2) ) * \
   irit.trans( irit.Fetch3TupleObject(irit.coerce( p, irit.VECTOR_TYPE ) + n * r2) )
    retval = irit.list(
        p, c1, c2,
        p + irit.coerce(irit.coerce(p, irit.POINT_TYPE) + v1, irit.E3),
        p + irit.coerce(irit.coerce(p, irit.POINT_TYPE) + v2, irit.E3),
        positionasymptotes(srf, u, v))
    irit.adwidth(retval, 2)
    irit.color(retval, irit.YELLOW)
    return retval
Exemplo n.º 4
0
def antanim(scl):
    save_res = irit.GetResolution()
    bodyall = antbody()
    body = irit.nth(bodyall, 1)
    eyes = irit.nth(bodyall, 2)
    llegs = irit.list(
        antlleganim(1) * irit.sc(1.1) * irit.sx(1.3) * irit.ry(
            (-45)) * irit.trans((0.1, 0, 1.02)),
        antlleganim((-1)) * irit.sc(1.3) * irit.ry(10) * irit.trans(
            (0.1, 0.05, 1)),
        antlleganim(1) * irit.sc(1.2) * irit.sx(1.4) * irit.ry(40) *
        irit.trans((0.1, 0.02, 0.95)))
    rlegs = irit.list(
        antrleganim(
            (-1)) * irit.sc(1.1) * irit.sx(1.3) * irit.ry(45) * irit.trans(
                ((-0.1), 0, 1.02)),
        antrleganim(1) * irit.sc(1.3) * irit.ry((-10)) * irit.trans(
            ((-0.1), 0.05, 1)),
        antrleganim((-1)) * irit.sc(1.2) * irit.sx(1.4) * irit.ry(
            (-40)) * irit.trans(((-0.1), 0.02, 0.95)))
    irit.SetResolution(20)
    antennas = irit.list(
        antantenna() * irit.ry((-110)) * irit.trans(((-0.02), 0.2, 1.6)),
        antantenna() * irit.ry((-70)) * irit.trans((0.02, 0.2, 1.6)))
    irit.attrprop(antennas, "u_resolution", irit.GenRealObject(0.2))
    body = (body + irit.gpolygon(antennas, 1))
    irit.attrib(body, "rgb", irit.GenStrObject("255,50,50"))
    irit.SetResolution(save_res)
    retval = irit.list(
        body, llegs, rlegs,
        eyes) * irit.sz(1.3) * irit.sc(1) * irit.ty(0.28785) * irit.rx(90)
    mov_y = irit.creparam( irit.ctlpt( irit.E1, 0 ) + \
                            irit.ctlpt( irit.E1, (-1 ) ), 0, 1.2 )
    irit.attrib(retval, "animation", mov_y)
    return retval
Exemplo n.º 5
0
def dominos(path, scl, piecetimestep):
    retval = irit.nil()
    animtime = 0
    dominopiece = irit.box(
        (-0.01, -0.006, 0), 0.02, 0.006, 0.05) * irit.sc(scl)
    rot_x = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                     irit.ctlpt( irit.E1, 80 ) ) )
    crvdomain = irit.pdomain(path)
    t = irit.FetchRealObject(irit.nth(crvdomain, 1))
    dpath = irit.cderive(path)
    while (t < irit.FetchRealObject(irit.nth(crvdomain, 2))):
        d = irit.Fetch3TupleObject(
            irit.coerce(irit.ceval(dpath, t), irit.POINT_TYPE))
        dlen = math.sqrt(DotProd(d, d))

        rot_x = irit.creparam(rot_x, animtime, animtime + piecetimestep)
        irit.attrib(dominopiece, "animation", irit.list(rot_x))
        irit.setname(irit.getattr(dominopiece, "animation"), 0, "rot_x")

        dp = dominopiece * irit.rz(
            -math.atan2(d[0], d[1]) * 180 / math.pi) * irit.trans(
                irit.Fetch3TupleObject(
                    irit.coerce(irit.ceval(path, t), irit.VECTOR_TYPE)))
        irit.snoc(dp, retval)

        t = t + 0.04 * scl / dlen
        animtime = animtime + piecetimestep * 0.6
    return retval
Exemplo n.º 6
0
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
Exemplo n.º 7
0
def rigidmotionpos(cnew, c):
    t = irit.FetchRealObject(irit.nth(irit.pdomain(c), 1))
    pos = irit.coerce(irit.ceval(c, t), irit.VECTOR_TYPE)
    tn = irit.ctangent(c, t, 1)
    retval = cnew * \
    irit.rz( math.atan2( irit.FetchRealObject(irit.coord( tn, 1 )),
          irit.FetchRealObject(irit.coord( tn, 0 )) ) * \
       180/math.pi ) * \
    irit.trans( irit.Fetch3TupleObject(pos) )
    return retval
Exemplo n.º 8
0
def displayptscrctan2crvs(pts, r, c1, c2):
    retval = irit.nil()
    circ = irit.circle((0, 0, 0), r)
    i = 1
    while (i <= irit.SizeOf(pts)):
        pt = irit.coord(pts, i)
        prms = irit.getattr(pt, "params")
        ptc1 = irit.ceval(c1, irit.FetchRealObject(irit.coord(prms, 0)))
        ptc2 = irit.ceval(c2, irit.FetchRealObject(irit.coord(prms, 1)))
        irit.snoc( irit.list( irit.coerce( pt, irit.E2 ) + ptc1, \
         irit.coerce( pt, irit.E2 ) + ptc2, \
         circ * irit.trans( irit.Fetch3TupleObject(irit.coerce( pt, irit.VECTOR_TYPE )) ) ), retval )
        i = i + 1
    return retval
Exemplo n.º 9
0
def extractcrvregion( crv, t1, t2, idx ):
    if ( irit.FetchRealObject(t1) < 0 ):
        retval = irit.cregion( crv, irit.FetchRealObject(t1) + 1, 1 ) + irit.cregion( crv, 0, irit.FetchRealObject(t2) )
    else:
        retval = irit.cregion( crv, irit.FetchRealObject(t1), irit.FetchRealObject(t2) )
    retval = irit.creparam( retval, 0, 1 )
    tn = irit.vector( 1, 0, 0 ) * irit.rz( irit.FetchRealObject( idx ) )
    retval = irit.list( retval * irit.trans( irit.Fetch3TupleObject( tn * irit.sc( 0.15 ) ) ), 
						irit.arrow3d( irit.coerce( irit.ceval( retval, 0.5 ), 3 ), 
									  tn, 0.35, 0.01, 0.1, 0.02 ) )
    irit.attrib( retval, "width", irit.GenRealObject( irit.random( 0.007, 0.01 ) ) )
    irit.attrib( retval, "gray", irit.GenRealObject( irit.random( 0.2, 0.8 ) ) )
    irit.attrib( retval, "rgb", irit.GenStrObject( str(int(irit.random( 100, 255 ) ) ) + 
								"," + 
								str(int(irit.random( 100, 255 ) ) ) + 
								"," + 
								str(int(irit.random( 100, 255 ) ) ) ) )
    return retval
Exemplo n.º 10
0
def menugengeometry(menuitems, itemsize, minx, miny, maxx, maxy):
    n = irit.SizeOf(menuitems)
    retval = irit.nil()
    i = 0
    while (i <= n - 1):
        x1 = minx
        x2 = maxx
        y1 = miny + (maxy - miny) * i / n
        y2 = y1 + (maxy - miny) * 0.8 / n
        irit.snoc(
            irit.list(
                irit.poly(
                    irit.list((x1, y1, 0), irit.point(x1, y2, 0),
                              irit.point(x2, y2, 0), irit.point(x2, y1, 0),
                              irit.point(x1, y1, 0)), 1),
                irit.textgeom(irit.FetchStrObject(irit.nth(menuitems, i + 1)),
                              (itemsize * 0.06, 0, 0), itemsize * 0.06) *
                irit.trans((x1 + itemsize * 0.07, (y1 + y2) / 2, 0))), retval)

        i = i + 1
    return retval
Exemplo n.º 11
0
def plotfunc2d(minx, maxx, n):
    pl = plotfunc2d2poly(minx, maxx, n)
    irit.color(pl, irit.YELLOW)
    irit.attrib(pl, "width", irit.GenRealObject(0.05))
    miny = 1e+006
    maxy = -1e+006
    i = 0
    while (i <= 2):
        miny = miny + i
        i = i + 1
    retval = pl
    i = 0
    while (i <= irit.SizeOf(pl) - 1):
        v = irit.coord(pl, i)
        real_val = irit.FetchRealObject(irit.coord(v, 1))
        if (real_val > maxy):
            maxy = irit.FetchRealObject(irit.coord(v, 1))
        if (real_val < miny):
            miny = irit.FetchRealObject(irit.coord(v, 1))
        i = i + 1
    ax = (irit.poly(
        irit.list((irit.min(minx, 0), 0, 0),
                  (irit.max(maxx, 0), 0, 0)), 1) + irit.poly(
                      irit.list((0, irit.min(miny, 0), 0),
                                (0, irit.max(maxy, 0), 0)), 1))

    irit.color(ax, irit.RED)
    irit.attrib(ax, "width", irit.GenRealObject(0.02))
    tr = irit.trans(
        ((-minx + maxx) / 2.0, (-miny + maxy) / 2.0, 0)) * irit.scale(
            (2.0 / (maxx - minx), 2.0 / (maxy - miny), 0))
    sv = irit.GetViewMatrix()
    irit.SetViewMatrix(irit.rotx(0))
    retval = irit.list(pl, ax) * tr
    irit.viewobj(irit.list(irit.GetViewMatrix(), retval))
    irit.printf("xdomain = [%lf %lf], ydomain = [%lf %lf]\n",
                irit.list(minx, maxx, miny, maxy))
    irit.SetViewMatrix(sv)
    return retval
Exemplo n.º 12
0
        pt = irit.teval( tv, x, y, z )
        v = math.floor( i/float(usize) )
        u = i - v * usize
        srf = irit.seditpt( srf, pt, u, v )
        i = i + 1
    irit.attrib( srf, "color", clr )
    retval = srf
    return retval

# 
#  Properly orient the Teapot in the parametric space of the Trivariate
# 
prmdomain = irit.box( ( 0, 0, 0 ), 0.5, 1, 1 )
irit.attrib( prmdomain, "transp", irit.GenRealObject(0.8) )

teapot = teapotorig * irit.sc( 0.13 ) * irit.rz( 90 ) * irit.rx( 90 ) * irit.sx( (-1 ) ) * irit.trans( ( 0, 0.5, 0.5 ) )

all = irit.list( prmdomain, teapot ) * irit.rz( 90 ) * irit.ry( 40 ) * irit.rx( 40 )

interact( irit.list( all, irit.GetViewMatrix() ) )
irit.save( "warp1trv", all )

# 
#  Warp the teapot, one surface at a time, after some surface refinement.
# 
warpedteapot = irit.nil(  )
i = 1
while ( i <= irit.SizeOf( teapot ) ):
    srf = irit.nth( teapot, i )
    clr = irit.getattr( srf, "color" )
    srf = irit.sreparam( irit.sreparam( srf, irit.COL, 0, 1 ), irit.ROW, 0,\
Exemplo n.º 13
0
#
import math
import irit
#

#
#  Yet another simple 3D mechanical object.
#
#                                Created by Gershon Elber,       Sep 89
#

save_mat = irit.GetViewMatrix()
save_res = irit.GetResolution()

irit.SetResolution(16)
irit.SetViewMatrix(irit.GetViewMatrix() * irit.trans(
    (0, (-0.3), 0)) * irit.scale((0.8, 0.8, 0.8)))
b1 = irit.box(((-0.6), (-0.3), 0), 1.2, 0.6, 0.6)
c1 = irit.cylin((0, (-0.25), 0.59), (0, 0.5, 0), 0.55, 3)
s1 = (b1 + c1)
irit.color(s1, irit.YELLOW)
irit.free(b1)
irit.free(c1)
irit.view(irit.list(irit.GetViewMatrix(), s1), irit.ON)

b2 = irit.box(((-0.4), (-0.4), (-0.1)), 0.8, 0.8, 0.35)
irit.view(b2, irit.OFF)
s2 = (s1 - b2)
irit.free(s1)
irit.free(b2)
irit.color(s2, irit.YELLOW)
irit.view(s2, irit.ON)
Exemplo n.º 14
0
#                                        Gershon Elber, July 1994.
# 

# 
#  Sets the viewing direction on the display device.
# 
save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(  irit.rotx( 0 ))
irit.viewobj( irit.GetViewMatrix() )
irit.SetViewMatrix(  save_mat)

# ############################################################################
crv1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 0.3, 0 ), \
                                irit.ctlpt( irit.E2, 0, 0.5 ), \
                                irit.ctlpt( irit.E2, (-0.2 ), 0 ) ) )
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.view( irit.list( crv1a, crv1b, c ), irit.ON )
    i = i + 1

crvs = irit.cmorph( crv1a, crv1b, 2, 0.005 )
irit.snoc( crv1b, crvs )
i = 1
Exemplo n.º 15
0

# 
#  Simple molecule - 8 atoms connected as a cube.
# 

t = irit.time( 1 )

save_res = irit.GetResolution()
save_view = irit.GetViewMatrix()

irit.SetViewMatrix(  irit.GetViewMatrix() * \
					 irit.scale( ( 0.6, 0.6, 0.6 ) ) * \
					 irit.rotx( 20 ) * \
					 irit.roty( 45 ) * \
					 irit.trans( ( (-0.3 ), 0.2, 0 ) ))

irit.SetResolution(  16)
s1 = irit.sphere( ( 0, 0, 0 ), 0.2 )
s2 = irit.sphere( ( 1, 0, 0 ), 0.2 )

irit.SetResolution(  8)
c1 = irit.cylin( ( 0, 0, 0 ), ( 1, 0, 0 ), 0.05, 3 )

irit.view( irit.list( irit.GetViewMatrix(), s1, s2, c1 ), irit.ON )

b1 = ( (s1 ^ s2) + c1 )
irit.free( s1 )
irit.free( s2 )
irit.free( c1 )
b2 = b1 * irit.trans( ( 0, 1, 0 ) )
Exemplo n.º 16
0
gcross = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.001, 0, 0.02 ), \
                                      irit.ctlpt( irit.E3, 0.2, 0, 0.02 ), \
                                      irit.ctlpt( irit.E3, 0.22, 0, 0 ), \
                                      irit.ctlpt( irit.E3, 0.22, 0, 0.03 ), \
                                      irit.ctlpt( irit.E3, 0.03, 0, 0.03 ), \
                                      irit.ctlpt( irit.E3, 0.03, 0, 0.07 ), \
                                      irit.ctlpt( irit.E3, 0.04, 0, 0.3 ), \
                                      irit.ctlpt( irit.E3, 0.3, 0, 0.3 ), \
                                      irit.ctlpt( irit.E3, 0.4, 0, 0.4 ), \
                                      irit.ctlpt( irit.E3, 0.3, 0, 0.7 ), \
                                      irit.ctlpt( irit.E3, 0.28, 0, 0.7 ), \
                                      irit.ctlpt( irit.E3, 0.37, 0, 0.42 ), \
                                      irit.ctlpt( irit.E3, 0.31, 0, 0.32 ), \
                                      irit.ctlpt( irit.E3, 0.001, 0, 0.32 ) ), irit.list( irit.KV_OPEN ) )
srf3 = irit.surfrev(gcross * irit.trans((0, 0, (-0.45))) * irit.scale(
    (1.6, 1.6, 1.6)))
irit.free(gcross)
irit.color(srf3, irit.CYAN)

#
#  Must make them compatible before doing some morphing.
#
irit.ffcompat(srf2, srf3)

i = 0
while (i <= 1):
    irit.view(irit.smorph(srf2, srf3, i), irit.ON)
    i = i + step

#
Exemplo n.º 17
0
square = irit.poly( irit.list( ( 0, 0, 0 ), ( 0, 1, 0 ), ( 1, 1, 0 ), ( 1, 0, 0 ), ( 0, 0, 0 ) ), irit.TRUE )
irit.attrib( square, "width", irit.GenStrObject("0.02" ))
irit.color( square, irit.RED )

rectan = irit.poly( irit.list( ( 0, 0, 0 ), ( 0, 1, 0 ), ( 2, 1, 0 ), ( 2, 0, 0 ), ( 0, 0, 0 ) ), irit.TRUE )
irit.attrib( rectan, "width", irit.GenStrObject("0.02" ))
irit.color( rectan, irit.RED )

triang = irit.poly( irit.list( ( 0, 0, 0 ), ( 0, 1, 0 ), ( 1.5, 0.5, 0 ), ( 0, 0, 0 ) ), irit.TRUE )
irit.attrib( triang, "width", irit.GenStrObject("0.02" ))
irit.color( triang, irit.RED )

irit.SetViewMatrix(  irit.scale( ( 0.2, 0.2, 0.2 ) ))
cube_prisa = irit.list( square, 
						square * irit.trans( ( 1, 0, 0 ) ), 
						square * irit.trans( ( 2, 0, 0 ) ), 
						square * irit.trans( ( (-1 ), 0, 0 ) ), 
						square * irit.trans( ( 0, 1, 0 ) ), 
						square * irit.trans( ( 0, (-1 ), 0 ) ) )
irit.interact( irit.list( irit.GetViewMatrix(), cube_prisa ) )
irit.save( "cubepris", cube_prisa )
irit.free( cube_prisa )

box_prisa = irit.list( rectan, square * irit.trans( ( 2, 0, 0 ) ), square * irit.trans( ( (-1 ), 0, 0 ) ), rectan * irit.trans( ( 0, 1, 0 ) ), rectan * irit.trans( ( 0, 2, 0 ) ), rectan * irit.trans( ( 0, (-1 ), 0 ) ) )
irit.interact( irit.list( irit.GetViewMatrix(), box_prisa ) )
irit.save( "box_pris", box_prisa )
irit.free( box_prisa )

piram_prisa = irit.list( square, triang * irit.trans( ( 1, 0, 0 ) ), triang * irit.rotz( 90 ) * irit.trans( ( 1, 1, 0 ) ), triang * irit.rotz( 180 ) * irit.trans( ( 0, 1, 0 ) ), triang * irit.rotz( 270 ) * irit.trans( ( 0, 0, 0 ) ) )
irit.interact( irit.list( irit.GetViewMatrix(), piram_prisa ) )
Exemplo n.º 18
0
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
Exemplo n.º 19
0
aiso = irit.adapiso(srf1, irit.ROW, 0.05, irit.FALSE, irit.FALSE)
irit.color(aiso, irit.YELLOW)
irit.interact(irit.list(irit.GetAxes(), srf1, aiso))

srf2 = irit.sbspline( 3, 3, irit.list( irit.list( irit.ctlpt( irit.E3, 1, 0, 0 ), \
                                                  irit.ctlpt( irit.E3, 1, 1, 2 ), \
                                                  irit.ctlpt( irit.E3, 1, 2, 0 ) ), irit.list( \
                                                  irit.ctlpt( irit.E3, 2, 0.9, 2 ), \
                                                  irit.ctlpt( irit.E3, 2, 1, 0 ), \
                                                  irit.ctlpt( irit.E3, 2, 1.1, 2 ) ), irit.list( \
                                                  irit.ctlpt( irit.E3, 3, 0, 0 ), \
                                                  irit.ctlpt( irit.E3, 3, 1, 2 ), \
                                                  irit.ctlpt( irit.E3, 3, 2, 0 ) ), irit.list( \
                                                  irit.ctlpt( irit.E3, 4, 0.9, 1 ), \
                                                  irit.ctlpt( irit.E3, 4, 1, 0 ), \
                                                  irit.ctlpt( irit.E3, 4, 1.1, 1 ) ) ), irit.list( irit.list( irit.KV_OPEN ), irit.list( irit.KV_OPEN ) ) ) * irit.scale( ( 0.5, 0.5, 0.5 ) ) * irit.trans( ( (-0.5 ), 0, 0 ) )
irit.color(srf2, irit.MAGENTA)

aiso = irit.adapiso(srf2, irit.COL, 0.05, irit.TRUE, irit.FALSE)
irit.color(aiso, irit.YELLOW)
irit.interact(irit.list(irit.GetAxes(), srf2, aiso))
irit.save("adap1iso", irit.list(irit.GetAxes(), srf2, aiso))

aiso = irit.adapiso(srf2, irit.COL, 0.05, irit.FALSE, irit.FALSE)
irit.color(aiso, irit.YELLOW)
irit.interact(irit.list(irit.GetAxes(), srf2, aiso))
irit.save("adap2iso", irit.list(irit.splitlst(irit.GetAxes()), srf2, aiso))
#  Test SplitLst...

srf3 = irit.sbspline( 3, 3, irit.list( irit.list( irit.ctlpt( irit.E3, 1, 0, 0 ), \
                                                  irit.ctlpt( irit.E3, 1, 1, 0 ), \
Exemplo n.º 20
0
c2 = irit.cbspline( 6, irit.list( irit.ctlpt( irit.E3, 0, (-0.279 ), (-1.54 ) ), \
                                  irit.ctlpt( irit.E3, 0, (-0.483 ), (-0.896 ) ), \
                                  irit.ctlpt( irit.E3, 0, (-0.762 ), (-0.631 ) ), \
                                  irit.ctlpt( irit.E3, 0, (-1.07 ), (-0.0984 ) ), \
                                  irit.ctlpt( irit.E3, 0, (-0.747 ), 0.761 ), \
                                  irit.ctlpt( irit.E3, 0, 0, 1 ), \
                                  irit.ctlpt( irit.E3, 0, 0.747, 0.761 ), \
                                  irit.ctlpt( irit.E3, 0, 1.07, (-0.0984 ) ), \
                                  irit.ctlpt( irit.E3, 0, 0.762, (-0.631 ) ), \
                                  irit.ctlpt( irit.E3, 0, 0.483, (-0.896 ) ), \
                                  irit.ctlpt( irit.E3, 0, 0.279, (-1.54 ) ), \
                                  irit.ctlpt( irit.E3, 0, 0, (-1.78 ) ) ), irit.list( irit.KV_OPEN ) )

crvs = irit.list(
    c1b * irit.sc(0.001) * irit.trans((1.02, 0, 0.18)),
    c1b * irit.sc(0.07) * irit.sz(0.4) * irit.trans((1.02, 0, 0.18)),
    c1b * irit.sc(0.18) * irit.sz(0.3) * irit.trans((0.8, 0, 0.16)),
    c1b * irit.sc(0.27) * irit.sz(0.5) * irit.trans((0.6, 0, 0.16)),
    c1b * irit.sc(0.43) * irit.sz(0.64) * irit.trans((0.3, 0, 0.2)),
    c1b * irit.sc(0.54) * irit.sz(0.7) * irit.trans((0, 0, 0.23)),
    c1b * irit.sc(0.52) * irit.ry(25) * irit.sz(0.76) * irit.trans(
        ((-0.34), 0, 0.26)),
    c1b * irit.sc(0.41) * irit.sz(1.13) * irit.ry(50) * irit.trans(
        ((-0.6), 0, 0.32)),
    c1b * irit.sc(0.3) * irit.sz(1.3) * irit.ry(65) * irit.trans(
        ((-0.7), 0, 0.42)),
    c1b * irit.sc(0.16) * irit.sz(1.4) * irit.ry(75) * irit.trans(
        ((-0.71), 0, 0.5)),
    c1a * irit.sc(0.16) * irit.sz(1.4) * irit.ry(75) * irit.trans(
        ((-0.72), 0, 0.53)),
Exemplo n.º 21
0
irit.interact(
    irit.list(irit.GetAxes(), crv2, irit.coerce(pt_max, irit.VECTOR_TYPE)))
irit.save(
    "crv4dist",
    irit.list(irit.GetAxes(), crv2, irit.coerce(pt_max, irit.VECTOR_TYPE)))

crv3a = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 1 ), \
                                     irit.ctlpt( irit.E2, 0.1, 1 ), \
                                     irit.ctlpt( irit.E2, 0.1, 0.1 ), \
                                     irit.ctlpt( irit.E2, 0.5, 0.1 ), \
                                     irit.ctlpt( irit.E2, 0.5, (-0.1 ) ), \
                                     irit.ctlpt( irit.E2, 0.1, (-0.1 ) ), \
                                     irit.ctlpt( irit.E2, 0.1, (-1 ) ), \
                                     irit.ctlpt( irit.E2, 0, (-1 ) ) ), irit.list( irit.KV_OPEN ) )
crv3b = crv3a * irit.rotz(180)
crv3 = (crv3a + crv3b) * irit.trans((0.1, 0.1, 0))
irit.color(crv3, irit.GREEN)
irit.attrib(crv3, "width", irit.GenRealObject(0.02))

pt_param = irit.crvptdst(crv3, (0, 0, 0), 0, (-0.001))
pt_extrem = irit.nil()
i = 1
while (i <= irit.SizeOf(pt_param)):
    pt = irit.ceval(crv3, 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(), crv3, pt_extrem))
irit.save("crv5dist", irit.list(irit.GetAxes(), crv3, pt_extrem))

pt_min = irit.ceval(
    crv3, irit.FetchRealObject(irit.crvptdst(crv3, (0, 0, 0), 1, 0.001)))
Exemplo n.º 22
0
        irit.GenStrObject(
            str(int(irit.random(64, 255))) + "," +
            str(int(irit.random(64, 255))) + "," +
            str(int(irit.random(64, 255)))))
    return retval


stage1 = irit.list(cubeat(0, 0, 0), cubeat(0, (-size), 0),
                   cubeat(0, (-2) * size, 0))
rot_x = irit.creparam( irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                                irit.ctlpt( irit.E1, 90 ) ) ), 0, 1 )
irit.attrib(stage1, "animation", irit.list(rot_x))
irit.free(rot_x)

stage2 = irit.list(cubeat(0, 0, 0), cubeat(size, 0, 0),
                   stage1 * irit.trans((2 * size, 0, 0)))
rot_y = irit.creparam( irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                                irit.ctlpt( irit.E1, 90 ) ) ), 1, 2 )
irit.attrib(stage2, "animation", irit.list(rot_y))
irit.free(rot_y)
irit.free(stage1)

stage3 = irit.list(cubeat(0, 0, 0), cubeat(0, size, 0),
                   stage2 * irit.trans((0, 2 * size, 0)))
rot_z = irit.creparam( irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                                irit.ctlpt( irit.E1, (-90 ) ) ) ), 2, 3 )
irit.attrib(stage3, "animation", irit.list(rot_z))
irit.free(rot_z)
irit.free(stage2)

stage4 = irit.list(cubeat(0, 0, 0), cubeat(0, 0, size),
Exemplo n.º 23
0
#  Surface subdivision and merging.
#
sb_lst = irit.sdivide(sb, irit.COL, 0.4)
sb1 = irit.nth(sb_lst, 1)
irit.color(sb1, irit.GREEN)
sb2 = irit.nth(sb_lst, 2)
irit.color(sb2, irit.YELLOW)

if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), sb, sb1, sb2))
sbm = irit.smerge(sb1, sb2, irit.COL, 1)
display = 1

if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), sbm, sb1, sb2))
sbm = irit.smerge(sb1 * irit.trans((0, (-0.5), 0)),
                  sb2 * irit.trans((0, 0.5, 0)), irit.COL, 0)
if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), sbm, sb1, sb2))

sb_lst = irit.sdivide(sb, irit.ROW, 0.8)
sb1 = irit.nth(sb_lst, 1)
irit.color(sb1, irit.GREEN)
sb2 = irit.nth(sb_lst, 2)
irit.color(sb2, irit.YELLOW)

if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), sb, sb1, sb2))
sbm = irit.smerge(sb1, sb2, irit.ROW, 1)
if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), sbm, sb1, sb2))
Exemplo n.º 24
0
irit.pause()

# ############################################################################

cross = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 0 ), \
                                     irit.ctlpt( irit.E2, 0.8, 0 ), \
                                     irit.ctlpt( irit.E2, 0.8, 0.2 ), \
                                     irit.ctlpt( irit.E2, 0.07, 1.4 ), \
                                     irit.ctlpt( irit.E2, (-0.07 ), 1.4 ), \
                                     irit.ctlpt( irit.E2, (-0.8 ), 0.2 ), \
                                     irit.ctlpt( irit.E2, (-0.8 ), 0 ), \
                                     irit.ctlpt( irit.E2, 0, 0 ) ), irit.list( irit.KV_OPEN ) )
cross = irit.coerce(cross, irit.E3)
s = irit.sfromcrvs(
    irit.list(cross, cross * irit.trans((0.5, 0, 1)),
              cross * irit.trans((0, 0, 2))), 3, irit.KV_OPEN)
irit.view(irit.list(s, irit.GetAxes()), irit.ON)

ucrvtrzxy = irit.scrvtr(s, irit.E3, irit.ROW)
vcrvtrzxy = irit.scrvtr(s, irit.E3, irit.COL)
ucrvtrxyz = ucrvtrzxy * irit.rotx((-90)) * irit.roty((-90)) * irit.scale(
    (1, 1, 10))
vcrvtrxyz = vcrvtrzxy * irit.rotx((-90)) * irit.roty((-90)) * irit.scale(
    (1, 1, 0.001))
irit.free(ucrvtrzxy)
irit.free(vcrvtrzxy)
irit.color(ucrvtrxyz, irit.RED)
irit.color(vcrvtrxyz, irit.MAGENTA)

irit.view(irit.list(ucrvtrxyz, vcrvtrxyz), irit.OFF)
Exemplo n.º 25
0

# 
#  A model of the B58 Bomber.
# 
# 
#                        Gershon Elber, October 1991.
# 

if ( irit.GetMachine() == irit.MSDOS ):
    irit.SetResolution(8)
else:
    irit.SetResolution(10)

save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.GetViewMatrix() * irit.trans( ( 5, 2, 0 ) ) * irit.scale( ( 0.15, 0.15, 0.15 ) ) )

# 
#  Set up for colored or wood texture version. set do_texture to 1 for
#  wood version, otherwise color version. Note locally (in irit) it will
#  always be displayed in colors.
# 
do_texture = 0



if ( do_texture == 1 ):
    woodcolor = "244,164,96"
    texture = "wood,1"
    redcolor = woodcolor
    graycolor = woodcolor
Exemplo n.º 26
0
while (z <= 6.5):
    tmpbody = tmpbody ^ irit.box((7.9, 0.1, z), 1, 0.4, 0.05)
    z = z + 0.2

z = 1
while (z <= 6.5):
    tmpbody = tmpbody ^ irit.box((7.95, 4.3, z), 1, 0.6, 0.05)
    z = z + 0.3

base = base / tmpbody

stopper = irit.box((6.85, 2.05, 7.37), 0.9, 0.9, 0.13)

rot_y = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                 irit.ctlpt( irit.E1, (-80 ) ) ) )
trns = irit.trans(((-7.75), 0, (-7.45)))
irit.attrib(stopper, "animation", irit.list(trns, rot_y, trns ^ (-1)))
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)
Exemplo n.º 27
0
irit.attrib(c2, "width", irit.GenRealObject(0.0001))
irit.attrib(c3, "width", irit.GenRealObject(0.0001))

c12 = c1 * c2
c123 = c12 * c3
irit.attrib(c123, "width", irit.GenRealObject(0.005))
irit.color(c123, irit.RED)
irit.adwidth(c123, 3)

all = irit.list(c123, c1, c2, c3)

irit.SetViewMatrix(irit.sc(1.1))
irit.viewobj(irit.GetViewMatrix())

tr = 0.4
proj1 = all * irit.trans(((-tr), tr, 0))
proj2 = all * irit.rotx(90) * irit.trans((tr, tr, 0))
proj3 = all * irit.roty(90) * irit.trans(((-tr), (-tr), 0))
proj4 = all * irit.roty(30) * irit.rotx(20) * irit.trans((tr, (-tr), 0))

allproj = irit.list(proj1, proj2, proj3, proj4)

irit.save("cylin3a", allproj)
irit.interact(allproj)

c123a = c123 * irit.roty(30) * irit.rotx(20) * irit.scale((3, 3, 3))
irit.attrib(c123a, "width", irit.GenRealObject(0.015))
irit.save("cylin3b", c123a)
irit.interact(c123a)

c123b = c123 * irit.roty(60) * irit.rotx(65) * irit.scale((3, 3, 3))
Exemplo n.º 28
0
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.trans( ( 0.25, (-0.1 ), 1.2 ) ),
       s * \
       irit.sc( 0.2 ) * \
       irit.sx( 1.5 ) * \
Exemplo n.º 29
0
arc3 = irit.cregion(circ, 0.5, 1)
arc4 = irit.cregion(circ, 0.7, 1.5)
arc5 = irit.cregion(circ, 0.7, 1.3)
arc6 = irit.cregion(circ, 0.7, 1)
arc7 = irit.cregion(circ, 1, 1.3)
arc8 = irit.cregion(circ, 0.5, 1.3)
arc9 = irit.cregion(circ, 0.7, 1.5)
irit.free(circ)

prof1 = ((-arc1) + (-arc2) * irit.tx(4.6))
prof1a = prof1 * irit.sy(2)

prof2 = ((-arc3) + (-arc4) * irit.tx(4.6) + (-arc5) * irit.tx(7.6) +
         (-arc5) * irit.tx(10.6) + (-arc5) * irit.tx(13.6) +
         (-arc5) * irit.tx(16.6))
prof2a = prof2 * irit.sy(2) * irit.trans(((-2), (-4), 0))

prof3 = ((-arc6) + (-arc8) * irit.tx(3) + (-arc1) * irit.tx(7.6) +
         (-arc9) * irit.tx(12.3) + (-arc7) * irit.tx(15.3))
prof3a = prof3 * irit.sy(2) * irit.trans(((-2), (-8), 0))

prof4 = ((-arc6) + (-arc8) * irit.tx(3) + (-arc1) * irit.tx(7.6) +
         (-arc0) * irit.tx(12.3))
prof4a = prof4 * irit.sy(2) * irit.trans(((-2), (-12), 0))

irit.free(arc0)
irit.free(arc1)
irit.free(arc2)
irit.free(arc3)
irit.free(arc4)
irit.free(arc5)
Exemplo n.º 30
0
                        rotatevector2(dir, rfactor) * lfactor, size * wfactor,
                        blevel, level - 1)
        tr2 = virttree3(
            newpos,
            rotatevector2(dir, rfactor * irit.random((-1), 1)) * lfactor,
            size * wfactor, blevel, level - 1)
        tr3 = virttree3(newpos,
                        rotatevector2(dir, (-rfactor)) * lfactor,
                        size * wfactor, blevel, level - 1)
        retval = retval + tr1 + tr2 + tr3
    return retval


irit.SetViewMatrix(
    irit.rotx((-90)) * irit.roty(135) * irit.rotx((-30)) * irit.scale(
        (0.2, 0.2, 0.2)) * irit.trans((0, (-0.5), 0)))

tree1 = virttree2(irit.point(0, 0, 0), irit.vector(0, 0, 1), 0.3, 4, 7)
irit.interact(irit.list(irit.GetViewMatrix(), tree1))
irit.free(tree1)

tree2 = virttree3(irit.point(0, 0, 0), irit.vector(0, 0, 1), 0.5, 3, 5)
irit.interact(tree2)
irit.free(tree2)


def forest3(n, m, blevel, level):
    retval = irit.nil()
    i = 0
    while (i <= n):
        j = 0