예제 #1
0
def mean2rgb( pl, eps ):
    retval = irit.GetAxes()
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            h = irit.FetchRealObject(irit.pattrib( p, j, "hcurv", irit.nil(  ) ))
            if ( h > 0 ):
                h = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend( h, eps, 64, 255, 64, 255,\
                64, 64 ) ))
            else:
                h = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend( h, eps, 64, 255, 64, 64,\
                64, 255 ) ))
            j = j + 1
        if ( retval == irit.GetAxes() ):
            retval = p
        else:
            irit.insertpoly( p, retval )
        i = i + 1
    return retval
예제 #2
0
def putrgbonvertices(pl, rgb):
    retval = irit.nil()
    i = 0
    while (i <= irit.SizeOf(pl) - 1):
        p = irit.coord(pl, i)
        j = 0
        while (j <= irit.SizeOf(p) - 1):
            a = irit.pattrib(p, j, "rgb", rgb)
            j = j + 1
        irit.snoc(p * irit.tx(0), retval)
        i = i + 1
    retval = irit.mergepoly(retval)
    return retval
예제 #3
0
def gauss2rgb2( pl, eps ):
    retval = irit.GetAxes()
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            k = irit.FetchRealObject(irit.pattrib( p, j, "kcurv", irit.nil(  ) ))
            if ( abs( k ) < eps ):
                k = irit.FetchRealObject(irit.pattrib( p, j, "rgb", "64,255,64" ))
            else:
                if ( k > 0 ):
                    k = irit.FetchRealObject(irit.pattrib( p, j, "rgb", "255,64,64" ))
                else:
                    k = irit.FetchRealObject(irit.pattrib( p, j, "rgb", "64,64,255" ))
            j = j + 1
        if ( retval == irit.GetAxes() ):
            retval = p
        else:
            irit.insertpoly( p, retval )
        i = i + 1
    return retval
예제 #4
0
def meanmeanval( pl ):
    n = 0
    mean = 0
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            h = irit.pattrib( p, j, "hcurv", irit.nil(  ) )
            mean = mean + h
            n = n + 1
            j = j + 1
        i = i + 1
    retval = mean/float(n)
    return retval
예제 #5
0
def gausmean2rgb( pl, keps, heps ):
    retval = irit.GetAxes()
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            h = irit.FetchRealObject(irit.pattrib( p, j, "hcurv", irit.nil(  ) ))
            k = irit.FetchRealObject(irit.pattrib( p, j, "kcurv", irit.nil(  ) ))
            if ( k > 0 ):
                kh = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend2( float(k)/keps, float(h)/heps, 255, 64, 64, 255,\
                64, 255, 64, 255, 255, 64, 64, 255, 255, 128, 128, 255, 255, 255 ) ))
            else:
                kh = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend2( float(-k )/keps, float(h)/heps, 255, 255, 64, 255,\
                64, 64, 64, 255, 64, 64,\
                255, 255, 202, 167, 60, 255,\
                128, 128 ) ))
            j = j + 1
        if ( retval == irit.GetAxes() ):
            retval = p
        else:
            irit.insertpoly( p, retval )
        i = i + 1
    return retval
예제 #6
0
def meancrvrtdomain( pl ):
    hmin = 1e+010
    hmax = (-1e+010 )
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            h = irit.FetchRealObject(irit.pattrib( p, j, "hcurv", irit.nil(  ) ))
            if ( hmin > h ):
                hmin = h
            if ( hmax < h ):
                hmax = h
            j = j + 1
        i = i + 1
    retval = irit.list( hmin, hmax )
    return retval
예제 #7
0
def gausscrvrtdomain( pl ):
    kmin = 1e+010
    kmax = (-1e+010 )
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            k = irit.FetchRealObject(irit.pattrib( p, j, "kcurv", irit.nil(  ) ))
            if ( kmin > k ):
                kmin = k
            if ( kmax < k ):
                kmax = k
            j = j + 1
        i = i + 1
    retval = irit.list( kmin, kmax )
    return retval
예제 #8
0
def gaussmeanval( pl ):
    n = 0
    mean = 0
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            k = irit.FetchRealObject(irit.pattrib( p, j, "kcurv", irit.nil(  ) ))
            print "***********************************************"
            print k

            mean = mean + k
            n = n + 1
            j = j + 1
        i = i + 1
    retval = mean/float(n)
    return retval
예제 #9
0
v1 = irit.vector((-1), (-1), (-1))
v2 = irit.vector((-1), (-1), 1)
v3 = irit.vector((-1), 1, (-1))
v4 = irit.vector((-1), 1, 1)
v5 = irit.vector(1, (-1), (-1))
v6 = irit.vector(1, (-1), 1)
v7 = irit.vector(1, 1, (-1))
v8 = irit.vector(1, 1, 1)

f1 = irit.poly(irit.list(v1, v2, v4, v3), irit.FALSE)
f2 = irit.poly(irit.list(v5, v6, v8, v7), irit.FALSE)
f3 = irit.poly(irit.list(v1, v2, v6, v5), irit.FALSE)
f4 = irit.poly(irit.list(v2, v4, v8, v6), irit.FALSE)
f5 = irit.poly(irit.list(v4, v3, v7, v8), irit.FALSE)
f6 = irit.poly(irit.list(v3, v1, v5, v7), irit.FALSE)
a = irit.pattrib(f6, 0, "authored by", irit.GenStrObject("irit"))

cube1 = irit.mergepoly(irit.list(f1, f2, f3, f4, f5, f6))
irit.save("cube1", cube1)
irit.interact(cube1)

irit.attrib(v1, "normal", makenormal(v1))
irit.attrib(v2, "normal", makenormal(v2))
irit.attrib(v3, "normal", makenormal(v3))
irit.attrib(v4, "normal", makenormal(v4))
irit.attrib(v5, "normal", makenormal(v5))
irit.attrib(v6, "normal", makenormal(v6))
irit.attrib(v7, "normal", makenormal(v7))
irit.attrib(v8, "normal", makenormal(v8))

f1 = irit.poly(irit.list(v1, v2, v4, v3), irit.FALSE)