Beispiel #1
0
def sideunitwalls( w, d, h, legw, legd ):
    backwall = irit.box( ( legd, d - legd - 0.018, 0.2 ), w - 2 * legd, 0.002, h - 0.3 )
    irit.attrib( backwall, "ptexture", woodtext )
    irit.attrib( backwall, "rgb", woodclr )
    leftwall = irit.box( ( legd + 0.001, legd, 0.2 ), 0.002, d - 2 * legd, h - 0.3 )
    rightwall = irit.box( ( w - legd - 0.003, legd, 0.2 ), 0.002, d - 2 * legd, h - 0.3 )
    irit.attrib( leftwall, "transp", irit.GenRealObject(0.3 ))
    irit.attrib( rightwall, "transp", irit.GenRealObject(0.3 ))
    frontdoorframe = ( irit.box( ( legw + 0.001, 0, 0.201 ), w - 2 * legw - 0.002, 0.015, h - 0.302 ) - irit.box( ( legw + 0.03, (-0.1 ), 0.23 ), w - 2 * legw - 0.062, 0.5, h - 0.362 ) - irit.box( ( legw + 0.02, 0.01, 0.22 ), w - 2 * legw - 0.04, 0.1, h - 0.34 ) )
    irit.attrib( frontdoorframe, "ptexture", woodtext )
    irit.attrib( frontdoorframe, "rgb", woodclr )
    frontdoorglass = irit.box( ( legw + 0.021, 0.011, 0.221 ), w - 2 * legw - 0.042, 0.003, h - 0.342 )
    irit.attrib( frontdoorglass, "transp", irit.GenRealObject(0.3) )
    frontdoor = irit.list( frontdoorframe, frontdoorglass )
    rot_z = ( irit.ctlpt( irit.E1, 0 ) + \
               irit.ctlpt( irit.E1, 100 ) )
    irit.attrib( frontdoor, "animation", irit.list( irit.tx( (-legw ) ), rot_z, irit.tx( legw ) ) )
    retval = irit.list( backwall, leftwall, rightwall, frontdoor )
    return retval
Beispiel #2
0
def cornerunitlegs( w, h, legw, legd ):
    grooved = ( legw - legd )
    lleg = ( irit.box( ( 0, 0, 0 ), legw, legd, h ) - irit.box( ( legw/3, (-0.01 ), 0.1 ), legw/3, 0.02, h - 0.3 ) - irit.box( ( (-0.01 ), legd/3, 0.1 ), 0.02, legd/3, h - 0.3 ) - irit.box( ( legd, legd - 0.02, 0.2 ), 0.1, 0.1, h - 0.3 ) )
    sleg = ( irit.box( ( 0, 0, 0 ), legw, legd, h ) - irit.box( ( legw/3, (-0.01 ), 0.1 ), legw/3, 0.02, h - 0.3 ) - irit.box( ( (-0.1 ), legd - 0.02, 0.2 ), 0.2, 0.1, h - 0.3 ) )
    rleg = ( irit.box( ( 0, 0, 0 ), legw, legd, h ) - irit.box( ( legw/3, (-0.01 ), 0.1 ), legw/3, 0.02, h - 0.3 ) - irit.box( ( legw - 0.01, legd/3, 0.1 ), 0.02, legd/3, h - 0.3 ) - irit.box( ( grooved, legd - 0.02, 0.2 ), (-0.1 ), 0.1, h - 0.3 ) )
    cleg = ( irit.box( ( 0, 0, 0 ), legw, legw, h ) - irit.box( ( legd, legd, 0.2 ), 0.1, 0.1, h - 0.3 ) )
    retval = irit.list( lleg, sleg * irit.tx( w - legw ), sleg * irit.tx( w ) * irit.rz( 90 ) * irit.tx( 2 * w ), rleg * irit.rz( 90 ) * irit.tx( 2 * w ) * irit.ty( 2 * w - legw ), cleg * irit.rz( (-90 ) ) * irit.ty( w * 2 ) )
    irit.attrprop( retval, "ptexture", woodtext )
    irit.attrprop( retval, "rgb", woodclr )
    return retval
Beispiel #3
0
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
Beispiel #4
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
Beispiel #5
0
def extracte3pts(uvxyzpts):
    retval = irit.nil()
    irit.printf("found %d points\n", irit.list(irit.SizeOf(uvxyzpts)))
    i = 1
    while (i <= irit.SizeOf(uvxyzpts)):
        uvxyzpt = irit.nth(uvxyzpts, i)
        irit.snoc(
            irit.ctlpt(irit.E3, irit.coord(uvxyzpt, 3), irit.coord(uvxyzpt, 4),
                       irit.coord(uvxyzpt, 5)), retval)
        i = i + 1
    return retval
def printobjecthierarchyaux( obj, indent ):
    if ( irit.ThisObject( obj ) == irit.LIST_TYPE ):
        i = 1
        while ( i <= irit.SizeOf( obj ) ):
            j = 1
            while ( j <= indent ):
                irit.printf( "    ", irit.nil(  ) )
                j = j + 1
            irit.printf( "%s\n", irit.list( irit.getname( obj, i ) ) )
            irit.printobjecthierarchyaux( irit.nref( obj, i ), indent + 1 )
            i = i + 1
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)
Beispiel #8
0
def computeerror(crv, dist, ocrv):
    dst = irit.symbdiff(crv, ocrv)
    dstsqr = irit.symbdprod(dst, dst)
    ffmin = irit.max(irit.coord(irit.ffextreme(dstsqr, 1), 1), 0)
    ffmax = irit.max(irit.coord(irit.ffextreme(dstsqr, 0), 1), 0)
    irit.printf(
        "%1.0lf %lf",
        irit.list(
            irit.SizeOf(ocrv),
            irit.max(irit.abs(math.sqrt(ffmin) - dist),
                     irit.abs(math.sqrt(ffmax) - dist))))
Beispiel #9
0
def genanimationorthomatchcrvpts(ppl, crv, scl):
    pt1 = irit.point(0, 0, 0)
    pt2 = irit.point(0, 0, 0)
    vec1 = ( irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 0, scl ) )
    irit.color(vec1, irit.YELLOW)
    vec2 = ( \
              irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 0, scl ) )
    irit.color(vec2, irit.CYAN)
    pos1 = irit.nil()
    pos2 = irit.nil()
    rot1 = irit.nil()
    rot2 = irit.nil()
    i = 0
    while (i <= irit.SizeOf(ppl) - 1):
        pl = irit.coord(ppl, i)
        j = 0
        while (j <= irit.SizeOf(pl) - 1):
            pt = irit.coord(pl, j)
            t1 = irit.coord(pt, 0)
            t2 = irit.coord(pt, 1)
            if (t1 > t2):
                irit.snoc(
                    irit.coerce(irit.ceval(crv, irit.FetchRealObject(t1)),
                                irit.POINT_TYPE), pos1)
                irit.snoc(
                    irit.coerce(irit.ceval(crv, irit.FetchRealObject(t2)),
                                irit.POINT_TYPE), pos2)
                n1 = irit.cnormal(crv, irit.FetchRealObject(t1))
                n2 = irit.cnormal(crv, irit.FetchRealObject(t2))
                irit.snoc(
                    irit.vector(
                        math.atan2(irit.FetchRealObject(irit.coord(n1, 0)),
                                   irit.FetchRealObject(irit.coord(n1, 1))) *
                        180 / math.pi, 0, 0), rot1)
                irit.snoc(
                    irit.vector(
                        math.atan2(irit.FetchRealObject(irit.coord(n2, 0)),
                                   irit.FetchRealObject(irit.coord(n2, 1))) *
                        180 / math.pi, 0, 0), rot2)
            j = j + 1
        if (t1 > t2):
            irit.snoc(irit.vector(10000, 0, 0), pos1)
            irit.snoc(irit.vector(10000, 0, 0), pos2)
            irit.snoc(irit.vector(0, 0, 0), rot1)
            irit.snoc(irit.vector(0, 0, 0), rot2)
        i = i + 1
    irit.attrib(pt1, "animation", makerottransanimobj(irit.nil(), pos1))
    irit.attrib(pt2, "animation", makerottransanimobj(irit.nil(), pos2))
    irit.attrib(vec1, "animation", makerottransanimobj(rot1, pos1))
    irit.attrib(vec2, "animation", makerottransanimobj(rot2, pos2))
    retval = irit.list(pt1, pt2, vec1, vec2)
    return retval
Beispiel #10
0
def silandsilinfl(s, v):
    sil = irit.silhouette(s, v, 1)
    irit.color(sil, irit.YELLOW)
    pts = irit.ssilinfl(s, v, 0.01, (-1e-010))
    e3pts = irit.nil()
    i = 1
    while (i <= irit.SizeOf(pts)):
        p = irit.nth(pts, i)
        irit.snoc(
            irit.coerce(
                irit.seval(s, irit.FetchRealObject(irit.coord(p, 0)),
                           irit.FetchRealObject(irit.coord(p, 1))), irit.E3),
            e3pts)
        i = i + 1
    irit.color(e3pts, irit.CYAN)
    irit.printf("detected %d silhouette high order contact points.\n",
                irit.list(irit.SizeOf(e3pts)))
    view_mat_sil = viewmatfromviewdir(v)
    retval = irit.list(e3pts, sil, view_mat_sil)
    return retval
Beispiel #11
0
def testinter(s1, s2):
    retval = irit.ssintr2(s1, s2, step, subdivtol, numerictol, euclidean)
    if (irit.SizeOf(retval) == 2):
        n = (irit.SizeOf(irit.nth(retval, 1)) +
             irit.SizeOf(irit.nth(retval, 2))) / 2.0
    else:
        if (irit.SizeOf(retval) == 1):
            n = irit.SizeOf(irit.nth(retval, 1)) / 2.0
        else:
            n = 0
    irit.printf("found %d intersection connected components.\n", irit.list(n))
    return retval
Beispiel #12
0
def printmultivar( mv ):
    orders = irit.fforder( mv )
    msize = irit.ffmsize( mv )
    irit.printf( "multivariate of orders", irit.nil(  ) )
    i = 1
    while ( i <= irit.SizeOf( orders ) ):
        irit.printf( " %d", irit.list( irit.nth( orders, i ) ) )
        i = i + 1
    irit.printf( ", mesh size", irit.nil(  ) )
    i = 1
    while ( i <= irit.SizeOf( msize ) ):
        irit.printf( " %d", irit.list( irit.nth( msize, i ) ) )
        i = i + 1
    irit.printf( " and point type %s\n", irit.list( getpointtype( irit.coord( mv, 0 ) ) ) )
    irit.printf( "control mesh:\n", irit.nil(  ) )
    printctlmesh( mv )
    kvs = irit.ffkntvec( mv )
    i = 1
    while ( i <= irit.SizeOf( kvs ) ):
        printknotvector( "", irit.nth( kvs, i ) )
        i = i + 1
Beispiel #13
0
def cmpoffalltols(crv, header, fname, dist, tol, steps):
    i = 0
    while (i <= steps):
        irit.printf("\n\n%s: tolerance = %lf, dist = %lf",
                    irit.list(header, tol, dist))
        c1 = irit.offset(crv, irit.GenRealObject(dist), tol, 0)
        c2 = irit.offset(crv, irit.GenRealObject(dist), tol, 1)
        c3 = irit.aoffset(crv, irit.GenRealObject(dist), tol, 0, 0)
        c4 = irit.loffset(crv, dist, 300, irit.SizeOf(c2), 4)
        irit.attrib(c1, "dash", irit.GenStrObject("[0.1 0.01] 0"))
        irit.color(c1, irit.RED)
        irit.attrib(c2, "dash", irit.GenStrObject("[0.01 0.01] 0"))
        irit.color(c2, irit.GREEN)
        irit.attrib(c3, "dash", irit.GenStrObject("[0.2 0.01 0.05 0.01] 0"))
        irit.color(c3, irit.YELLOW)
        irit.attrib(c4, "dash", irit.GenStrObject("[0.1 0.1 0.01 0.01] 0"))
        irit.color(c4, irit.CYAN)
        irit.save(fname + "_" + str(i + 1), irit.list(crv, c1, c2, c3, c4))
        compareoffset(crv, abs(dist), c1, c2, c3, c4)
        tol = tol * math.sqrt(0.1)
        i = i + 1
Beispiel #14
0
def rightunit( w, d, h, legw, legd ):
    retval = irit.list( sideunitshelf( w, d, 0.2, legw, legd ), 
						sideunitshelf( w, d, 0.45, legw, legd ), 
						sideunitshelf( w, d, 0.7, legw, legd ), 
						sideunitshelf( w, d, 0.95, legw, legd ), 
						sideunitshelf( w, d, 1.2, legw, legd ), 
						sideunitshelf( w, d, 1.45, legw, legd ), 
						sideunitwalls( w, d, h, legw, legd ), 
						squareunitlegs( w, d, h, legw, legd ), 
						squareunitbars( w, d, h, legw, legd ), 
						squareunittop( w, d, h, 0.03, woodtext, woodclr ) )
    return retval
Beispiel #15
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
Beispiel #16
0
def createcubicbezier(x1, y1, x2, y2, x3, y3):
    x1 = x1 / 1000.0
    y1 = y1 / 1000.0
    x2 = x2 / 1000.0
    y2 = y2 / 1000.0
    x3 = x3 / 1000.0
    y3 = y3 / 1000.0
    retval = irit.cbezier( irit.list( irit.ctlpt( irit.E2, x1, y1 ), \
                                       irit.ctlpt( irit.E2, x1 + ( x2 - x1 ) * 2/3.0, y1 + ( y2 - y1 ) * 2/3.0 ), \
                                       irit.ctlpt( irit.E2, x3 + ( x2 - x3 ) * 2/3.0, y3 + ( y2 - y3 ) * 2/3.0 ), \
                                       irit.ctlpt( irit.E2, x3, y3 ) ) )
    return retval
Beispiel #17
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))
Beispiel #18
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 )
Beispiel #19
0
def polesfree(srf, dpth, tmin, tmax):
    if (irit.ffpoles(srf) == 0):
        retval = irit.list(srf)
    else:
        if (dpth <= 0):
            retval = irit.nil()
        else:
            t = (tmin + tmax) / 2
            srfs = irit.sdivide(srf, irit.ROW, t)
            retval = irit.polesfree(irit.nth(srfs, 1), dpth - 1, tmin,
                                    t) + irit.polesfree(
                                        irit.nth(srfs, 2), dpth - 1, t, tmax)
    return retval
Beispiel #20
0
def computeviews( c, step, fname ):
    dms = buildvisibilitymap( c, step )
    ranges = irit.nil(  )
    i = 1
    while ( i <= irit.SizeOf( dms ) ):
        ranges = cnvrtcrvs2ranges( irit.nth( dms, i ), i, 1 ) + ranges
        i = i + 1
    irit.printf( "%d views are considered\n", irit.list( irit.SizeOf( dms ) ) )
    cvrs = irit.setcover( ranges, 0.001 )
    cvrcrvs = irit.nil(  )
    i = 1
    while ( i <= irit.SizeOf( cvrs ) ):
        cvr = irit.nth( ranges, irit.FetchRealObject(irit.nth( cvrs, i )) + 1 )
        irit.printf( "curve %d [idx = %d] covers from t = %f to t = %f\n", irit.list( i, irit.getattr( cvr, "index" ), irit.nth( cvr, 1 ), irit.nth( cvr, 2 ) ) )
        irit.snoc( extractcrvregion( c, irit.nth( cvr, 1 ), irit.nth( cvr, 2 ), (irit.getattr( cvr, "index" )/irit.SizeOf( dms ) ) * 360 ), cvrcrvs )
        i = i + 1
    irit.attrib( c, "width", irit.GenRealObject(0.005 ))
    irit.attrib( c, "rgb", irit.GenStrObject("255, 255, 255" ))
    retval = irit.list( c, cvrcrvs )
    if ( irit.SizeOf( irit.GenStrObject( fname ) ) > 0 ):
        irit.save( fname, retval )
    return retval
Beispiel #21
0
def warpsrf(origsrf, tv):
    srf = (-irit.sreparam( irit.sreparam( origsrf, irit.ROW, 0, 1 ), irit.COL, 0,\
    1 ) )
    srf = irit.srefine( irit.srefine( srf, irit.COL, 0, irit.list( 0.111, 0.222, 0.333, 0.444, 0.555, 0.666,\
    0.777, 0.888 ) ), irit.ROW, 0, irit.list( 0.111, 0.222, 0.333, 0.444, 0.555, 0.666,\
    0.777, 0.888 ) )
    usize = irit.FetchRealObject(irit.nth(irit.ffmsize(srf), 1))
    vsize = irit.FetchRealObject(irit.nth(irit.ffmsize(srf), 2))
    i = 0
    while (i <= usize * vsize - 1):
        pt = irit.coord(srf, i)
        x = irit.FetchRealObject(irit.coord(pt, 1))
        y = irit.FetchRealObject(irit.coord(pt, 2))
        z = irit.FetchRealObject(irit.coord(pt, 3))
        pt = irit.teval(tv, x, y, z)
        v = math.floor(i / usize)
        u = i - v * usize
        srf = irit.seditpt(srf, pt, u, v)
        i = i + 1
    retval = srf
    irit.cpattr(retval, origsrf)
    return retval
Beispiel #22
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
Beispiel #23
0
def displayobjobjhdres( o1, o2, eps, onesided ):
    global glbltransx
    hdres = irit.hausdorff( o1, o2, eps, onesided )
    dist = irit.nth( hdres, 1 )
    param1 = irit.nth( hdres, 2 )
    if ( onesided ):
        dtype = "one sided "
    else:
        dtype = "two sided "
    if ( irit.SizeOf( param1 ) == 0 ):
        pt1 = irit.coerce( o1, irit.E3 )
    else:
        i = 1
        while ( i <= irit.SizeOf( param1 ) ):
            t = irit.nth( param1, i )
            irit.printf( "%shausdorff distance %f detected at t1 = %f\n", irit.list( dtype, dist, t ) )
            i = i + 1
        pt1 = irit.ceval( o1, irit.FetchRealObject(t) )
    param2 = irit.nth( hdres, 3 )
    if ( irit.SizeOf( param2 ) == 0 ):
        pt2 = irit.coerce( o2, irit.E3 )
    else:
        i = 1
        while ( i <= irit.SizeOf( param2 ) ):
            t = irit.FetchRealObject(irit.nth( param2, i ))
            irit.printf( "%shausdorff distance %f detected at t2 = %f\n", irit.list( dtype, dist, t ) )
            i = i + 1
        pt2 = irit.ceval( o2, t )
    irit.color( pt1, irit.MAGENTA )
    irit.color( o1, irit.MAGENTA )
    irit.color( pt2, irit.YELLOW )
    irit.color( o2, irit.YELLOW )
    l = ( pt1 + pt2 )
    if ( onesided == 0 ):
        irit.attrib( l, "dwidth", irit.GenIntObject(3 ))
    all = irit.list( o1, o2, pt1, pt2, l )
    irit.snoc( all * irit.tx( glbltransx ), glblres )
    glbltransx = ( glbltransx + 0.5 )
    irit.interact( all )
Beispiel #24
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
Beispiel #25
0
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
Beispiel #26
0
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
Beispiel #27
0
def layouthandleonetrimmed(trmsrf, highlighttrim):
    srf = irit.strimsrf(trmsrf)
    if (highlighttrim):
        irit.color(srf, irit.BLUE)
        irit.color(trmsrf, irit.YELLOW)
        irit.awidth(srf, 0.0001)
        irit.awidth(trmsrf, 0.01)
    else:
        irit.color(srf, irit.YELLOW)
        irit.color(trmsrf, irit.BLUE)
        irit.awidth(srf, 0.01)
        irit.awidth(trmsrf, 0.0001)
    retval = irit.list(trmsrf, srf)
    return retval
Beispiel #28
0
def animateorthomatchpts(ppl, crv, scl):
    bg_obj = irit.list(unitsquare, crv, ppl)
    i = 0
    while (i <= irit.SizeOf(ppl) - 1):
        pl = irit.coord(ppl, i)
        j = 0
        while (j <= irit.SizeOf(pl) - 1):
            pt = irit.coord(pl, j)
            t1 = irit.coord(pt, 0)
            t2 = irit.coord(pt, 1)
            if (t1 > t2):
                displayposnormal(crv, t1, t2, scl, bg_obj)
            j = j + 1
        i = i + 1
Beispiel #29
0
def midgreatcircpt(theta1, theta2, phi1, phi2):
    theta1d = theta1 * math.pi / 180
    theta2d = theta2 * math.pi / 180
    phi1d = phi1 * math.pi / 180
    phi2d = phi2 * math.pi / 180
    x = (math.cos(theta1d) * math.cos(phi1d) +
         math.cos(theta2d) * math.cos(phi2d)) / 2.0
    y = (math.cos(theta1d) * math.sin(phi1d) +
         math.cos(theta2d) * math.sin(phi2d)) / 2.0
    z = (math.sin(theta1d) + math.sin(theta2d)) / 2.0
    theta = math.atan2(z, math.sqrt(x * x + y * y)) * 180 / math.pi
    phi = math.atan2(y, x) * 180 / math.pi
    retval = irit.list(theta, phi)
    return retval
Beispiel #30
0
def antantenna():
    c = irit.pcircle((0, 0, 0), 0.03) * irit.ry(90)
    retval = (-irit.sfromcrvs(
        irit.list(
            c * irit.sy(1.4) * irit.rz(45) * irit.tx(0.1) * irit.ty((-0.15)),
            c * irit.rz(45) * irit.tx(0.2) * irit.ty(0.2),
            c * irit.sy(1.4) * irit.tx(0.3) * irit.ty(0.4),
            c * irit.rz((-55)) * irit.tx(0.4) * irit.ty(0.15),
            c * irit.sc(0.8) * irit.rz((-45)) * irit.tx(0.5) * irit.ty((-0.1)),
            c * irit.sc(0.65) * irit.rz((-45)) * irit.tx(0.58) * irit.ty(
                (-0.22)),
            c * irit.sc(0.001) * irit.rz((-45)) * irit.tx(0.58) * irit.ty(
                (-0.22))), 3, irit.KV_OPEN))
    irit.attrib(retval, "rgb", irit.GenStrObject("255,50,50"))
    return retval