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 testrun( numcrvs, crvdeg, crvlen, crvsize, seed, subeps,\ numeps, opti ): ri = irit.iritstate("randominit", irit.GenIntObject(seed)) c = randomcrvs(numcrvs, crvdeg, crvlen, crvsize) irit.attrprop(c, "color", irit.GenIntObject(14)) irit.view(c, irit.ON) msc = irit.mscirc(c, irit.list(subeps, numeps)) irit.view(msc, irit.OFF) irit.pause() retval = irit.list(msc, c) return retval
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
# Polygons: # # ############################################################################ pl = irit.poly( irit.list( ( 1, 0, 0 ), ( 0, (-0.8 ), 0 ), irit.point( (-0.5 ), 0, 0 ) ), irit.FALSE ) ppl = plgntoplln( pl ) irit.interact( irit.list( irit.GetAxes(), ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) ) angle = 18 while ( angle < 19.4 ): irit.printf( "angle = %.2f\n", irit.list( angle ) ) irit.view( irit.list( ppl, gammakernelpolysrfs( pl, angle, 2 ) * irit.sz( (-1 ) ) ), irit.ON ) angle = angle + 0.1 irit.pause( ) # ############################################################################ pl = irit.poly( irit.list( ( 0.9, 0, 0 ), ( 0, (-0.9 ), 0 ), irit.point( (-0.8 ), 0, 0 ), irit.point( (-0.5 ), 0, 0 ), irit.point( 0, 1, 0 ), irit.point( 0.5, 0, 0 ) ), irit.FALSE ) ppl = plgntoplln( pl ) irit.interact( irit.list( irit.GetAxes(), ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) ) irit.save( "gama1krn", irit.list( ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) ) angle = 21 while ( angle < 22.6 ): irit.printf( "angle = %.2f\n", irit.list( angle ) ) irit.view( irit.list( ppl, gammakernelpolysrfs( pl, angle, 2 ) * irit.sz( (-1 ) ) ), irit.ON ) angle = angle + 0.1
def interact( none ): irit.viewdclear( ) irit.viewobj( none ) irit.pause( )
def printtest(title, res1, res2): irit.printf("%9s test - %d\n", irit.list(title, res1 == res2)) if (res1 != res2): irit.pause()