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)
Beispiel #2
0
def positioncurvature(srf, u, v):
    eps = 1e-012
    c = irit.circle((0, 0, 0), 1)
    k = irit.scrvtreval(srf, u, v, 1)
    r1 = irit.max(
        irit.min(1.0 / (irit.FetchRealObject(irit.nth(k, 1)) + eps), 1000),
        (-1000))
    r2 = irit.max(
        irit.min(1.0 / (irit.FetchRealObject(irit.nth(k, 3)) + eps), 1000),
        (-1000))
    v1 = irit.nth(k, 2)
    v2 = irit.nth(k, 4)
    p = irit.seval(srf, u, v)
    n = irit.snormal(srf, u, v)
    d1 = v1 ^ n
    d2 = v2 ^ n
    c1 = c * \
   irit.sc( r1 ) * \
   irit.rotz2v( irit.Fetch3TupleObject(d1) ) * \
   irit.trans( irit.Fetch3TupleObject(irit.coerce( p, irit.VECTOR_TYPE ) + n * r1 ))
    c2 = c * \
   irit.sc( r2 ) * \
   irit.rotz2v( irit.Fetch3TupleObject(d2) ) * \
   irit.trans( irit.Fetch3TupleObject(irit.coerce( p, irit.VECTOR_TYPE ) + n * r2) )
    retval = irit.list(
        p, c1, c2,
        p + irit.coerce(irit.coerce(p, irit.POINT_TYPE) + v1, irit.E3),
        p + irit.coerce(irit.coerce(p, irit.POINT_TYPE) + v2, irit.E3),
        positionasymptotes(srf, u, v))
    irit.adwidth(retval, 2)
    irit.color(retval, irit.YELLOW)
    return retval
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
def evalantipodalptsonsrf( srf ):
    aps = irit.antipodal( srf, 0.001, (-1e-012 ) )
    irit.printf( "%d antipodal points detected\n", irit.list( irit.SizeOf( aps ) ) )
    retval = irit.nil(  )
    diam = 0
    i = 1
    while ( i <= irit.SizeOf( aps ) ):
        ap = irit.nth( aps, i )
        u1 = irit.coord( ap, 1 )
        v1 = irit.coord( ap, 2 )
        u2 = irit.coord( ap, 3 )
        v2 = irit.coord( ap, 4 )
        pt1 = irit.seval( srf, irit.FetchRealObject(u1), irit.FetchRealObject(v1) )
        pt2 = irit.seval( srf, irit.FetchRealObject(u2), irit.FetchRealObject(v2) )
        if ( irit.dstptpt( irit.coerce( pt1, irit.POINT_TYPE ), 
						   irit.coerce( pt2, irit.POINT_TYPE ) ) > diam ):
            diam = irit.dstptpt( irit.coerce( pt1, irit.POINT_TYPE ), 
								 irit.coerce( pt2, irit.POINT_TYPE ) )
            diamline = pt1 + pt2
        irit.snoc( irit.list( pt1 + pt2, pt1 * irit.tx( 0 ), pt2 * irit.tx( 0 ) ), retval )
        i = i + 1
    irit.color( retval, irit.YELLOW )
    irit.color( diamline, irit.CYAN )
    irit.adwidth( diamline, 3 )
    irit.snoc( irit.list( diamline ), retval )
    return retval
Beispiel #5
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
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)
def buildvisibilitymap( c, step, highlightangle ):
    retval = irit.nil(  )
    i = 0
    while ( i <= 360 ):
        dir =  irit.point( math.cos( i * math.pi/180 ), math.sin( i * 3.14159/180 ), 0 )
        crvs = irit.cvisible( c, irit.Fetch3TupleObject(dir), 1e-005 )
        crvdmn = cnvrtcrvs2domains( crvs, i )
        if ( highlightangle == i ):
            irit.attrib( crvdmn, "width", irit.GenRealObject(0.01 ))
            irit.attrib( crvdmn, "gray", irit.GenRealObject(0 ))
            irit.attrib( crvdmn, "rgb", irit.GenStrObject("255, 255, 128" ))
            irit.adwidth( crvdmn, 3 )
            highcrvdmn = crvdmn * irit.sx( 1/360.0 )
            irit.attrib( crvs, "width", irit.GenRealObject(0.03 ))
            irit.adwidth( crvs, 3 )
            irit.attrib( crvs, "rgb", irit.GenStrObject("255, 255, 128" ))
            irit.snoc( crvs, retval )
        else:
            irit.attrib( crvdmn, "width", 0.01 )
            irit.attrib( crvdmn, "gray", 0.5 )
            irit.attrib( crvdmn, "rgb", "128, 128, 255" )
            irit.snoc( crvdmn * irit.sx( 1/360 ), retval )
        i = i + step
    retval = ( retval + irit.list( highcrvdmn ) )
    return retval
Beispiel #8
0
def randomcrvs(numcrvs, crvdeg, crvlen, size):
    l = irit.nil()
    i = 1
    while (i <= numcrvs):
        irit.snoc(genrandomcrv(crvdeg, crvlen, size), l)
        i = i + 1
    retval = l
    irit.color(retval, irit.RED)
    irit.adwidth(retval, 3)
    return retval
Beispiel #9
0
def randompts2(n):
    retval = irit.nil()
    i = 1
    while (i <= n):
        r = irit.random((-1), 1)
        t = irit.random(0, 2 * math.pi)
        irit.snoc((math.cos(t) * r, math.sin(t) * r, 0), retval)
        i = i + 1
    irit.color(retval, irit.RED)
    irit.adwidth(retval, 5)
    return retval
Beispiel #10
0
def randomvecs(n):
    l = irit.nil()
    i = 1
    while (i <= n):
        r = irit.random((-1), 1)
        t = irit.random(0, 2 * math.pi)
        irit.snoc(irit.vector(math.cos(t) * r, 2, math.sin(t) * r), l)
        i = i + 1
    retval = l
    irit.color(retval, irit.RED)
    irit.adwidth(retval, 3)
    return retval
Beispiel #11
0
def randompts3d(n):
    l = irit.nil()
    i = 1
    while (i <= n):
        irit.snoc(
            irit.point(irit.random((-1), 1), irit.random((-1), 1),
                       irit.random((-1), 1)), l)
        i = i + 1
    retval = l
    irit.color(retval, irit.GREEN)
    irit.adwidth(retval, 5)
    return retval
Beispiel #12
0
def randompts(n):
    l = irit.nil()
    i = 1
    while (i <= n):
        r = irit.random((-1), 1)
        t = irit.random(0, 2 * math.pi)
        irit.snoc(irit.vector(math.cos(t) * r, math.sin(t) * r, 0), l)
        i = i + 1
    retval = irit.poly(l, irit.FALSE)
    irit.color(retval, irit.RED)
    irit.adwidth(retval, 5)
    return retval
Beispiel #13
0
def computetopoaspectgraph(s, spc):
    ag = irit.saspctgrph(s)
    irit.color(ag, irit.YELLOW)
    irit.adwidth(ag, 3)
    sp = irit.spheresrf(1)
    irit.color(sp, irit.RED)
    s1 = s * irit.tx(0)
    irit.color(s1, irit.GREEN)
    irit.adwidth(s1, 2)
    retval = irit.list(
        irit.list(ag, sp, irit.GetAxes()) * irit.sc(0.6) * irit.tx(spc),
        irit.list(s1, irit.GetAxes()) * irit.tx((-spc)))
    return retval
Beispiel #14
0
def positionasymptotes(srf, u, v):
    retval = irit.nil()
    p = irit.seval(srf, u, v)
    k = irit.sasympeval(srf, u, v, 1)
    i = 1
    while (i <= irit.SizeOf(k)):
        irit.snoc(
            p + irit.coerce(
                irit.coerce(p, irit.POINT_TYPE) + irit.nth(k, i), irit.E3),
            retval)
        i = i + 1
    irit.adwidth(retval, 2)
    irit.color(retval, irit.GREEN)
    return retval
Beispiel #15
0
def makealpha( a, clr ):
    aa = ( 2 * a - 1 )/float(a * a)
    alp = irit.quadric( irit.list( aa, 1, 1, 0, 0, 0,\
    (-2 ), 0, 0, 1 ) )
    if ( a < 0.5 ):
        alp1 = irit.sregion( irit.sregion( alp, irit.ROW, 0, 1 ), irit.COL, 0,\
        0.7 )
        alp1 = irit.smoebius( irit.smoebius( alp1, 0, irit.COL ), 0, irit.ROW )
    else:
        alp1 = alp * irit.tx( 0 )
    retval = irit.list( alp1, alp1 * irit.rx( 90 ), alp1 * irit.rx( 180 ), alp1 * irit.rx( 270 ) )
    irit.color( retval, clr )
    irit.adwidth( retval, 3 )
    return retval
Beispiel #16
0
def randomctlpt3(n):
    l = irit.nil()
    i = 1
    while (i <= n):
        r = irit.random((-0.5), 0.5)
        t = irit.random(0, 2 * math.pi)
        irit.snoc(
            irit.ctlpt(irit.E3,
                       math.cos(t) * r, irit.random(0.5, 1.5),
                       math.sin(t) * r), l)
        i = i + 1
    retval = l
    irit.color(retval, irit.GREEN)
    irit.adwidth(retval, 3)
    return retval
Beispiel #17
0
def makealpha( a, clr ):
    aa = ( 2 * a - 1 )/float(a * a)
    bb = (-irit.sqr( ( 1 - a )/float(a) ) )
    alp = irit.quadric( irit.list( aa, bb, 1, 0, 0, 0,\
    (-2 ), 0, 0, 1 ) )
    alp1 = irit.sregion( irit.sregion( alp, irit.ROW, (-5 ), 0.45 ), irit.COL, 0,\
    200 )
    alp1 = irit.smoebius( irit.smoebius( alp1, 0, irit.COL ), 0, irit.ROW )
    alp2 = irit.sregion( irit.sregion( alp, irit.ROW, (-5 ), 0.45 ), irit.COL, (-200 ),\
    0 )
    alp2 = irit.smoebius( irit.smoebius( alp2, 0, irit.COL ), 0, irit.ROW )
    retval = irit.list( alp1, alp2 )
    irit.color( retval, clr )
    irit.adwidth( retval, 3 )
    return retval
Beispiel #18
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
Beispiel #19
0
def uvpos2pt(srf, pt, mindist):
    pt = irit.coerce(pt, irit.POINT_TYPE)
    uvpt = irit.srfptdst(srf, irit.Fetch3TupleObject(pt), mindist, 0.001,
                         1e-010)
    e3pt = irit.seval(srf, irit.FetchRealObject(irit.coord(uvpt, 0)),
                      irit.FetchRealObject(irit.coord(uvpt, 1)))
    e3nrml = irit.snormal(srf, irit.FetchRealObject(irit.coord(uvpt, 0)),
                          irit.FetchRealObject(irit.coord(uvpt, 1)))
    edge = (irit.coerce(pt, irit.E3) + e3pt)
    nedge = (e3pt +
             irit.coerce(irit.coerce(e3pt, irit.POINT_TYPE) - e3nrml, irit.E3))
    irit.color(e3pt, irit.MAGENTA)
    irit.adwidth(e3pt, 3)
    irit.color(pt, irit.YELLOW)
    irit.color(edge, irit.CYAN)
    irit.color(nedge, irit.GREEN)
    retval = irit.list(e3pt, pt, edge, nedge)
    return retval
Beispiel #20
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)
Beispiel #21
0
def evalgaussiancrvs(srf, numeronly, kmin, kmax, kstep):
    k = irit.sgauss(srf, numeronly)
    irit.printf("k spans from %f to %f\n", irit.bbox(k))
    gausscntrs = irit.nil()
    x = kmin
    while (x >= kmax):
        aaa = irit.plane(1, 0, 0, (-x))
        bbb = irit.contour(k, aaa, srf)
        irit.snoc(bbb, gausscntrs)
        x = x + kstep
    irit.color(gausscntrs, irit.MAGENTA)
    parabolic = irit.sparabolc(srf, 1)
    if (irit.ThisObject(parabolic) == irit.POLY_TYPE):
        irit.color(parabolic, irit.RED)
        irit.adwidth(parabolic, 2)
        retval = irit.list(parabolic, gausscntrs)
    else:
        retval = gausscntrs
    return retval
Beispiel #22
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
Beispiel #23
0
def evalmeancrvs(srf, numeronly, hmin, hmax, hstep):
    h = irit.smean(srf, numeronly)
    irit.printf("h spans from %f to %f\n", irit.bbox(h))
    meancntrs = irit.nil()
    x = hmin
    while (x <= hmax):
        aaa = irit.contour(h, irit.plane(1, 0, 0, (-x)), srf)
        if (irit.IsNullObject(aaa)):
            aaa = 0
        else:
            irit.snoc(aaa, meancntrs)
        x = x + hstep
    irit.color(meancntrs, irit.YELLOW)
    minimal = irit.contour(h, irit.plane(1, 0, 0, 0.0001), srf)
    if (irit.ThisObject(minimal) == irit.POLY_TYPE):
        irit.color(minimal, irit.GREEN)
        irit.adwidth(minimal, 2)
        retval = irit.list(meancntrs, minimal)
    else:
        retval = meancntrs
    return retval
Beispiel #24
0
def uvpos2ln(srf, lnpt, lndir, mindist):
    uvpt = irit.srflndst(srf, irit.Fetch3TupleObject(lnpt), lndir, mindist,
                         0.001, 1e-010)
    e3pt = irit.seval(srf, irit.FetchRealObject(irit.coord(uvpt, 0)),
                      irit.FetchRealObject(irit.coord(uvpt, 1)))
    e3nrml = irit.snormal(srf, irit.FetchRealObject(irit.coord(uvpt, 0)),
                          irit.FetchRealObject(irit.coord(uvpt, 1)))
    edge =   irit.coerce( irit.ptptln( irit.Fetch3TupleObject(irit.coerce( e3pt, irit.POINT_TYPE )),
            irit.Fetch3TupleObject(lnpt),
            lndir ),
        irit.E3 ) + \
     e3pt
    nedge = (e3pt +
             irit.coerce(irit.coerce(e3pt, irit.POINT_TYPE) - e3nrml, irit.E3))
    irit.color(e3pt, irit.MAGENTA)
    irit.adwidth(e3pt, 3)
    irit.color(edge, irit.CYAN)
    irit.color(nedge, irit.GREEN)
    line = irit.coerce( lnpt + irit.vector(lndir[0], lndir[1], lndir[2]) * irit.sc( 2 ), irit.E3 ) + \
           irit.coerce( lnpt - irit.vector(lndir[0], lndir[1], lndir[2]) * irit.sc( 2 ), irit.E3 )
    irit.color(line, irit.YELLOW)
    retval = irit.list(line, e3pt, edge, nedge)
    return retval
Beispiel #25
0
def genanimationorthomatchprmpts(ppl):
    prm1 = ( irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 0, 1 ) )
    irit.color(prm1, irit.YELLOW)
    prm2 = ( \
              irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 1, 0 ) )
    irit.color(prm2, irit.CYAN)
    pos1 = irit.nil()
    pos2 = irit.nil()
    pos12 = 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.vector(irit.FetchRealObject(t1), 0, 0), pos1)
                irit.snoc(irit.vector(0, irit.FetchRealObject(t2), 0), pos2)
                irit.snoc(pt, pos12)
            j = j + 1
        if (t1 > t2):
            irit.snoc(irit.vector(10000, 0, 0), pos1)
            irit.snoc(irit.vector(10000, 0, 0), pos2)
        i = i + 1
    pt = irit.point(0, 0, 0)
    irit.color(pt, irit.RED)
    irit.adwidth(pt, 3)
    irit.attrib(pt, "animation", makerottransanimobj(irit.nil(), pos12))
    irit.attrib(prm1, "animation", makerottransanimobj(irit.nil(), pos1))
    irit.attrib(prm2, "animation", makerottransanimobj(irit.nil(), pos2))
    retval = irit.list(pt, prm1, prm2)
    return retval
Beispiel #26
0
def evalantipodalptsoncrv( crv ):
    aps = irit.antipodal( crv, 0.001, 1e-014 )
    irit.printf( "%d antipodal points detected\n", irit.list( irit.SizeOf( aps ) ) )
    retval = irit.nil(  )
    diam = 0
    i = 1
    while ( i <= irit.SizeOf( aps ) ):
        ap = irit.nth( aps, i )
        t1 = irit.coord( ap, 1 )
        t2 = irit.coord( ap, 2 )
        pt1 = irit.ceval( crv, irit.FetchRealObject(t1) )
        pt2 = irit.ceval( crv, irit.FetchRealObject(t2) )
        if ( irit.dstptpt( irit.coerce( pt1, irit.POINT_TYPE ), 
						   irit.coerce( pt2, irit.POINT_TYPE ) ) > diam ):
            diam = irit.dstptpt( irit.coerce( pt1, irit.POINT_TYPE ), 
								 irit.coerce( pt2, irit.POINT_TYPE ) )
            diamline = pt1 + pt2
        irit.snoc( irit.list( pt1 + pt2, pt1 * irit.tx( 0 ), pt2 * irit.tx( 0 ) ), retval )
        i = i + 1
    irit.color( retval, irit.YELLOW )
    irit.color( diamline, irit.CYAN )
    irit.adwidth( diamline, 3 )
    irit.snoc( irit.list( diamline ), retval )
    return retval
Beispiel #27
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 #28
0
# ############################################################################
# 
#  Curves
#  
# ############################################################################

view_mat1 = irit.sc( 0.5 )

irit.viewobj( view_mat1 )

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

c = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 0, (-1 ) ), \
                             irit.ctlpt( irit.E2, 0, 1 ) ) ) * irit.tx( 0.3 ) * irit.ty( 0.5 )
irit.adwidth( c, 3 )

k = irit.crvkernel( c, 15, 0, irit.GenIntObject(2), 2 )
irit.color( k, irit.YELLOW )

irit.interact( irit.list( c, k, irit.GetAxes() ) )

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

c = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-1 ), 1 ), \
                             irit.ctlpt( irit.E2, 0, (-1 ) ), \
                             irit.ctlpt( irit.E2, 1, 1 ) ) )
irit.adwidth( c, 3 )
irit.color( c, irit.RED )
ct = c * irit.tz( 1 )
Beispiel #29
0
c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0, 1 ), \
                              irit.ctlpt( irit.E3, 0, 1, 1 ), \
                              irit.ctlpt( irit.E3, 0.3, 1, 1 ), \
                              irit.ctlpt( irit.E3, 1, 0, 1 ) ) )

r1 = irit.ruledsrf(c1, c2)

r2 = r1 * irit.rx(90)

c = irit.nth(
    irit.rrinter(irit.cmesh(r1, irit.ROW, 0), irit.cmesh(r1, irit.ROW, 1),
                 irit.cmesh(r2, irit.ROW, 0), irit.cmesh(r2, irit.ROW, 1), 10,
                 0), 1)

irit.color(c, irit.RED)
irit.adwidth(c, 3)

irit.interact(irit.list(r1, r2, c))

zerosetsrf = irit.rrinter(irit.cmesh(r1, irit.ROW, 0),
                          irit.cmesh(r1, irit.ROW, 1),
                          irit.cmesh(r2, irit.ROW, 0),
                          irit.cmesh(r2, irit.ROW, 1), 10, 1)
zerosetsrfe3 = irit.coerce(zerosetsrf, irit.E3) * irit.rotx((-90)) * irit.roty(
    (-90)) * irit.sz(0.1)
zeroset = irit.contour(zerosetsrfe3, irit.plane(0, 0, 1, 1e-005))
irit.color(zeroset, irit.RED)
irit.adwidth(zeroset, 3)

irit.interact(irit.list(irit.GetAxes(), zerosetsrfe3, zeroset))
Beispiel #30
0
save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.GetViewMatrix() * irit.sc(0.35))
irit.viewobj(irit.GetViewMatrix())

#  Faster product using Bezier decomposition.
iprod = irit.iritstate("bspprodmethod", irit.GenIntObject(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)))