def plotfunc3d(minx, maxx, miny, maxy, n, m):
    pl = plotfunc3d2poly(minx, maxx, miny, maxy, n, m)
    irit.color(pl, irit.YELLOW)
    irit.attrib(pl, "width", irit.GenRealObject(0.05))
    minz = 1e+006
    maxz = (-1e+006)
    i = 0
    while (i <= irit.SizeOf(pl) - 1):
        p = irit.coord(pl, i)
        j = 0
        while (j <= irit.SizeOf(p) - 1):
            v = irit.coord(p, i)
            if (irit.FetchRealObject(irit.coord(v, 2)) > maxz):
                maxz = irit.FetchRealObject(irit.coord(v, 2))
            if (irit.FetchRealObject(irit.coord(v, 2)) < minz):
                minz = irit.FetchRealObject(irit.coord(v, 2))
            j = j + 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.poly(
                                    irit.list((0, 0, irit.min(minz, 0)),
                                              (0, 0, irit.max(maxz, 0))), 1))

    irit.color(ax, irit.RED)
    irit.attrib(ax, "width", irit.GenRealObject(0.02))
    retval = irit.list(pl, ax)
    irit.viewobj(retval)
    irit.printf(
        "xdomain = [%lf %lf], ydomain = [%lf %lf], zdomain = [%lf %lf]\n",
        irit.list(minx, maxx, miny, maxy, minz, maxz))
    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
def printspeedchanges( str, crv ):
    dc = irit.cderive( crv )
    speedsqr = irit.bbox( irit.symbdprod( dc, dc ) )
    irit.printf( "%s [%f %f]\n", 
				 irit.list( str, 
							asqrt( irit.FetchRealObject(irit.nth( speedsqr, 1 )) ), 
							asqrt( irit.FetchRealObject(irit.nth( speedsqr, 2 )) ) ) )
Exemple #4
0
def printfitresult(str, fittedsrf):
    global fitting
    irit.snoc(fittedsrf, fitting)
    irit.printf("%s:\n", irit.list(str))
    i = 1
    while (i <= irit.SizeOf(fittedsrf)):
        irit.printf("\t%9.6pf\n", irit.list(irit.nth(fittedsrf, i)))
        i = i + 1
def computeviews( c, dms, fname ):
    ranges = irit.nil(  )
    i = 1
    while ( i <= irit.SizeOf( dms ) ):
        irit.snoc( cnvrtcrvs2ranges( irit.nth( dms, i ), i, 1 ), ranges )
        i = i + 1
    irit.printf( "%d views are considered\n", irit.list( irit.SizeOf( dms ) ) )
    retval = irit.setcover( ranges, 0.001 )
    return retval
def printcurve( crv ):
    orders = irit.fforder( crv )
    msize = irit.ffmsize( crv )
    irit.printf( "curve of order %d, poly size %d and point type %s\n", orders + msize + irit.list( getpointtype( irit.coord( crv, 0 ) ) ) )
    irit.printf( "control polygon:\n", irit.nil(  ) )
    printctlmesh( crv )
    if ( 1 ):
        kvs = irit.ffkntvec( crv )
        printknotvector( "u ", irit.nth( kvs, 1 ) )
def printsurface( srf ):
    orders = irit.fforder( srf )
    msize = irit.ffmsize( srf )
    irit.printf( "surface of orders %d x %d, mesh size %d x %d and point type %s\n", orders + msize + irit.list( getpointtype( irit.coord( srf, 0 ) ) ) )
    irit.printf( "control mesh:\n", irit.nil(  ) )
    printctlmesh( srf )
    if ( 1 ):
        kvs = irit.ffkntvec( srf )
        printknotvector( "u ", irit.nth( kvs, 1 ) )
        printknotvector( "v ", irit.nth( kvs, 2 ) )
def printtrivar( tv ):
    orders = irit.fforder( tv )
    msize = irit.ffmsize( tv )
    irit.printf( "trivar of orders %d x %d x %d mesh size %d x %d x %d and point type %s\n", orders + msize + irit.list( getpointtype( irit.coord( tv, 0 ) ) ) )
    irit.printf( "control mesh:\n", irit.nil(  ) )
    printctlmesh( tv )
    if ( 1 ):
        kvs = irit.ffkntvec( tv )
        printknotvector( "u ", irit.nth( kvs, 1 ) )
        printknotvector( "v ", irit.nth( kvs, 2 ) )
        printknotvector( "w ", irit.nth( kvs, 3 ) )
Exemple #9
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))))
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 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
Exemple #13
0
def drawbiarcs(crv, tol, maxangle):
    arcs = irit.cbiarcs(crv, tol, maxangle) * irit.tz(0.01)
    i = 1
    while (i <= irit.SizeOf(arcs)):
        if (isodd(i)):
            irit.color(irit.nref(arcs, i), irit.YELLOW)
        else:
            irit.color(irit.nref(arcs, i), irit.MAGENTA)
        i = i + 1
    irit.printf("%d arcs were used in this approximation\n",
                irit.list(irit.SizeOf(arcs)))
    irit.color(crv, irit.CYAN)
    irit.interact(irit.list(irit.GetAxes(), crv, arcs))
Exemple #14
0
def computeoptimalmotion(theta1, theta2, phi1, phi2, eps):
    err = estimatesphericalcrv(theta1, theta2, phi1, phi2)
    irit.printf(" %12g %12g %12g %12g = %f\n",
                irit.list(theta1, theta2, phi1, phi2, err))
    if (err > eps):
        newpt = midgreatcircpt(theta1, theta2, phi1, phi2)
        theta = irit.FetchRealObject(irit.nth(newpt, 1))
        phi = irit.FetchRealObject(irit.nth(newpt, 2))
        retval = computeoptimalmotion(theta, theta2, phi, phi2,
                                      eps) + computeoptimalmotion(
                                          theta1, theta, phi1, phi, eps)
    else:
        retval = irit.list(computesphericalcrv(theta1, theta2, phi1, phi2))
    return retval
def displayobjobjmdres(o1, o2, eps):
    global glbltransx
    mdres = irit.mindist2ff(o1, o2, eps)
    dist = irit.nth(mdres, 1)
    param1 = irit.nth(mdres, 2)
    param2 = irit.nth(mdres, 3)
    if (irit.SizeOf(param1) == 0):
        pt1 = irit.coerce(o1, irit.E3)
    else:
        prm = irit.nth(param1, 1)
        if (irit.ThisObject(prm) == irit.NUMERIC_TYPE):
            i = 1
            while (i <= irit.SizeOf(param1)):
                t = irit.nth(param1, i)
                irit.printf("min distance %f detected at t1 = %f\n",
                            irit.list(dist, t))
                i = i + 1
            pt1 = irit.ceval(o1, irit.FetchRealObject(t))
        else:
            i = 1
            while (i <= irit.SizeOf(param1)):
                uv = irit.nth(param1, i)
                irit.printf("min distance %f detected at uv1 = %f %f\n",
                            irit.list(dist, irit.nth(uv, 1), irit.nth(uv, 2)))
                i = i + 1
            pt1 = irit.seval(
                o1, irit.FetchRealObject(irit.nth(irit.nth(param1, 1), 1)),
                irit.FetchRealObject(irit.nth(irit.nth(param1, 1), 2)))
    if (irit.SizeOf(param2) == 0):
        pt2 = irit.coerce(o2, irit.E3)
    else:
        prm = irit.nth(param2, 1)
        if (irit.ThisObject(prm) == irit.NUMERIC_TYPE):
            i = 1
            while (i <= irit.SizeOf(param2)):
                t = irit.nth(param2, i)
                irit.printf("min distance %f detected at t2 = %f\n",
                            irit.list(dist, t))
                i = i + 1
            pt2 = irit.ceval(o2, irit.FetchRealObject(t))
        else:
            i = 1
            while (i <= irit.SizeOf(param2)):
                uv = irit.nth(param2, i)
                irit.printf("min distance %f detected at uv2 = %f %f\n",
                            irit.list(dist, irit.nth(uv, 1), irit.nth(uv, 2)))
                i = i + 1
            pt2 = irit.seval(
                o2, irit.FetchRealObject(irit.nth(irit.nth(param2, 1), 1)),
                irit.FetchRealObject(irit.nth(irit.nth(param2, 1), 2)))
    irit.color(pt1, irit.MAGENTA)
    irit.color(o1, irit.MAGENTA)
    irit.color(pt2, irit.YELLOW)
    irit.color(o2, irit.YELLOW)
    l = (pt1 + pt2)
    all = irit.list(o1, o2, pt1, pt2, l)
    irit.snoc(all * irit.tx(glbltransx), glblres)
    glbltransx = (glbltransx + 0.5)
    irit.interact(all)
Exemple #16
0
def computeerror(fname, crv, dist, ocrv):
    crv = irit.creparam(crv, 0, 1)
    ocrv = irit.creparam(ocrv, 0, 1)
    dst = irit.symbdiff(crv, ocrv)
    dstsqr = irit.symbdprod(dst, dst)
    ffmin = irit.max(
        irit.FetchRealObject(irit.coord(irit.ffextreme(dstsqr, 1), 1)), 0)
    ffmax = irit.max(
        irit.FetchRealObject(irit.coord(irit.ffextreme(dstsqr, 0), 1)), 0)
    irit.printf(
        "\n\t%s: min %lf, max %lf, max error %lf (ctlpts = %1.0lf)",
        irit.list(
            fname, math.sqrt(ffmin), math.sqrt(ffmax),
            irit.max(abs(math.sqrt(ffmin) - dist),
                     abs(math.sqrt(ffmax) - dist)), irit.SizeOf(ocrv)))
def printctlmeshaux( mesh, ofst, dims ):
    if ( irit.SizeOf( dims ) == 1 ):
        i = 1
        while ( i <= irit.FetchRealObject(irit.nth( dims, 1 )) ):
            printctlpoint( irit.nth( mesh, i + ofst ) )
            i = i + 1
        irit.printf( "\n", irit.nil(  ) )
    else:
        dimsl = getlistwithoutlast( dims )
        d1 = getlistlast( dims )
        d2 = getlistproduct( dimsl )
        i = 1
        while ( i <= irit.FetchRealObject(d1) ):
            printctlmeshaux( mesh, ofst + d2 * ( i - 1 ), dimsl )
            i = i + 1
Exemple #18
0
def interptseval(crvs):
    retval = irit.nil()
    i = 1
    while (i <= irit.SizeOf(crvs)):
        crv = irit.nth(crvs, i)
        interpts = irit.getattr(crv, "interpts")
        j = 1
        while (j <= irit.SizeOf(interpts)):
            irit.snoc(
                irit.ceval(crv, irit.FetchRealObject(irit.nth(interpts, j))),
                retval)
            j = j + 1
        i = i + 1
    irit.printf("numer of intersections detected = %d\n",
                irit.list(irit.SizeOf(retval)))
    return retval
Exemple #19
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)
Exemple #20
0
def evaltoeuclidean(srf, paramumb):
    retval = irit.nil()
    i = 1
    while (i <= irit.SizeOf(paramumb)):
        umb = irit.nth(paramumb, i)
        crvtr = irit.scrvtreval(srf, irit.FetchRealObject(irit.coord(umb, 0)),
                                irit.FetchRealObject(irit.coord(umb, 1)), 1)
        irit.printf(
            "principal curvatures at (u, v) = (%f, %f) equal %.9f and %.9f\n",
            irit.list(irit.coord(umb, 0), irit.coord(umb, 1),
                      irit.nth(crvtr, 1), irit.nth(crvtr, 3)))
        irit.snoc(
            irit.seval(srf, irit.FetchRealObject(irit.coord(umb, 0)),
                       irit.FetchRealObject(irit.coord(umb, 1))), retval)
        i = i + 1
    irit.color(retval, irit.YELLOW)
    return retval
def printctlpoint( cpt ):
    s = irit.SizeOf( cpt )
    if ( s < 0 ):
        irit.printf( "\t[w=%-9.6lg ", irit.list( irit.coord( cpt, 0 ) ) )
        s = (-s )
    else:
        irit.printf( "\t[", irit.nil(  ) )
    i = 1
    while ( i <= s ):
        irit.printf( "%9.6lg ", irit.list( irit.coord( cpt, i ) ) )
        i = i + 1
    irit.printf( "]\n", irit.nil(  ) )
Exemple #22
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
Exemple #23
0
def comparecurvaturecrvevals(c):
    c = irit.coerce(c, irit.KV_OPEN)
    tmin = irit.FetchRealObject(irit.nth(irit.pdomain(c), 1))
    tmax = irit.FetchRealObject(irit.nth(irit.pdomain(c), 2))
    t = tmin
    dt = (tmax - tmin) / 100.0
    crvtrcrv = irit.cnrmlcrv(c)
    while (t <= tmax):
        kn = irit.ceval(crvtrcrv, t)
        k1 = math.sqrt(
            irit.FetchRealObject(
                irit.coerce(kn, irit.VECTOR_TYPE) *
                irit.coerce(kn, irit.VECTOR_TYPE)))
        k2 = irit.FetchRealObject(irit.ccrvtreval(c, t))
        if (abs(k1 - k2) > 1e-05):
            irit.printf(
                "mismatch in curve curvature evaluation (%.13f vs. %.13f)\n",
                irit.list(k1, k2))
        t = t + dt
Exemple #24
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
Exemple #25
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
Exemple #26
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
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
def printknotvector( str, kv ):
    irit.printf( "    [%sknotvector:", irit.list( str ) )
    i = 1
    while ( i <= irit.SizeOf( kv ) ):
        irit.printf( " %-.6lg", irit.list( irit.nth( kv, i ) ) )
        i = i + 1
    irit.printf( "]\n", irit.nil(  ) )
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))
Exemple #30
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 )