Beispiel #1
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
Beispiel #2
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
Beispiel #3
0
if (display == 1):
    irit.interact(cb_all)
    irit.viewstate("dsrfmesh", 1)
    irit.pause()
    irit.viewstate("dsrfmesh", 0)
    irit.pause()

#
#  convert into polygons/polylines (using default resolution).
#

p = irit.gpolyline(irit.list(sb, cb), 0)
if (display == 1):
    irit.interact(irit.list(p, irit.GetAxes()))

p = irit.gpolygon(sb, 1)
if (display == 1):
    irit.viewstate("drawvnrml", 1)
    irit.interact(irit.list(p, irit.GetAxes()))
    irit.viewstate("drawvnrml", 0)

#
#  reverse surface ( flip normals ).
#
q = irit.gpolygon((-sb), 1)
if (display == 1):
    irit.viewstate("drawvnrml", 1)
    irit.interact(irit.list(q, irit.GetAxes()))
    irit.viewstate("drawvnrml", 0)

#
Beispiel #4
0
3, 4, 4, 4, 4 ) ) )

echosrc = irit.iritstate("echosource", echosrc)
irit.free(echosrc)

irit.color(body, irit.RED)
irit.color(cap, irit.GREEN)
irit.color(spout, irit.BLUE)
irit.color(handle, irit.MAGENTA)

irit.SetViewMatrix(irit.scale((0.3, 0.3, 0.3)))

save_approx_opt = irit.GetPolyApproxOpt()
irit.SetPolyApproxOpt(1)
irit.SetPolyApproxTol(0.025)
pbody = (-irit.gpolygon(irit.sregion(body, irit.COL, 0.8, 3), 1))
pspout = (-irit.gpolygon(irit.sregion(spout, irit.COL, 0, 1), 1))
phandle = (-irit.gpolygon(handle, 1)) * irit.tx(0.15)

teapotaux = (pbody + pspout + phandle)

basey = 0.025
bodybase = irit.poly(
    irit.list(((-2), basey, (-2)), ((-2), basey, 2), (2, basey, 2),
              (2, basey, (-2))), irit.FALSE)

teapotaux2 = teapotaux * bodybase

basey2 = 2.3
bodybase2 = irit.poly(
    irit.list(((-2), basey2, (-2)), ((-2), basey2, 2), (2, basey2, 2),
Beispiel #5
0
irit.interact( crvtrobjrgb )

crvtrobjrgb = mean2rgb( crvtrobj, 1 )
irit.interact( crvtrobjrgb )
irit.save( "pl1crvtr", crvtrobjrgb )

crvtrobjrgb = gausmean2rgb( crvtrobj, 15, 1 )
irit.interact( crvtrobjrgb )
irit.save( "pl2crvtr", crvtrobjrgb )

#  
#  Teapot
# 
import teapot2
irit.SetResolution( 10 )
teapot = irit.triangl( irit.gpolygon( irit.load( "teapot2" ), 1 ), 1 )

irit.SizeOf( teapot )

crvtrobj = irit.pcrvtr( teapot, 1, 0 )
irit.free( teapot )

k_0 = irit.ppropftch( crvtrobj, 0, irit.list( "kcurv", 0 ) )
irit.color( k_0, irit.YELLOW )

h_0 = irit.ppropftch( crvtrobj, 0, irit.list( "hcurv", 0 ) )
irit.color( h_0, irit.CYAN )

crvtrobjrgb = gauss2rgb( crvtrobj, 1 )
irit.interact( irit.list( crvtrobjrgb, k_0 ) )
irit.save( "pl3crvtr", irit.list( crvtrobjrgb, k_0 ) )
Beispiel #6
0
              dc2 * irit.ty(1) * irit.tz((-2)),
              dc2 * irit.ty(1) * irit.tz((-3))), 4, irit.KV_OPEN)
irit.attrib(s2d, "gray", irit.GenRealObject(0.35))
irit.awidth(s2d, 0.012)

all2 = irit.list(s1d, s2d, dc1)
irit.interact(all2)
irit.save("crv2dcmp", irit.list(s1d, s2d, dc1))

#  system("illustrt -t 0.005 -l 0.005 -f 0 256 -I 8 crv2dcmp.itd crv2dcmp.imd | irit2ps -d -u - > crv2dcmp.ps");

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

irit.SetResolution(5)

pl1 = irit.gpolygon(s1, 1)
irit.attrib(pl1, "gray", irit.GenRealObject(0.2))
irit.awidth(pl1, 0.012)

pl2 = irit.gpolygon(s2, 1)
irit.attrib(pl2, "gray", irit.GenRealObject(0.35))
irit.awidth(pl2, 0.012)

all3 = irit.list(pl1, pl2)

irit.interact(all3)
irit.save("crv3dcmp", all2)

#  system("illustrt -O -t 0.005 -l 0.005 -f 0 256 -I 8 crv3dcmp.itd crv3dcmp.imd | irit2ps -d -u - > crv3dcmp.ps");

irit.SetResolution(9)
Beispiel #7
0
                      irit.normalizeVec(irit.vector(10, 2, (-5)))),
        irit.interppoint(irit.point(0, 1, 15), irit.point(10, 2, (-5)), 0.1),
        irit.interppoint(irit.vector(0, 1, 15), irit.vector(10, 2, (-5)), 1.1),
        ed1, ed2, ed3, ed4))

irit.free(ed1)
irit.free(ed2)
irit.free(ed3)
irit.free(ed4)

trs = irit.torussrf(1, 0.2)
irit.color(trs, irit.GREEN)
irit.interact(trs)

irit.SetResolution(5)
polytrs = irit.setnormalsinpolyobj(irit.gpolygon(trs, 0),
                                   irit.GenStrObject("1,0,0"))
irit.color(polytrs, irit.RED)

irit.interact(irit.list(trs, polytrs))

scalecrv = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.05, 0.25 ), \
                                        irit.ctlpt( irit.E2, 0.1, 0 ), \
                                        irit.ctlpt( irit.E2, 0.2, 0.5 ), \
                                        irit.ctlpt( irit.E2, 0.3, 0 ), \
                                        irit.ctlpt( irit.E2, 0.4, 0.5 ), \
                                        irit.ctlpt( irit.E2, 0.5, 0 ), \
                                        irit.ctlpt( irit.E2, 0.6, 0.5 ), \
                                        irit.ctlpt( irit.E2, 0.7, 0 ), \
                                        irit.ctlpt( irit.E2, 0.8, 0.5 ), \
                                        irit.ctlpt( irit.E2, 0.85, 0.25 ) ), irit.list( irit.KV_OPEN ) )
1, 2, 2, 2, 2 ), irit.list( 0, 0, 0, 0, 1, 1,\
1, 2, 2, 2, 3, 3,\
3, 4, 4, 4, 4 ) ) )

echosrc = irit.iritstate("echosource", echosrc)

irit.color(body, irit.RED)
irit.color(cap, irit.GREEN)
irit.color(spout, irit.BLUE)
irit.color(handle, irit.MAGENTA)

irit.SetViewMatrix(irit.scale((0.3, 0.3, 0.3)))
teapot = irit.list(body, spout, handle, cap)

irit.SetResolution(5)
pbody = irit.gpolygon(body, 0)
phandle = irit.gpolygon(handle, 0)
pspout = irit.gpolygon(spout, 0)
pcap = irit.gpolygon(cap, 0)

irit.interact(irit.list(pbody, phandle, pspout, pcap, irit.GetViewMatrix()))
irit.save("decimat1",
          irit.list(pbody, phandle, pspout, pcap, irit.GetViewMatrix()))

dbody = irit.pdecimate(pbody, 1, 0.25)
dhandle = irit.pdecimate(phandle, 1, 0.25)
dspout = irit.pdecimate(pspout, 1, 0.25)
dcap = irit.pdecimate(pcap, 1, 0.25)

irit.interact(irit.list(dbody, dhandle, dspout, dcap))
irit.save("decimat2", irit.list(dbody, dhandle, dspout, dcap))
import math
import irit
#

#
#  Extraction of curves of prescribed properties out of polygonal models.
#
#                                                Gershon Elber, Mar 2003
#

save_res = irit.GetResolution()
import teapot2
spout2 = teapot2.spout2

irit.SetResolution(10)
spout2 = irit.gpolygon(spout2, 1)
irit.color(spout2, irit.RED)

#
#  Extract silhouettes.
#

pl1 = irit.ppropftch(spout2, 1,
                     irit.list(irit.normalizeVec(irit.vector(1, 1, 1)), 90))
pl2 = irit.ppropftch(spout2, 1,
                     irit.list(irit.normalizeVec(irit.vector(1, (-1), 1)), 90))
pl3 = irit.ppropftch(spout2, 1,
                     irit.list(irit.normalizeVec(irit.vector(1, 0, 1)), 90))
irit.color(pl1, irit.WHITE)
irit.color(pl2, irit.CYAN)
irit.color(pl3, irit.GREEN)
Beispiel #10
0
#
#  A cone: returned is (Error, Xapex, Yapex, Zapex, angle,
#                                     Xdir, Ydir, Zdir)
#
x1 = irit.maxedgelen( irit.triangl( irit.con2( ( 0, 0, 0 ), ( 0, 0, 1 ), 1, 2, 0 ),\
1 ), 0.3 )
x2 = irit.maxedgelen( irit.triangl( irit.con2( ( (-1 ), 1.2, (-0.5 ) ), ( 2, 1, 1 ), 0.5, 0, 0 ),\
1 ), 0.3 )
conefit = irit.list(irit.fitpmodel(x1, 4, 0.001, 30),
                    irit.fitpmodel(x2, 4, 1e-005, 30))

#
#  Planar fit: return is (Error, A, B, C, D)
#

x1 = irit.triangl(irit.gpolygon(irit.planesrf(0, 0, 1, 1), 1), 1)
x1 = irit.maxedgelen(x1, 0.2)

x2 = x1 * irit.rx(45)

irit.view(irit.list(irit.GetAxes(), x2), irit.ON)

planefit = irit.list(irit.fitpmodel(x1, 0, 1e-005, 100),
                     irit.fitpmodel(x2, 0, 1e-005, 100))

#
#  Some a larger test on planes
#
x1 = irit.nil()
i = 0
while (i <= 2):
Beispiel #11
0
irit.SetViewMatrix(  irit.GetViewMatrix() * irit.scale( ( 0.5, 0.5, 0.5 ) ))
save_res = irit.GetResolution()

irit.SetResolution(  12)

t1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.25, 0, 1 ), \
                                  irit.ctlpt( irit.E3, 0.01, 0, 1 ), \
                                  irit.ctlpt( irit.E3, 0.04, 0, 1.1 ), \
                                  irit.ctlpt( irit.E3, 0.04, 0, 1.25 ), \
                                  irit.ctlpt( irit.E3, 0.04, 0, 1.3 ), \
                                  irit.ctlpt( irit.E3, 0.001, 0, 1.3 ) ), irit.list( 0, 0, 0, 1, 2, 3,\
4, 4, 4 ) )
t1 = irit.surfrev( t1 )

t2 = t1 * irit.rotx( 180 )
t = irit.gpolygon( irit.list( t1, t2 ), 1 )
irit.free( t1 )
irit.free( t2 )
irit.interact( irit.list( irit.GetViewMatrix(), t ) )

irit.SetResolution(  20)

t3 = irit.cylin( ( 0, 0, (-2 ) ), ( 0, 0, 4 ), 0.1, 3 )
irit.view( t3, irit.OFF )

s1 = t3 * t
irit.free( t )
irit.free( t3 )

final = irit.convex( s1 )
irit.free( s1 )
Beispiel #12
0
i = 0
while (i <= 1):
    irit.snoc(irit.csurface(b, irit.ROW, i), isos)
    i = i + 0.1
i = 0
while (i <= 1):
    irit.snoc(irit.csurface(b, irit.COL, i), isos)
    i = i + 0.25
i = 0
while (i <= 1):
    irit.snoc(irit.csurface(b, irit.DEPTH, i), isos)
    i = i + 1 / 3.0
irit.interact(isos)
irit.free(isos)

polygns = irit.gpolygon(b, 1)
irit.color(polygns, irit.RED)
irit.interact(irit.list(b, polygns))
irit.free(polygns)

polylns = irit.gpolyline(b, 15)
irit.color(polylns, irit.MAGENTA)
irit.interact(irit.list(b, polylns))
irit.free(polylns)

be2 = irit.coerce(b, irit.E2)
irit.color(b, irit.RED)

p = irit.tseval(b, 1 / 3.0, 1 / 3.0, 1 / 3.0)
n = irit.tsnormal(b, 1 / 3.0, 1 / 3.0, 1 / 3.0)
nrml = (irit.coerce(p, irit.E3) +
Beispiel #13
0
cross = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, (-1 ), 0, 0 ), \
                                     irit.ctlpt( irit.E3, (-1.1 ), 0.2, 0 ), \
                                     irit.ctlpt( irit.E3, (-1.1 ), 0.6, 0 ), \
                                     irit.ctlpt( irit.E3, (-0.7 ), 1.1, 0 ), \
                                     irit.ctlpt( irit.E3, (-0.5 ), 1.3, 0 ), \
                                     irit.ctlpt( irit.E3, 0.5, 1.3, 0 ), \
                                     irit.ctlpt( irit.E3, 0.7, 1.1, 0 ), \
                                     irit.ctlpt( irit.E3, 1.1, 0.6, 0 ), \
                                     irit.ctlpt( irit.E3, 1.1, 0.2, 0 ), \
                                     irit.ctlpt( irit.E3, 1, 0, 0 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.rz( (-90 ) ) * irit.sc( 0.3 )
direc = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, (-1.2 ), 0, 0 ), \
                                     irit.ctlpt( irit.E3, 0, 0.24, 0 ), \
                                     irit.ctlpt( irit.E3, 1.2, 0, 0 ) ), irit.list( irit.KV_OPEN ) )

irit.SetResolution(res)
srf1 = irit.gpolygon((-irit.sweepsrf(irit.coerce(cross, irit.KV_OPEN), direc,
                                     irit.GenIntObject(0))), 1)
irit.free(cross)
irit.free(direc)

irit.SetResolution(res * 5)
cyl1 = irit.cylin((0, 0, (-1)), (0, 0, 2), 1.15, 3)

srf2 = srf1 * cyl1
irit.free(cyl1)

irit.SetResolution(res * 5)
cyl2 = irit.cylin((0, 0.2, (-1)), (0, 0, 2), 0.6, 3)

srf3 = srf1 * cyl2 * irit.sz(4) * irit.sx(0.9) * irit.ty((-0.15))
irit.free(srf1)
irit.free(cyl2)
Beispiel #14
0
                          irit.ctlpt( irit.E2, 1, 0 ) + \
                          irit.ctlpt( irit.E2, 1, 1 ) )
srftext1 = irit.sraise(irit.sraise(srftext1, irit.ROW, 3), irit.COL, 3)
srftext1 = irit.srefine(srftext1, irit.ROW, 0, irit.list(0.25, 0.5, 0.75))
srftext1 = irit.srefine(srftext1, irit.COL, 0, irit.list(0.25, 0.5, 0.75))
srftext1 = irit.coerce(srftext1, irit.E3)

#  Make a spike out of the four interior points.
srftext1 = irit.seditpt(srftext1, irit.ctlpt(irit.E3, 0.5, 0.5, 1), 2, 2)
srftext1 = irit.seditpt(srftext1, irit.ctlpt(irit.E3, 0.5, 0.5, 1), 2, 3)
srftext1 = irit.seditpt(srftext1, irit.ctlpt(irit.E3, 0.5, 0.5, 1), 3, 2)
srftext1 = irit.seditpt(srftext1, irit.ctlpt(irit.E3, 0.5, 0.5, 1), 3, 3)

irit.SetResolution(6)

srf1 = irit.sddmmap(srf, irit.gpolygon((-srftext1) * irit.sz(0.1), 1), 4, 8, 1)
irit.interact(srf1)

srf1 = irit.sddmmap(srf, irit.gpolygon((-srftext1) * irit.sz(0.2), 1), 8, 12,
                    1)
irit.interact(srf1)
irit.save("disp1map", srf1)

irit.free(srftext1)
irit.free(srf1)

# #############################################################################
#
#  Scale like texture
#
Beispiel #15
0
#

save_res = irit.GetResolution()
save_mat2 = irit.GetViewMatrix()
irit.SetViewMatrix(irit.rotx(0))

#
#  Get a model.
#

irit.SetResolution(20)
s = irit.ruledsrf( irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                   irit.ctlpt( irit.E3, 1, 0, 0 ), \
                   irit.ctlpt( irit.E3, 0, 1, 0 ) + \
                   irit.ctlpt( irit.E3, 1, 1, 0 ) )
pls = irit.maxedgelen(irit.triangl(irit.gpolygon(s, 1), 0), 0.2)

#
#  Define the trivarate warping function.
#

s1 = irit.ruledsrf( irit.ctlpt( irit.E3, (-0 ), 0, 0.01 ) + \
                    irit.ctlpt( irit.E3, 0.5, 0, (-0.01 ) ) + \
                    irit.ctlpt( irit.E3, 1, 0, 0.01 ), \
                    irit.ctlpt( irit.E3, (-0 ), 1, 0.01 ) + \
                    irit.ctlpt( irit.E3, 0.5, 1, (-0.01 ) ) + \
                    irit.ctlpt( irit.E3, 1, 1, 0.01 ) )
tv = irit.tfromsrfs(
    irit.list(s1 * irit.tz((-0.5)),
              s1 * irit.sc(0.96) * irit.tx(0.02) * irit.tz(0.5)), 2,
    irit.KV_OPEN)