Esempio n. 1
0
def display(c1, pt, bisrf):
    irit.color(c1, irit.YELLOW)
    irit.adwidth(c1, 3)
    irit.color(irit.point(pt[0], pt[1], pt[2]), irit.GREEN)
    irit.adwidth(irit.point(pt[0], pt[1], pt[2]), 3)
    irit.color(bisrf, irit.MAGENTA)
    irit.view(irit.list(c1, pt, bisrf), irit.ON)
Esempio n. 2
0
def display(c1, c2, bisrf):
    irit.color(c1, irit.WHITE)
    irit.adwidth(c1, 3)
    irit.color(c2, irit.YELLOW)
    irit.adwidth(c2, 3)
    irit.color(bisrf, irit.MAGENTA)
    irit.view(irit.list(c1, c2, bisrf), irit.ON)
Esempio n. 3
0
def animbisectcrv2( crv1, crv2, data, cntr ):
    irit.color( crv1, irit.YELLOW )
    irit.color( crv2, irit.YELLOW )
    irit.adwidth( crv1, 4 )
    irit.adwidth( crv2, 4 )
    i = 0
    while ( i <= irit.SizeOf( cntr ) - 1 ):
        pt = irit.coord( cntr, i )
        pt1 = irit.ceval( crv1, irit.FetchRealObject(irit.coord( pt, 0 ) ))
        pt2 = irit.ceval( crv2, irit.FetchRealObject(irit.coord( pt, 1 ) ))
        nrml1 = cnormalplnr( crv1, irit.coord( pt, 0 ) )
        nrml2 = cnormalplnr( crv2, irit.coord( pt, 1 ) )
        aaa = irit.ptslnln( irit.Fetch3TupleObject(irit.coerce( pt1, irit.POINT_TYPE )), 
										  irit.Fetch3TupleObject(nrml1), 
										  irit.Fetch3TupleObject(irit.coerce( pt2, irit.POINT_TYPE )), 
										  irit.Fetch3TupleObject(nrml2 ))
        if (irit.IsNullObject(aaa)):
            interpt = irit.GenNullObject();
        else:
            interpt = irit.nth( aaa, 1 )
        if ( irit.ThisObject(interpt) == irit.POINT_TYPE ):
            irit.color( pt1, irit.GREEN )
            irit.color( pt2, irit.GREEN )
            irit.color( interpt, irit.WHITE )
            bisectlns = irit.coerce( pt1, irit.E2 ) + irit.coerce( interpt, irit.E2 ) + irit.coerce( pt2, irit.E2 )
            irit.color( bisectlns, irit.MAGENTA )
            if ( irit.FetchRealObject(irit.coord( interpt, 1 )) < 10 and \
				 irit.FetchRealObject(irit.coord( interpt, 1 )) > (-10 ) and \
				 irit.FetchRealObject(irit.coord( interpt, 2 )) < 10 and \
				 irit.FetchRealObject(irit.coord( interpt, 2 )) > (-10 ) ):
                irit.view( irit.list( crv1, crv2, data, pt1, pt2, interpt, \
                bisectlns ), irit.ON )
        i = i + 1
Esempio n. 4
0
def testccdistfunc(crv1, crv2, refs):
    if (irit.SizeOf(refs) > 0):
        crv1 = irit.crefine(crv1, 0, refs)
        crv2 = irit.crefine(crv2, 0, refs)
    irit.view(irit.list(irit.GetAxes(), crv1, crv2), irit.ON)
    bb = irit.bbox(irit.dist2ff(crv1, crv2, 1))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all1 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("distance square         bound from %8.5lf to %8.5lf  (%s)\n",
                all1)
    bb = irit.bbox(irit.dist2ff(crv1, crv2, 2))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all2 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on crv1nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all2)
    bb = irit.bbox(irit.dist2ff(crv1, crv2, 3))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all3 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on crv2nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all3)
    irit.pause()
    retval = irit.list(all1, all2, all3)
    return retval
Esempio n. 5
0
def display2(c1, c2, bisrf, iso, pt):
    irit.color(c1, irit.WHITE)
    irit.adwidth(c1, 3)
    irit.color(c2, irit.YELLOW)
    irit.adwidth(c2, 3)
    irit.color(iso, irit.RED)
    irit.adwidth(iso, 3)
    irit.color(pt, irit.CYAN)
    irit.adwidth(pt, 6)
    irit.color(bisrf, irit.MAGENTA)
    irit.view(irit.list(c1, c2, bisrf, iso, pt), irit.ON)
Esempio n. 6
0
def testrun( numcrvs, crvdeg, crvlen, crvsize, seed, subeps,\
    numeps, opti ):
    ri = irit.iritstate("randominit", irit.GenIntObject(seed))
    c = randomcrvs(numcrvs, crvdeg, crvlen, crvsize)
    irit.attrprop(c, "color", irit.GenIntObject(14))
    irit.view(c, irit.ON)
    msc = irit.mscirc(c, irit.list(subeps, numeps))
    irit.view(msc, irit.OFF)
    irit.pause()
    retval = irit.list(msc, c)
    return retval
Esempio n. 7
0
def displayposnormal(crv, t1, t2, scl, bg_obj):
    pt1 = irit.ceval(crv, irit.FetchRealObject(t1))
    pt2 = irit.ceval(crv, irit.FetchRealObject(t2))
    n1 = irit.cnormal(crv, irit.FetchRealObject(t1))
    n2 = irit.cnormal(crv, irit.FetchRealObject(t2))
    ptt1 = (irit.ctlpt(irit.E2, t1, t2) + irit.ctlpt(irit.E2, t1, 0))
    irit.color(ptt1, irit.YELLOW)
    ptt2 = (irit.ctlpt(irit.E2, t1, t2) + irit.ctlpt(irit.E2, 0, t2))
    irit.color(ptt2, irit.CYAN)
    n1 = (irit.coerce(
        irit.coerce(pt1, irit.POINT_TYPE) + n1 * irit.sc(scl), irit.E2) + pt1)
    irit.color(n1, irit.YELLOW)
    n2 = (irit.coerce(
        irit.coerce(pt2, irit.POINT_TYPE) + n2 * irit.sc(scl), irit.E2) + pt2)
    irit.color(n2, irit.CYAN)
    irit.view(irit.list(n1, n2, pt1, pt2, ptt1, ptt2, bg_obj), irit.ON)
Esempio n. 8
0
def interactorthomap(ppl, crv, scl):
    irit.clntpickcrsr(irit.CLIENTS_ALL)
    crsrkeep = irit.iritstate("cursorkeep", 1)
    quit = 0
    irit.view((ppl, crv, unitsquare), irit.ON)
    while (quit == 0):
        c = irit.clntcrsr(100)
        if (irit.SizeOf(c) > 0):
            u = irit.coord(irit.nth(c, 1), 0)
            v = irit.coord(irit.nth(c, 1), 1)
            irit.printf("u = %f,  v = %f\n", irit.list(u, v))
            if (u < 0 or u > 1 or v < 0 or v > 1):
                quit = 1
            else:
                displayposnormal(crv, u, v, scl)
    irit.clntpickdone(irit.CLIENTS_ALL)
    crsrkeep = irit.iritstate("cursorkeep", crsrkeep)
Esempio n. 9
0
def animbisectcrv( crv1, crv2, data, cntr ):
    irit.color( crv1, irit.YELLOW )
    irit.color( crv2, irit.YELLOW )
    irit.adwidth( crv1, 4 )
    irit.adwidth( crv2, 4 )
    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 ) )
        interpt = irit.nth( irit.ptslnln( irit.coerce( pt1, irit.POINT_TYPE ), nrml1, irit.coerce( pt2, irit.POINT_TYPE ), nrml2 ), 1 )
        if ( irit.ThisObject(interpt) == irit.POINT_TYPE ):
            irit.color( pt1, irit.GREEN )
            irit.color( pt2, irit.GREEN )
            irit.color( interpt, irit.WHITE )
            irit.view( irit.list( crv1, crv2, pt1, pt2, data, interpt ), irit.ON )
        i = i + 1
Esempio n. 10
0
def testssdistfunc(srf1, srf2, refs):
    if (irit.SizeOf(refs) > 0):
        srf1 = irit.srefine( irit.srefine( srf1, irit.ROW, 0, refs ), \
        irit.COL, \
        0, \
        refs )
        srf2 = irit.srefine( irit.srefine( srf2, irit.ROW, 0, refs ), \
        irit.COL, \
        0, \
        refs )
    irit.view(irit.list(irit.GetAxes(), srf1, srf2), irit.ON)
    bb = irit.bbox(irit.dist2ff(srf1, srf2, 1.0))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all1 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("distance square         bound from %8.5lf to %8.5lf  (%s)\n",
                all1)

    bb = irit.bbox(irit.dist2ff(srf1, srf2, 2.0))
    if ( irit.FetchRealObject(irit.nth( bb, 1 )) * \
   irit.FetchRealObject(irit.nth( bb, 2 )) > 0 ):
        res = "successful"
    else:
        res = "failed"
    all2 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on srf1nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all2)
    bb = irit.bbox(irit.dist2ff(srf1, srf2, 3.0))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all3 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on srf2nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all3)
    irit.pause()
    retval = irit.list(all1, all2, all3)
    return retval
Esempio n. 11
0
def testssi(s1, s2, eps):
    tm = irit.time(1)
    inter = irit.ssinter(s1, s2, 1, eps, 0)
    tm = irit.time(0)
    irit.color(inter, irit.GREEN)
    irit.view(irit.list(s1, s2, inter), irit.ON)
    irit.printf(
        "no alignment: length of intersection curve %d, time = %f sec.\n",
        irit.list(irit.SizeOf(irit.nth(irit.nth(inter, 1), 1)), tm))
    tm = irit.time(1)
    inter = irit.ssinter(s1, s2, 1, eps, 1)
    tm = irit.time(0)
    irit.color(inter, irit.GREEN)
    irit.view(irit.list(s1, s2, inter), irit.ON)
    irit.printf(
        "z alignment:  length of intersection curve %d, time = %f sec.\n",
        irit.list(irit.SizeOf(irit.nth(irit.nth(inter, 1), 1)), tm))
    tm = irit.time(1)
    inter = irit.ssinter(s1, s2, 1, eps, 2)
    tm = irit.time(0)
    irit.color(inter, irit.GREEN)
    irit.view(irit.list(s1, s2, inter), irit.ON)
    irit.printf(
        "rz alignment: length of intersection curve %d, time = %f sec.\n",
        irit.list(irit.SizeOf(irit.nth(irit.nth(inter, 1), 1)), tm))
Esempio n. 12
0
def skel2dcolor( prim1, prim2, prim3, eps, mzerotols, drawall, fname ):
    equapt = irit.skel2dint( prim1, prim2, prim3, 100, eps, 300, mzerotols )
    if ( irit.SizeOf( equapt ) > 1 ):
        irit.printf( "%d solutions detected\n", irit.list( irit.SizeOf( equapt ) ) )
    irit.color( equapt, irit.WHITE )
    irit.adwidth( prim1, 2 )
    irit.adwidth( prim2, 2 )
    irit.adwidth( prim3, 2 )
    tans = irit.nil(  )
    edges = irit.nil(  )
    circs = irit.nil(  )
    i = 1
    while ( i <= irit.SizeOf( equapt ) ):
        e = irit.nth( equapt, i )
        clrs = getrandomcolors(  )
        clr = irit.nth( clrs, 1 )
        dclr = irit.nth( clrs, 2 )
        d = irit.getattr( e, "prim1pos" )
        irit.snoc( d, tans )
        irit.snoc( setcolor( irit.coerce( irit.getattr( e, "prim1pos" ), irit.E2 ) + irit.coerce( e, irit.E2 ), dclr ), edges )
        irit.snoc( irit.getattr( e, "prim2pos" ), tans )
        irit.snoc( setcolor( irit.coerce( irit.getattr( e, "prim2pos" ), irit.E2 ) + irit.coerce( e, irit.E2 ), dclr ), edges )
        irit.snoc( irit.getattr( e, "prim3pos" ), tans )
        irit.snoc( setcolor( irit.coerce( irit.getattr( e, "prim3pos" ), irit.E2 ) + irit.coerce( e, irit.E2 ), dclr ), edges )
        irit.snoc( setcolor( irit.pcircle( irit.Fetch3TupleObject(irit.coerce( e, irit.VECTOR_TYPE )), 
										   irit.dstptpt( d, 
														 e ) ), 
							 clr ), 
				   circs )
        i = i + 1
    irit.color( edges, irit.MAGENTA )
    irit.color( tans, irit.GREEN )
    if ( drawall ):
        all = irit.list( prim1, prim2, prim3, edges, tans, circs,\
        equapt )
    else:
        all = irit.list( prim1, prim2, prim3, circs )
    if ( irit.SizeOf( irit.GenStrObject(fname) ) > 0 ):
        irit.save( fname, all )
    irit.view( all, irit.ON )
Esempio n. 13
0
t = irit.time(1)

save_res = irit.GetResolution()

irit.SetResolution(32)
t1 = irit.cylin(((-1.1), 0, 0), (2.2, 0, 0), 0.2, 3)
t2 = irit.cylin(((-0.8), 0, 0), (0.05, 0, 0), 0.3, 3)
t3 = irit.cylin((0.8, 0, 0), ((-0.05), 0, 0), 0.3, 3)

s1 = (t1 + t2 + t3)
irit.free(t1)
irit.free(t2)
irit.free(t3)
s1 = irit.convex(s1)
irit.view(s1, irit.ON)

s2 = s1 * irit.roty(90)
s3 = s1 * irit.rotz(90)
irit.view(irit.list(s2, s3), irit.OFF)

s4 = (s1 + s2 + s3)
irit.free(s1)
irit.free(s2)
irit.free(s3)
irit.view(s4, irit.ON)

irit.SetResolution(64)
t4 = irit.sphere((0, 0, 0), 1)

s5 = (t4 - s4)
Esempio n. 14
0
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.pause()

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

irit.SetViewMatrix(  save_mat2)

irit.free( teapotorig )
irit.free( teapot )
irit.free( warpedteapot )
irit.free( clr )
irit.free( warpedsrf )
irit.free( srf )
irit.free( all )
Esempio n. 15
0
#                                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)

c2 = irit.cylin((0, (-0.4), 0.595), (0, 0.8, 0), 0.3, 3)
irit.view(c2, irit.OFF)
s3 = (s2 - c2)
irit.free(s2)
irit.free(c2)
Esempio n. 16
0
intrcrv = irit.iritstate("intercrv", intrcrv)

irit.viewremove("c")
irit.viewobj(cntrs)
irit.pause()

irit.save("contour1", cntrs)

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

irit.SetResolution(50)
view_mat1 = irit.GetViewMatrix() * irit.sc(0.9)

x = irit.sphere((0, 0, 0), 1)
irit.color(x, irit.RED)
irit.view(irit.list(view_mat1, irit.GetAxes(), x), irit.ON)

allcntrs = irit.nil()

l = (-0.95)
while (l <= 0.99):
    c = irit.contour(
        x, irit.plane(1 / math.sqrt(3), 1 / math.sqrt(3), 1 / math.sqrt(3), l))
    irit.viewobj(c)
    irit.milisleep(50)
    irit.snoc(c * irit.tx(0), allcntrs)
    l = l + 0.1
irit.interact(irit.list(irit.GetAxes(), x, allcntrs))

# ############
view_mat1 = irit.GetViewMatrix() * irit.sc(0.7)
Esempio n. 17
0
    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


doms = dominos(irit.circle((0, 0, 0), 1), 1.5, 0.1)

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

irit.pause()

irit.save("dominos", doms)

irit.free(doms)
Esempio n. 18
0
irit.adwidth(d, 2)

irit.interact(irit.list(c, d, irit.GetAxes()))
bg_obj = irit.list(c, d, irit.GetAxes())

t = 0
while (t <= 1):
    pc = irit.circle(
        irit.Fetch3TupleObject(irit.coerce(irit.ceval(c, t),
                                           irit.VECTOR_TYPE)), 0.1)
    irit.viewobj(pc)
    pd = irit.circle(
        irit.Fetch3TupleObject(irit.coerce(irit.ceval(d, t),
                                           irit.VECTOR_TYPE)), 0.1)
    irit.color(pd, irit.YELLOW)
    irit.view(irit.list(pc, pd, bg_obj), irit.ON)
    t = t + 0.002

pt1 = irit.sphere((0, 0, 0), 0.15)
irit.attrib(pt1, "rgb", irit.GenStrObject("255,128,0"))
mov_xyz1 = c * irit.tx(0)
irit.attrib(pt1, "animation", mov_xyz1)

pt2 = pt1
irit.attrib(pt2, "rgb", irit.GenStrObject("255,128,128"))
mov_xyz2 = d * irit.tx(0)
irit.attrib(pt2, "animation", mov_xyz2)

all = irit.list(c, d, pt1, pt2) * irit.sc(0.22) * irit.ty(0.1)
irit.interact(all)
irit.save("duality1", all)
Esempio n. 19
0
     irit.cnvrtpolytoptlist( \
      irit.cnvrtcrvtopolygon( backcross, 50, 0 ) \
            ) + \
     backcrosspts, 0 \
      ), \
    ( 0, 2, 0 ), \
    3 \
     ) - \
  irit.extrude( \
    irit.cnvrtcrvtopolygon( heartcross, 50, 0 ), \
    ( 0, (-2 ), 0 ), \
    3 \
     ) \
  ) * irit.ty( 189 )
irit.attrib(back, "rgb", irit.GenStrObject("244,164,96"))
irit.free(backcrosspts)
irit.free(heartcross)
irit.free(backcross)

all = irit.list(legs, skel, cover, back)
irit.free(back)
irit.free(cover)
irit.free(skel)
irit.free(legs)

irit.view(all, irit.ON)
irit.pause()
irit.save("bed", all)

irit.free(all)
Esempio n. 20
0
# 
#  Point inclusion tests.
# 
#                        Gershon Elber, Nov 2007
# 

view_mat0 = irit.tx( 0 )

# #############################################################################
# 
#  Point inclusion in a polygon:
# 
pl1 = irit.poly( 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 ) ), 0 ) * irit.tx( (-0.15 ) ) * irit.ty( (-0.3 ) )


irit.view( irit.list( irit.GetAxes(), pl1 ), 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.ppinclude( pl1, irit.Fetch3TupleObject(p) ) ) ):
        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, pl1, pts ) )
Esempio n. 21
0
                                      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 ), \
                                      irit.ctlpt( irit.E2, 1, 0 ), \
                                      irit.ctlpt( irit.E2, 2, 0 ), \
                                      irit.ctlpt( irit.E2, 2, 2.9 ), \
                                      irit.ctlpt( irit.E2, 1, 2.6 ), \
                                      irit.ctlpt( irit.E2, 0, 2.9 ) ), irit.list( irit.KV_PERIODIC ) )

tsrf = irit.trimsrf(srf, irit.list(tcrvs3, tcrvs2, tcrvs1), 1)

irit.free(srf)
irit.free(tcrvs3)
irit.free(tcrvs2)
irit.free(tcrvs1)

irit.attrib(tsrf, "rgb", irit.GenStrObject("200,255,100"))

irit.view(tsrf, irit.ON)

irit.save("facemask", tsrf)

irit.pause()

irit.free(tsrf)
Esempio n. 22
0
intercrvs = intercrvspaint(intercrvs)

all1 = irit.list(irit.GetAxes(), intercrvs)

irit.free(intercrvs)

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

theta = 45
while (theta >= 0):
    rcrvs = crvs * irit.rz(theta) * irit.tx((-0.35))
    linearlowenv = irit.carrangmnt(rcrvs, 1e-009, 3,
                                   irit.GenRealObject(0)) * irit.tz((-0.2))
    irit.color(linearlowenv, irit.YELLOW)
    irit.adwidth(linearlowenv, 3)
    irit.view(irit.list(irit.GetAxes(), rcrvs, linearlowenv), irit.ON)
    theta = theta + (-1)

all2 = irit.list(irit.GetAxes(), crvs * irit.tx((-0.35)), linearlowenv)

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

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)
Esempio n. 23
0
all4 = irit.list(srf1, srf2, sblher4)
irit.interact(irit.list(all4, irit.GetAxes()))
irit.save("blending5", irit.list(srf1, srf2, sher, sblher2, sblher3, sblher4))

# ############################################################################
#
#  Animate the blended parameters:
#

tanlen = 0
while (tanlen <= 1.25):
    sblher3 = irit.blhermite(c1, c2, d1 * irit.sc(tanlen),
                             d2 * irit.sc(tanlen), csec2, n * irit.sc(0.5))
    irit.attrib(sblher3, "transp", irit.GenRealObject(0.5))
    irit.attrib(sblher3, "rgb", irit.GenStrObject("100,255,255"))
    irit.view(irit.list(srf1, srf2, sblher3), irit.ON)
    tanlen = tanlen + 0.025

height = 0
while (height <= 1):
    sblher3 = irit.blhermite(c1, c2, d1, d2, csec2, n * irit.sc(height))
    irit.attrib(sblher3, "transp", irit.GenRealObject(0.5))
    irit.attrib(sblher3, "rgb", irit.GenStrObject("100,255,255"))
    irit.view(irit.list(srf1, srf2, sblher3), irit.ON)
    height = height + 0.025

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

#irit.free( s )
#irit.free( ds )
#irit.free( s1 )
Esempio n. 24
0
#
#  Try it with coplanar false for fun.
#
#  irit.iritstate( "coplanar", false );
#

psort = irit.iritstate("polysort", irit.GenRealObject(0))

t1 = irit.box(((-2), (-0.35), 0), 4, 0.7, 0.4)
irit.SetResolution(80)
t2 = irit.cylin((0, 0, 0), (0, 0, 0.4), 1.4, 3)
s1 = t1 * t2
irit.free(t1)
irit.free(t2)
irit.view(irit.list(irit.GetViewMatrix(), s1), irit.ON)

irit.SetResolution(40)
t3 = irit.cylin((0, 0, 0), (0, 0, 0.4), 0.9, 3)
s2 = (s1 + t3)
irit.free(t3)
irit.free(s1)
irit.view(s2, irit.ON)

irit.SetResolution(80)
t4 = irit.cylin((1.45, (-0.5), 1), (0, 1, 0), 0.8, 3)
t5 = irit.cylin(((-1.45), (-0.5), 1), (0, 1, 0), 0.8, 3)
s3 = (s2 - t4 - t5)
irit.free(t4)
irit.free(t5)
irit.free(s2)
Esempio n. 25
0
#
#  A point and a line in the XY plane
#
c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-0.3 ), (-1 ) ), \
                              irit.ctlpt( irit.E2, (-0.3 ), 1 ) ) )
pt2 = irit.point(0.4, 0.2, 0)
irit.color(c1, irit.RED)
irit.adwidth(c1, 3)
irit.color(pt2, irit.RED)
irit.adwidth(pt2, 3)

t = 0
while (t <= 1):
    bisectcrv = irit.calphasector(irit.list(c1, pt2), t)
    irit.color(bisectcrv, irit.GREEN)
    irit.view(irit.list(c1, pt2, bisectcrv), irit.ON)
    t = t + 0.03

irit.save(
    "asect2d1",
    irit.list(c1, pt2, irit.calphasector(irit.list(c1, pt2), 0.1),
              irit.calphasector(irit.list(c1, pt2), 0.5),
              irit.calphasector(irit.list(c1, pt2), 1)))

irit.pause()

# ############################################################################
#
#  A point and a cubic curve in the XY plane
#
c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-0.9 ), (-0.1 ) ), \
Esempio n. 26
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)
Esempio n. 27
0
#  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
while ( i <= irit.SizeOf( crvs ) ):
    c = irit.nth( crvs, i )
    irit.color( c, irit.YELLOW )
    irit.view( irit.list( crv1a, crv1b, c ), irit.ON )
Esempio n. 28
0
            retval )
            j = j + 1
        i = i + 1
    return retval

base = irit.ruledsrf( irit.ctlpt( irit.E2, (-20 ), (-20 ) ) + \
                      irit.ctlpt( irit.E2, (-20 ), 40 ), \
                      irit.ctlpt( irit.E2, 40, (-20 ) ) + \
                      irit.ctlpt( irit.E2, 40, 40 ) )
irit.attrib(base, "rgb", irit.GenStrObject("244,164,96"))
irit.attrib(base, "ptexture", irit.GenStrObject("ground.rle"))
irit.viewobj(base)
irit.save("base", base)

frst = forest3(1, 1, 2, 4)
irit.view(irit.list(frst, base), irit.ON)

#
#  Be prepared, this one is quite large.
#
#  frst = forest3( 4, 4, 3, 5 );
#  viewstate( "PolyAprx", 0 );
#  viewstate( "PolyAprx", 0 );
#  viewstate( "PolyAprx", 0 );
#  viewstate( "NumIsos", 0 );
#  viewstate( "NumIsos", 0 );
#  viewstate( "NumIsos", 0 );
#  view( list( frst, base ), on );

irit.save("forrest.ibd", frst)
Esempio n. 29
0
# ############################################################################
# 
#  Polygons:
# 
# ############################################################################

pl = irit.poly( irit.list(  ( 1, 0, 0 ),  ( 0, (-0.8 ), 0 ), irit.point( (-0.5 ), 0, 0 ) ), irit.FALSE )
ppl = plgntoplln( pl )

irit.interact( irit.list( irit.GetAxes(), ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) )

angle = 18
while ( angle < 19.4 ):
    irit.printf( "angle = %.2f\n", irit.list( angle ) )
    irit.view( irit.list( ppl, gammakernelpolysrfs( pl, angle, 2 ) * irit.sz( (-1 ) ) ), irit.ON )
    angle = angle + 0.1

irit.pause(  )

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

pl = irit.poly( 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.FALSE )
ppl = plgntoplln( pl )

irit.interact( irit.list( irit.GetAxes(), ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) )

irit.save( "gama1krn", irit.list( ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) )

angle = 21
while ( angle < 22.6 ):
Esempio n. 30
0
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 ) )

irit.view( irit.list( b1, b2 ), irit.ON )

c2 = irit.cylin( ( 0, 0, 0 ), ( 0, 1, 0 ), 0.05, 3 )
c3 = irit.cylin( ( 1, 0, 0 ), ( 0, 1, 0 ), 0.05, 3 )

b12 = ( (b1 ^ b2) + (c2 ^ c3) )
irit.free( b1 )
irit.free( b2 )