Example #1
0
def computeparaboliclines(s):
    retval = irit.sparabolc(s, 1)
    irit.adwidth(retval, 2)
    irit.awidth(retval, 0.01)
    irit.attrib(retval, "gray", irit.GenRealObject(0.5))
    irit.attrib(retval, "rgb", irit.GenStrObject("100,255,255"))
    return retval
Example #2
0
def randomcrvs(numcrvs, crvdeg, crvlen, size, dwidth):
    l = irit.nil()
    i = 1
    while (i <= numcrvs):
        irit.snoc(genrandomcrv(crvdeg, crvlen, size), l)
        irit.attrib(irit.nref(l, i), "gray",
                    irit.GenRealObject(irit.random(0.01, 0.7)))
        i = i + 1
    i = 1
    while (i <= numcrvs):
        irit.attrib(irit.nref(l, i), "rgb", irit.GenStrObject(getrandrgb()))
        i = i + 1
    retval = l
    irit.color(retval, irit.RED)
    irit.awidth(retval, 0.01)
    irit.adwidth(retval, dwidth)
    return retval
Example #3
0
def getbisectlines( crv1, crv2, cntr, n, start, end ):
    if ( start == (-1 ) ):
        start = 0
    if ( end == (-1 ) ):
        end = irit.SizeOf( cntr ) - 1
    retval = irit.nil(  )
    ii = start
    while ( ii <= end ):
        i = irit.floor( ii )
        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.coerce( pt1, irit.E2 ) + irit.coerce( irit.nth( interpts, 1 ), irit.E2 ) + irit.coerce( pt2, irit.E2 ), retval )
        ii = ii + ( end - start - 1 )/n - 1e-005
    irit.color( retval, irit.CYAN )
    irit.awidth( retval, 0.0001 )
    return retval
Example #4
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
Example #5
0
import irit
#

#
#  Examples of ruled ruled surface intersection approximations.
#
#                                        Gershon Elber, February 1998
#

genaxes = irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                     irit.ctlpt( irit.E3, 0, 0, 0.4 ), \
                     irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                     irit.ctlpt( irit.E3, 0, 1.1, 0 ), \
                     irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                     irit.ctlpt( irit.E3, 1.1, 0, 0 ) )
irit.awidth(genaxes, 0.005)
irit.color(genaxes, irit.GREEN)


def evaluvtoe3(srf, uvs, clr):
    retval = irit.nil()
    i = 1
    while (i <= irit.SizeOf(uvs)):
        uv = irit.nth(uvs, i)
        irit.snoc(
            irit.seval(srf, irit.FetchRealObject(irit.coord(uv, 1)),
                       irit.FetchRealObject(irit.coord(uv, 2))), retval)
        i = i + 1
    irit.color(retval, clr)
    return retval
Example #6
0
    irit.pause(  )
echosrc2 = irit.iritstate( "echosource", echosrc2 )
irit.free( echosrc2 )

# 
#  Define the trivarate warping function.
# 

s1 = irit.ruledsrf( irit.ctlpt( irit.E3, 0.5, 0, 0 ) + \
                    irit.ctlpt( irit.E3, 1.5, 0, 0 ), \
                    irit.ctlpt( irit.E3, 0.5, 1.2, 0 ) + \
                    irit.ctlpt( irit.E3, 1.5, 1.2, 0 ) )
tv = irit.tfromsrfs( irit.list( s1, s1 * irit.ry( 30 ), s1 * irit.ry( 60 ), s1 * irit.ry( 90 ), s1 * irit.ry( 120 ), s1 * irit.ry( 150 ), s1 * irit.ry( 180 ) ), 3, irit.KV_OPEN )
tv = irit.treparam( irit.treparam( tv, irit.COL, 0, 0.5 ), irit.ROW, 0.2,\
0.8 )
irit.awidth( tv, 0.001 )
irit.free( s1 )

# 
#  Define our warping function.
# 

def warpsurface( srf, tv ):
    usize = irit.FetchRealObject(irit.nth( irit.ffmsize( srf ), 1 ))
    vsize = irit.FetchRealObject(irit.nth( irit.ffmsize( srf ), 2 ))
    clr = irit.getattr( srf, "color" )
    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 ))
Example #7
0
			   str(irit.random( 80, 255 ) ))

dashlist = irit.list( "[0.001 0.01] 0", "[0.015 0.01 0.001 0.01] 0", "[0.03 0.01] 0", "[0.02 0.01 0.001 0.01 0.001 0.01] 0", "[0.03 0.01 0.001 0.01] 0" )

raypoint = ( irit.ctlpt( irit.E2, (-0.05 ), 0 ) + \
             irit.ctlpt( irit.E2, 0.05, 0 ) )
raypoints = irit.list( raypoint, raypoint * irit.rz( 45 ), raypoint * irit.rz( 90 ), raypoint * irit.rz( 135 ) )

unitsquare = ( irit.ctlpt( irit.E2, 0, 0 ) + \
               irit.ctlpt( irit.E2, 0, 1 ) + \
               irit.ctlpt( irit.E2, 1, 1 ) + \
               irit.ctlpt( irit.E2, 1, 0 ) + \
               irit.ctlpt( irit.E2, 0, 0 ) )
irit.color( unitsquare, irit.MAGENTA )
irit.adwidth( unitsquare, 2 )
irit.awidth( unitsquare, 0.015 )
irit.attrib( unitsquare, "rgb", irit.GenStrObject("255,128,255") )

def apxeq( x, y ):
    retval = abs( irit.FetchRealObject(x - y) ) < 1e-006
    return retval

def mergeverticaltwocrvs( c1, c2 ):
    x = irit.coord( irit.coord( c1, 1 ), 1 )
    if ( apxeq( irit.coord( irit.coord( c1, 1 ), 2 ), 1 ) * \
		 apxeq( irit.coord( irit.coord( c2, 0 ), 2 ), 0 ) ):
        retval = irit.ctlpt( irit.E2, x, irit.coord( irit.coord( c1, 0 ), 2 ) - 1 ) + \
                  irit.ctlpt( irit.E2, x, irit.coord( irit.coord( c2, 1 ), 2 ) )
    else:
        if ( apxeq( irit.coord( irit.coord( c2, 1 ), 2 ), 1 ) * apxeq( irit.coord( irit.coord( c1, 0 ), 2 ), 0 ) ):
            retval = \
Example #8
0
        irit.snoc(irit.coerce(tmp2, irit.E1), net)
        i = i + 1
    retval = irit.ffmerge(net, ptype)
    return retval


# ########################################################################
#
#  Matching a curve along a shared boundary between two surfaces.
#
c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 0, 0 ), \
                              irit.ctlpt( irit.E2, 1, 1 ), \
                              irit.ctlpt( irit.E2, 2, 0 ), \
                              irit.ctlpt( irit.E2, 4, 1 ) ) )

irit.awidth(c1, 0.02)
r1 = irit.coerce( irit.cpower( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                          irit.ctlpt( irit.E1, 0.25 ), \
                                          irit.ctlpt( irit.E1, 0.75 ) ) ), irit.BEZIER_TYPE )
r2 = irit.coerce( irit.cpower( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                          irit.ctlpt( irit.E1, 1.5 ), \
                                          irit.ctlpt( irit.E1, (-0.5 ) ) ) ), irit.BEZIER_TYPE )

c1a = irit.compose(c1, r1)
c2a = irit.compose(c1, r2)

s1 = irit.sfromcrvs(
    irit.list(c1a * irit.ty(1) * irit.tz(3),
              c1a * irit.ty((-1)) * irit.tz(2), c1a * irit.tz(1), c1a), 4,
    irit.KV_OPEN)
irit.attrib(s1, "gray", irit.GenRealObject(0.2))
Example #9
0
c = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0, 0.15 ), \
                                 irit.ctlpt( irit.E2, 0.25, 0.15 ), \
                                 irit.ctlpt( irit.E2, 0.52, 0.4 ), \
                                 irit.ctlpt( irit.E2, 0.85, 0.3 ), \
                                 irit.ctlpt( irit.E2, 0.85, 0 ) ), irit.list( irit.KV_OPEN ) )
c = ((-c) + c * irit.sx((-1)))

srf8a = irit.surfprev(c * irit.ry(90)) * irit.sx(0.9) * irit.homomat(
    irit.list(irit.list(1, 0, 0.2, 0), irit.list(0, 1, 0, 0),
              irit.list(0, 0, 1, 0), irit.list(0, 0, 0, 1))) * irit.homomat(
                  irit.list(irit.list(1, 0, 0, 0), irit.list(0, 1, 0.2, 0),
                            irit.list(0, 0, 1, 0), irit.list(0, 0, 0, 1)))

irit.color(srf8a, irit.YELLOW)
irit.awidth(srf8a, 0.001)

k = irit.srfkernel(srf8a, 5, 3)

irit.interact(irit.list(srf8a, k))
irit.save("srf1krnl", irit.list(k, srf8a))

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

c = irit.pcircle((0, 0, 0), 1)
srf8b = (-irit.sfromcrvs(
    irit.list(c * irit.sc(0.001), c * irit.sc(1),
              c * irit.sc(1) * irit.tz(1),
              c * irit.sc(0.4) * irit.sx(0.6) * irit.tz(1),
              c * irit.sc(0.4) * irit.sx(0.6) * irit.tz(2),
              c * irit.sc(0.001) * irit.tz(2)), 4,
Example #10
0
irit.free(ts1)
irit.free(ts2)
irit.free(ts3)

#
#  Jacobian analysis (zero set).
#

crv1 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E3, 0.5677, (-0.6246 ), 0 ), \
                                    irit.ctlpt( irit.E3, 0.3509, (-0.5846 ), 0 ), \
                                    irit.ctlpt( irit.E3, 0.0416, (-0.5054 ), 0 ), \
                                    irit.ctlpt( irit.E3, (-0.0508 ), 0.0277, 0 ), \
                                    irit.ctlpt( irit.E3, 0.8692, 0.2523, 0 ), \
                                    irit.ctlpt( irit.E3, 0.393, 0.8592, 0 ) ), irit.list( irit.KV_OPEN ) )
srf1 = irit.surfprev(crv1 * irit.rx(90))
irit.awidth(srf1, 0.005)
irit.color(srf1, irit.RED)
irit.free(crv1)

tv1 = irit.tfromsrfs(
    irit.list(srf1,
              srf1 * irit.tx(3) * irit.ty(3), srf1 * irit.tx(6)), 3,
    irit.KV_OPEN)
irit.awidth(tv1, 0.001)
irit.color(tv1, irit.RED)
irit.view(tv1, irit.ON)

tv1zerojacobian = (-irit.tvzrjacob(tv1, 1, 1, irit.GenRealObject(0)))
all = irit.list(tv1zerojacobian, srf1, srf1 * irit.tx(6))
irit.interact(all)
Example #11
0
        irit.list(s1, irit.GetAxes()) * irit.tx((-spc)))
    return retval


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

c = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0, 0.15 ), \
                                 irit.ctlpt( irit.E2, 0.25, 0.15 ), \
                                 irit.ctlpt( irit.E2, 0.52, 0.4 ), \
                                 irit.ctlpt( irit.E2, 0.85, 0.3 ), \
                                 irit.ctlpt( irit.E2, 0.85, 0 ) ), irit.list( irit.KV_OPEN ) )
c = ((-c) + c * irit.sx((-1)))

srfeight = irit.surfprev(c * irit.ry(90))
irit.color(srfeight, irit.YELLOW)
irit.awidth(srfeight, 0.001)

sparabs = computeparaboliclines(srfeight)
irit.interact(irit.list(srfeight, sparabs))

#
#  View the aspect graph with silhouettes...
#
saspect = computetopoaspectgraph(srfeight, 0.9)

irit.viewstate("polyaprx", 1)
irit.viewstate("polyaprx", 1)
irit.viewstate("numisos", 0)
irit.viewstate("numisos", 0)
irit.viewstate("numisos", 0)
irit.viewstate("numisos", 0)