def originalf(f, newf, deg, c, ptype): net = irit.nil() f_p = irit.coerce(f, irit.POWER_TYPE) tmp = irit.ffsplit(f_p) tmp3 = irit.ffsplit(newf) i = 1 while (i <= c): t = irit.coord(irit.coord(irit.nth(tmp, i), deg), 1) tmp2 = irit.nth(tmp3, i) * irit.sc(irit.FetchRealObject(t)) irit.snoc(irit.coerce(tmp2, irit.E1), net) i = i + 1 retval = irit.ffmerge(net, ptype) return retval
def canonicalh(f, g, deg, c, ptype): net = irit.nil() t = irit.ceval(g, 1) g2 = g * irit.sc(1 / irit.FetchRealObject(irit.coord(t, 1))) f2 = irit.cregion(f, 0, irit.FetchRealObject(irit.coord(t, 1))) f_p = irit.coerce(f2, irit.POWER_TYPE) tmp = irit.ffsplit(f_p) i = 1 while (i <= c): bm = irit.coord(irit.coord(irit.nth(tmp, i), deg), 1) tmp2 = irit.coerce(irit.nth(tmp, i), irit.BEZIER_TYPE) * irit.sc( 1 / irit.FetchRealObject(bm)) irit.snoc( irit.coerce(irit.coerce(irit.compose(tmp2, g2), irit.BEZIER_TYPE), irit.E1), net) i = i + 1 retval = irit.ffmerge(net, ptype) return retval
m = irit.mdivide(mt1, dir, 0.5) m1 = irit.nth(m, 1) m2 = irit.nth(m, 2) printtest( "mdivide", irit.mmerge(m1, m2, dir, 0), irit.mreparam(irit.mrefine(mt1, dir, 0, irit.list(0.5, 0.5)), dir, 0, 2)) dir = 2 m = irit.mdivide(mt2, dir, 0.5) m1 = irit.nth(m, 1) m2 = irit.nth(m, 2) printtest( "mdivide", irit.mmerge(m1, m2, dir, 0), irit.mreparam(irit.mrefine(mt2, dir, 0, irit.list(0.5, 0.5)), dir, 0, 1)) printtest("ffmerge", irit.ffmerge(irit.ffsplit(mc1), irit.E3), mc1) printtest("ffmerge", irit.ffmerge(irit.ffsplit(ms1), irit.E3), ms1) printtest("ffmerge", irit.ffmerge(irit.ffsplit(mt1), irit.E3), mt1) printtest("ffmerge", irit.ffmerge(irit.ffsplit(mt2), irit.E3), mt2) printtest("symbdiff", irit.symbdiff(c1, c1), irit.coerce(irit.symbdiff(mc1, mc1), irit.CURVE_TYPE)) printtest("symbdiff", irit.symbdiff(c2, c2), irit.coerce(irit.symbdiff(mc2, mc2), irit.CURVE_TYPE)) printtest("symbdiff", irit.symbdiff(c1, c2), irit.coerce(irit.symbdiff(mc1, mc2), irit.CURVE_TYPE)) printtest("symbsum", irit.symbsum(c1, c1), irit.coerce(irit.symbsum(mc1, mc1), irit.CURVE_TYPE)) printtest("symbsum", irit.symbsum(c2, c2), irit.coerce(irit.symbsum(mc2, mc2), irit.CURVE_TYPE))
irit.interact( irit.list(evalgaussiancrvs(eggbase, 1, (-1), 0.7, 0.1), evalmeancrvs(eggbase, 1, (-1), 1, 0.1), eggbase)) irit.save( "sparab3", irit.list(evalgaussiancrvs(eggbase, 1, (-1), 0.7, 0.1), evalmeancrvs(eggbase, 1, (-1), 1, 0.1), eggbase)) irit.free(eggbase) # ############################################################################ # Split and Merge of freeforms. # ############################################################################ ff = irit.ffsplit(irit.circle((0, 0, 0), 1)) ff = irit.ffmerge(ff, irit.P3) irit.printf("split/merge test = %d\n", irit.list(irit.ffpttype(ff) == irit.GenRealObject(irit.P3))) irit.free(ff) irit.viewclear() irit.viewstate("polyaprx", 1) irit.viewstate("polyaprx", 1) irit.viewstate("numisos", 1) irit.viewstate("numisos", 1) irit.SetResolution(save_res) iprod = irit.iritstate("bspprodmethod", iprod)
icrv = irit.iritstate("intercrv", icrv) irit.free(icrv) irit.free(pln) irit.interact(irit.list(irit.GetAxes(), intcrvs, monkey) * irit.sc(0.35)) irit.save("mvexplc2", irit.list(irit.GetAxes(), intcrvs, monkey)) irit.free(monkey) irit.free(intcrvs) # # Enneper minimal surface. # enneper = irit.ffmerge( irit.list(irit.mvexplicit(2, "a - a^3 / 3 + a * b^2"), irit.mvexplicit(2, " b^3 / 3 - a^2 * b - b"), irit.mvexplicit(2, "a^2 - b^2")), irit.E3) enneper = coercetobezsrf(enneper, (-1), 1, (-1), 1) b = irit.bbox(irit.smean(enneper, 0)) irit.printf( "mean curvature sqaure computed for the enneper surface spans %.14f to %.14f\n", irit.list(irit.nth(b, 1), irit.nth(b, 2))) irit.free(b) irit.interact(irit.list(irit.GetAxes(), enneper) * irit.sc(0.35)) irit.save("mvexplc3", irit.list(irit.GetAxes(), enneper)) irit.free(enneper) #