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)
def drawtritangencies(srfs, orient, subtol, numtol, savename): tritans = irit.srf3tans(srfs, orient, subtol, numtol) tritansedges = evaltritangency(srfs, tritans) irit.color(tritansedges, irit.YELLOW) irit.color(srfs, irit.CYAN) if (irit.SizeOf(irit.GenStrObject(savename)) > 0): irit.save(savename, irit.list(srfs, tritansedges)) irit.interact(irit.list(srfs, tritansedges))
def drawbitangencies( srfs, orient, subtol, numtol, mergetol, merged,\ savename ): bitans = irit.srf2tans(srfs, orient, subtol, numtol, mergetol) bitansedges = evalbitangency(srfs, bitans, merged) irit.color(bitansedges, irit.YELLOW) irit.color(srfs, irit.CYAN) if (irit.SizeOf(irit.GenStrObject(savename)) > 0): irit.save(savename, irit.list(srfs, bitansedges)) irit.interact(irit.list(srfs, bitansedges))
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))
def do_coplanars(a, b, fname): irit.interact(irit.list(a, b)) c1 = (a + b) irit.interact(c1) c2 = a * b irit.interact(c2) c3 = (a - b) irit.interact(c3) c4 = (b - a) irit.interact(c4) irit.save( fname, irit.list(c1, c2 * irit.tx(4), c3 * irit.tx(8), c4 * irit.tx(12)))
def displayobjobjhdres( o1, o2, eps, onesided ): global glbltransx hdres = irit.hausdorff( o1, o2, eps, onesided ) dist = irit.nth( hdres, 1 ) param1 = irit.nth( hdres, 2 ) if ( onesided ): dtype = "one sided " else: dtype = "two sided " if ( irit.SizeOf( param1 ) == 0 ): pt1 = irit.coerce( o1, irit.E3 ) else: i = 1 while ( i <= irit.SizeOf( param1 ) ): t = irit.nth( param1, i ) irit.printf( "%shausdorff distance %f detected at t1 = %f\n", irit.list( dtype, dist, t ) ) i = i + 1 pt1 = irit.ceval( o1, irit.FetchRealObject(t) ) param2 = irit.nth( hdres, 3 ) if ( irit.SizeOf( param2 ) == 0 ): pt2 = irit.coerce( o2, irit.E3 ) else: i = 1 while ( i <= irit.SizeOf( param2 ) ): t = irit.FetchRealObject(irit.nth( param2, i )) irit.printf( "%shausdorff distance %f detected at t2 = %f\n", irit.list( dtype, dist, t ) ) i = i + 1 pt2 = irit.ceval( o2, t ) irit.color( pt1, irit.MAGENTA ) irit.color( o1, irit.MAGENTA ) irit.color( pt2, irit.YELLOW ) irit.color( o2, irit.YELLOW ) l = ( pt1 + pt2 ) if ( onesided == 0 ): irit.attrib( l, "dwidth", irit.GenIntObject(3 )) all = irit.list( o1, o2, pt1, pt2, l ) irit.snoc( all * irit.tx( glbltransx ), glblres ) glbltransx = ( glbltransx + 0.5 ) irit.interact( all )
import irit # # # Intersection of two boxes: # # Created by Gershon Elber, Jan. 89 # save_mat = irit.GetViewMatrix() irit.SetViewMatrix(save_mat * irit.scale((0.15, 0.15, 0.15))) b1 = irit.box(((-3), (-2), (-1)), 6, 4, 2) b2 = irit.box(((-4), (-3), (-2)), 2, 2, 4) a1 = (b2 + b1) irit.interact(irit.list(irit.GetViewMatrix(), a1)) a2 = b2 * b1 irit.interact(a2) a3 = (b2 - b1) irit.interact(a3) a4 = (b1 - b2) irit.interact(a4) icrv = irit.iritstate("intercrv", irit.GenIntObject(1)) a5 = b2 * b1 irit.interact(irit.list(a5, b1, b2)) icrv = irit.iritstate("intercrv", icrv) irit.free(icrv)
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)) # ############################################################################ #
irit.free(t8) irit.free(t9) irit.view(s5, irit.OFF) s6 = (s4 - s5) irit.free(s4) irit.free(s5) final = irit.convex(s6) irit.free(s6) irit.printf("total time = %f\n", irit.list(irit.time(0))) # In Seconds irit.save("solid2h", final) irit.interact(final) final2 = irit.triangl(final, 1) # Convert to triangles irit.save("solid2ht", final2) irit.interact(final2) irit.free(final) irit.free(final2) irit.SetViewMatrix(save_mat) irit.SetResolution(save_res) psort = irit.iritstate("polysort", psort) irit.free(psort)
pt = irit.ctlpt(irit.E2, irit.random((-1), 1), irit.random((-1), 1)) irit.snoc(pt, pts) i = i + 1 c2 = irit.coerce(irit.cbspline(4, pts, irit.list(irit.KV_PERIODIC)), irit.KV_OPEN) irit.color(c2, irit.RED) irit.adwidth(c2, 4) # # Convex Hull. # chc0 = irit.cnvxhull(c0, 10) irit.color(chc0, irit.GREEN) irit.adwidth(chc0, 2) irit.interact(irit.list(c0, chc0)) chc1 = irit.cnvxhull(c1, 10) irit.color(chc1, irit.GREEN) irit.adwidth(chc1, 2) irit.interact(irit.list(c1, chc1)) chc2 = irit.cnvxhull(c2, 10) irit.color(chc2, irit.GREEN) irit.adwidth(chc2, 2) irit.interact(irit.list(c2, chc2)) irit.save( "ffcnvhl1", irit.list(irit.list(c0, chc0), irit.list(c1, chc1) * irit.tx(3),
cubes = b1 ^ b2 ^ b3 ^ b4 ^ b5 ^ b6 ^ b7 ^ b8 irit.free(b1) irit.free(b2) irit.free(b3) irit.free(b4) irit.free(b5) irit.free(b6) irit.free(b7) irit.free(b8) rot_cubes = cubes * irit.rotx(30) * irit.rotz(25) intrcrv = irit.iritstate("intercrv", irit.GenIntObject(1)) crvs_cubes = (cubes + rot_cubes) irit.color(crvs_cubes, irit.GREEN) irit.interact(irit.list(crvs_cubes, cubes, rot_cubes)) irit.free(crvs_cubes) intrcrv = irit.iritstate("intercrv", intrcrv) irit.free(intrcrv) u_cubes = (cubes + rot_cubes) irit.interact(u_cubes) i_cubes = cubes * rot_cubes irit.interact(i_cubes) s_cubes = (cubes - rot_cubes) irit.interact(s_cubes) irit.SetViewMatrix(irit.rotx(0)) u_cubes = irit.convex(u_cubes)
q2 = irit.quadcrvs( crv, 0.1, (-1 ) ) irit.color( q2, irit.CYAN ) irit.printf( "%d quadratic segements\n", irit.list( irit.SizeOf( q2 ) ) ) q3 = irit.cubiccrvs( crv, 0.02, (-1 ) ) irit.color( q3, irit.MAGENTA ) irit.printf( "%d cubic segements\n", irit.list( irit.SizeOf( q3 ) ) ) q4 = irit.cubiccrvs( crv, 0.1, (-1 ) ) irit.color( q4, irit.GREEN ) irit.printf( "%d cubic segements\n", irit.list( irit.SizeOf( q4 ) ) ) all = irit.list( crv, q1 * irit.tz( 0.1 ), q2 * irit.tz( 0.2 ), q3 * irit.tz( 0.3 ), q4 * irit.tz( 0.4 ) ) irit.interact( all ) irit.save( "pp1apprx", all ) # ################################ crv = irit.cbspline( 5, irit.list( irit.ctlpt( irit.E2, 0.5, (-1 ) ), \ irit.ctlpt( irit.E2, (-1.5 ), (-0.5 ) ), \ irit.ctlpt( irit.E2, 0.5, 0 ), \ irit.ctlpt( irit.E2, (-0.15 ), 2 ), \ irit.ctlpt( irit.E2, (-1.5 ), 2 ), \ irit.ctlpt( irit.E2, (-0.5 ), 1 ), \ irit.ctlpt( irit.E2, 0.5, 2 ) ), irit.list( irit.KV_OPEN ) ) irit.color( crv, irit.WHITE ) irit.attrib( crv, "width", irit.GenRealObject(0.02 ))
irit.attrib(cap, "stexture_func", irit.GenStrObject("sqrt")) irit.attrib(cap, "stexture_bound", irit.GenStrObject("-5.0 20.0")) irit.color(spout, irit.BLUE) irit.attrib(spout, "stexture", irit.smean(spout, 0)) irit.attrib(spout, "stexture_func", irit.GenStrObject("sqrt")) irit.attrib(spout, "stexture_bound", irit.GenStrObject("-5.0 20.0")) irit.color(handle, irit.MAGENTA) irit.attrib(handle, "stexture", irit.smean(handle, 0)) irit.attrib(handle, "stexture_func", irit.GenStrObject("sqrt")) irit.attrib(handle, "stexture_bound", irit.GenStrObject("-5.0 20.0")) teapot = irit.list(body, spout, handle, cap) irit.interact(irit.list(irit.GetViewMatrix(), teapot)) irit.save("meanstea", teapot) # # Render the following using irender to get the curvature bound as color map # on top of the teapot. # irit.color(body, irit.RED) irit.attrib(body, "stexture", irit.sgauss(body, 0)) irit.attrib(body, "stexture_bound", irit.GenStrObject("-5.0 10.0")) irit.color(cap, irit.GREEN) irit.attrib(cap, "stexture", irit.sgauss(cap, 0)) irit.attrib(cap, "stexture_bound", irit.GenStrObject("-5.0 10.0")) irit.color(spout, irit.BLUE)
# Try this one with resolution equal 20 - slower, but much nicer! # # Created by Gershon Elber, Jan. 89 # save_mat = irit.GetViewMatrix() irit.SetViewMatrix(irit.GetViewMatrix() * irit.scale((0.2, 0.2, 0.2))) save_res = irit.GetResolution() irit.SetResolution(8) cone1 = irit.cone((0, 0, (-1)), (0, 0, 4), 2, 3) cylin1 = irit.cylin((0, 3, 1), (0, (-6), 0), 0.7, 3) a1 = (cone1 + cylin1) irit.interact(irit.list(irit.GetViewMatrix(), a1)) a2 = cone1 * cylin1 irit.interact(a2) a3 = (cone1 - cylin1) irit.interact(a3) a4 = (cylin1 - cone1) irit.interact(a4) intrcrv = irit.iritstate("intercrv", irit.GenIntObject(1)) a5 = cone1 * cylin1 irit.interact(irit.list(a5, cylin1, cone1)) dummy = irit.iritstate("intercrv", intrcrv) irit.free(intrcrv)
irit.ctlpt( irit.E2, (-1.5 ), (-0.5 ) ), \ irit.ctlpt( irit.E2, 1.5, 0 ), \ irit.ctlpt( irit.E2, (-0.5 ), 2 ), \ irit.ctlpt( irit.E2, (-0.5 ), 1 ) ), irit.list( irit.KV_OPEN ) ) irit.color(crv1, irit.GREEN) irit.attrib(crv1, "width", irit.GenRealObject(0.02)) pt_param = irit.crvptdst(crv1, (0, 0, 0), 0, (-0.001)) pt_extrem = irit.nil() i = 1 while (i <= irit.SizeOf(pt_param)): pt = irit.ceval(crv1, irit.FetchRealObject(irit.nth(pt_param, i))) irit.snoc(irit.coerce(pt, irit.VECTOR_TYPE), pt_extrem) i = i + 1 irit.interact(irit.list(irit.GetAxes(), crv1, pt_extrem)) irit.save("crv1dist", irit.list(irit.GetAxes(), crv1, pt_extrem)) pt_min = irit.ceval( crv1, irit.FetchRealObject(irit.crvptdst(crv1, (0, 0, 0), 1, 0.001))) irit.interact( irit.list(irit.GetAxes(), crv1, irit.coerce(pt_min, irit.VECTOR_TYPE))) pt_max = irit.ceval( crv1, irit.FetchRealObject(irit.crvptdst(crv1, (0, 0, 0), 0, 0.001))) irit.interact( irit.list(irit.GetAxes(), crv1, irit.coerce(pt_max, irit.VECTOR_TYPE))) irit.save( "crv2dist", irit.list(irit.GetAxes(), crv1, irit.coerce(pt_max, irit.VECTOR_TYPE)))
s2 = (s1 - b2) irit.free(s1) irit.free(b2) irit.color(s2, irit.YELLOW) irit.view(s2, irit.ON) c2 = irit.cylin((0, (-0.4), 0.595), (0, 0.8, 0), 0.3, 3) irit.view(c2, irit.OFF) s3 = (s2 - c2) irit.free(s2) irit.free(c2) final = irit.convex(s3) irit.free(s3) irit.interact(final) tfinal = irit.triangl(final, 1) irit.interact(tfinal) efinal = irit.maxedgelen(tfinal, 0.2) irit.interact(efinal) irit.save("solid8", efinal) irit.free(final) irit.free(tfinal) irit.free(efinal) irit.SetResolution(save_res) irit.SetViewMatrix(save_mat)
# Examine MZERO # s1 = irit.bivariate2bezier("math.pow(x, 2) + math.pow(y, 2) - 1", 2, 2) s1 = irit.coerce( irit.sregion( irit.sregion( s1, irit.COL, (-3 ), 3 ), irit.ROW, (-3 ),\ 3 ), irit.MULTIVAR_TYPE ) s2 = irit.bivariate2bezier("math.pow((x + 1), 2) + math.pow(y, 2) - 1", 2, 2) s2 = irit.coerce( irit.sregion( irit.sregion( s2, irit.COL, (-3 ), 3 ), irit.ROW, (-3 ),\ 3 ), irit.MULTIVAR_TYPE ) sol = irit.mzero(irit.list(s1, s2), 0.01, 1e-006) irit.color(sol, irit.RED) m = irit.rotx((-90)) * irit.roty((-90)) * irit.sz(0.1) irit.interact( irit.list( irit.coerce(irit.coerce(s1, irit.SURFACE_TYPE), irit.E3) * m, irit.coerce(irit.coerce(s2, irit.SURFACE_TYPE), irit.E3) * m, irit.coerce(irit.coerce(s2, irit.SURFACE_TYPE), irit.E3) * m * irit.sz(0), sol)) sol = irit.mzero(irit.list(s1), 0.01, 1e-006) irit.color(sol, irit.RED) m = irit.rotx((-90)) * irit.roty((-90)) * irit.sz(0.1) irit.interact( irit.list( irit.coerce(irit.coerce(s1, irit.SURFACE_TYPE), irit.E3) * m, irit.coerce(irit.coerce(s2, irit.SURFACE_TYPE), irit.E3) * m * irit.sz(0), sol)) # # Restore state #
basey2 = 2.3 bodybase2 = irit.poly( irit.list(((-2), basey2, (-2)), ((-2), basey2, 2), (2, basey2, 2), (2, basey2, (-2))), irit.FALSE) teapotaux3 = teapotaux2 * (-bodybase2) basey3 = 2.22 bodybase3 = irit.poly( irit.list((2, basey3, (-2)), (2, basey3, 2), (4, basey3, 2), (4, basey3, (-2))), irit.FALSE) teapot = teapotaux3 * (-bodybase3) irit.interact(teapot) irit.save("pteapot", teapot) irit.SetPolyApproxOpt(save_approx_opt) irit.free(bodybase) irit.free(bodybase2) irit.free(bodybase3) irit.free(teapotaux) irit.free(teapotaux2) irit.free(teapotaux3) irit.free(body) irit.free(spout) irit.free(handle) irit.free(cap) irit.free(pbody)
irit.ctlpt( irit.E2, (-0.151 ), (-0.309 ) ), \ irit.ctlpt( irit.E2, (-0.517 ), (-0.666 ) ), \ irit.ctlpt( irit.E2, 0.00856, (-0.84 ) ), \ irit.ctlpt( irit.E2, 0.327, (-0.704 ) ), \ irit.ctlpt( irit.E2, 0.147, (-0.109 ) ), \ irit.ctlpt( irit.E2, 0.33, (-0.0551 ) ), \ irit.ctlpt( irit.E2, 0.486, 0.142 ), \ irit.ctlpt( irit.E2, 0.393, 0.623 ) ), irit.list( irit.KV_PERIODIC ) ) c2 = irit.coerce(c2, irit.KV_OPEN) irit.color(c2, irit.YELLOW) r = 0.1 pts = irit.crc2crvtan(c1, c2, r, 1e-006) ptsdsp = displayptscrctan2crvs(pts, r, c1, c2) irit.interact(irit.list(c1, c2, ptsdsp)) irit.save("crv1tan", irit.list(c1, c2, ptsdsp)) r = 0.2 pts = irit.crc2crvtan(c1, c2, r, 1e-006) ptsdsp = displayptscrctan2crvs(pts, r, c1, c2) irit.interact(irit.list(c1, c2, ptsdsp)) r = 0.4 pts = irit.crc2crvtan(c1, c2, r, 1e-006) ptsdsp = displayptscrctan2crvs(pts, r, c1, c2) irit.interact(irit.list(c1, c2, ptsdsp))
irit.ctlpt( irit.E2, 0.14, 0.26 ), \ irit.ctlpt( irit.E2, 1, 0 ), \ irit.ctlpt( irit.E2, 1, 0 ) ), irit.list( irit.KV_OPEN ) ) n = ( irit.ctlpt( irit.E3, 0, 0, 1 ) + \ irit.ctlpt( irit.E3, 0, 0, 1 ) ) s2 = irit.blhermite(c1, c2, d1, d2, csec1, n) irit.color(s2, irit.GREEN) s3 = irit.blhermite(c1, c2, d1, d2, csec2, n) irit.color(s3, irit.YELLOW) irit.save("blending1", irit.list(s1, s2, s3)) irit.interact(irit.list(irit.GetAxes(), s1, s2, s3)) # # Blend on a (polynomial approximation of a) sphere: # s = (-irit.surfprev( irit.cregion(irit.pcircle((0, 0, 0), 1), 0, 2) * irit.rx(90))) irit.attrprop(s, "u_resolution", irit.GenIntObject(3)) irit.attrprop(s, "v_resolution", irit.GenIntObject(3)) ds = irit.sderive(s, irit.ROW) c1 = (-irit.csurface(s, irit.ROW, 0.8)) c2 = (-irit.csurface(s, irit.ROW, 1.2)) d1 = (-irit.csurface(ds, irit.ROW, 0.8))
# # Marching cubes of trivariates: # tv = irit.load( "../data/sphere16.itd" ) size = 0.03 srf1 = irit.mrchcube( irit.list( tv, 1, 2, 0 ), ( size, size, size ), 1, 0.25 ) irit.color( srf1, 5 ) srf2 = irit.mrchcube( irit.list( tv, 1, 1, 0 ), ( size, size, size ), 1, 0.5 ) irit.color( srf2, 2 ) srf3 = irit.mrchcube( irit.list( tv, 1, 0.5, 0 ), ( size, size, size ), 1, 0.75 ) irit.color( srf3, 14 ) irit.interact( irit.list( irit.GetAxes(), wirebox3( size * 16 ), srf1, srf2, srf3 ) ) size = 0.03 srf1 = irit.mrchcube( irit.list( tv, 1, 0.5, 1 ), ( size, size, size ), 1, 0.25 ) irit.color( srf1, 5 ) srf2 = irit.mrchcube( irit.list( tv, 1, 0.5, 1 ), ( size, size, size ), 1, 0.5 ) irit.color( srf2, 2 ) srf3 = irit.mrchcube( irit.list( tv, 1, 0.5, 1 ), ( size, size, size ), 1, 0.75 ) irit.color( srf3, 14 ) irit.interact( irit.list( irit.GetAxes(), wirebox3( size * 16 ), srf1, srf2, srf3 ) ) size = 0.06 srf1 = irit.mrchcube( irit.list( tv, 1, 1, 1 ), ( size, size, size ), 2, 0.25 ) irit.color( srf1, 5 ) srf2 = irit.mrchcube( irit.list( tv, 1, 1, 1 ), ( size, size, size ), 2, 0.5 )
star = irit.list(irit.poly(irit.list(ptc, pt1, pt2), irit.FALSE), irit.poly(irit.list(ptc, pt2, pt3), irit.FALSE), irit.poly(irit.list(ptc, pt3, pt4), irit.FALSE), irit.poly(irit.list(ptc, pt4, pt5), irit.FALSE), irit.poly(irit.list(ptc, pt5, pt1), irit.FALSE)) * irit.rz(90) irit.color(star, irit.WHITE) irit.SetResolution(80) circ = irit.circpoly((0, 0, 1), (0, 0, 0), 1) * irit.tz((-0.01)) irit.color(circ, irit.BLUE) irit.attrib(circ, "rgb", irit.GenStrObject("0,0,8")) irit.SetResolution(20) logo1 = irit.list(circ, star) irit.interact(logo1) irit.save("logo1", logo1) irit.free(logo1) # ################################ eps = 0.12 poly1 = irit.poly( irit.list( ((-1.8) - eps, (-0.2) - eps, 0), ((-1.8) - eps, 0.2 + eps, 0), irit.point(1.8 + eps, 0.2 + eps, 0), irit.point(1.8 + eps, (-0.2) - eps, 0)), 0) * irit.tz((-0.04)) irit.color(poly1, irit.BLUE)
all = irit.list(c123, c1, c2, c3) irit.SetViewMatrix(irit.sc(1.1)) irit.viewobj(irit.GetViewMatrix()) tr = 0.4 proj1 = all * irit.trans(((-tr), tr, 0)) proj2 = all * irit.rotx(90) * irit.trans((tr, tr, 0)) proj3 = all * irit.roty(90) * irit.trans(((-tr), (-tr), 0)) proj4 = all * irit.roty(30) * irit.rotx(20) * irit.trans((tr, (-tr), 0)) allproj = irit.list(proj1, proj2, proj3, proj4) irit.save("cylin3a", allproj) irit.interact(allproj) c123a = c123 * irit.roty(30) * irit.rotx(20) * irit.scale((3, 3, 3)) irit.attrib(c123a, "width", irit.GenRealObject(0.015)) irit.save("cylin3b", c123a) irit.interact(c123a) c123b = c123 * irit.roty(60) * irit.rotx(65) * irit.scale((3, 3, 3)) irit.attrib(c123b, "width", irit.GenRealObject(0.015)) irit.save("cylin3c", c123b) irit.interact(c123b) irit.SetViewMatrix(save_mat) irit.SetResolution(save_res)
rectan = irit.poly( irit.list( ( 0, 0, 0 ), ( 0, 1, 0 ), ( 2, 1, 0 ), ( 2, 0, 0 ), ( 0, 0, 0 ) ), irit.TRUE ) irit.attrib( rectan, "width", irit.GenStrObject("0.02" )) irit.color( rectan, irit.RED ) triang = irit.poly( irit.list( ( 0, 0, 0 ), ( 0, 1, 0 ), ( 1.5, 0.5, 0 ), ( 0, 0, 0 ) ), irit.TRUE ) irit.attrib( triang, "width", irit.GenStrObject("0.02" )) irit.color( triang, irit.RED ) irit.SetViewMatrix( irit.scale( ( 0.2, 0.2, 0.2 ) )) cube_prisa = irit.list( square, square * irit.trans( ( 1, 0, 0 ) ), square * irit.trans( ( 2, 0, 0 ) ), square * irit.trans( ( (-1 ), 0, 0 ) ), square * irit.trans( ( 0, 1, 0 ) ), square * irit.trans( ( 0, (-1 ), 0 ) ) ) irit.interact( irit.list( irit.GetViewMatrix(), cube_prisa ) ) irit.save( "cubepris", cube_prisa ) irit.free( cube_prisa ) box_prisa = irit.list( rectan, square * irit.trans( ( 2, 0, 0 ) ), square * irit.trans( ( (-1 ), 0, 0 ) ), rectan * irit.trans( ( 0, 1, 0 ) ), rectan * irit.trans( ( 0, 2, 0 ) ), rectan * irit.trans( ( 0, (-1 ), 0 ) ) ) irit.interact( irit.list( irit.GetViewMatrix(), box_prisa ) ) irit.save( "box_pris", box_prisa ) irit.free( box_prisa ) piram_prisa = irit.list( square, triang * irit.trans( ( 1, 0, 0 ) ), triang * irit.rotz( 90 ) * irit.trans( ( 1, 1, 0 ) ), triang * irit.rotz( 180 ) * irit.trans( ( 0, 1, 0 ) ), triang * irit.rotz( 270 ) * irit.trans( ( 0, 0, 0 ) ) ) irit.interact( irit.list( irit.GetViewMatrix(), piram_prisa ) ) irit.save( "pirapris", piram_prisa ) irit.free( piram_prisa ) irit.SetViewMatrix( save_mat)
plgcross = irit.poly( irit.list( v1, v2, v3, v4, v5, v6,\ v7, v8, v9, v10, v11, v12 ),\ 0 ) pllcross = irit.poly( irit.list( v1, v2, v3, v4, v5, v6,\ v7, v8, v9, v10, v11, v12,\ v1 ), 1 ) irit.color(pllcross, irit.GREEN) irit.adwidth(pllcross, 5) irit.SetResolution(16) t1 = irit.surfrev2(plgcross, 33, 180) irit.interact(irit.list(pllcross, irit.GetAxes(), t1)) t2 = irit.surfrevaxs(plgcross, (1, 0, 1)) irit.interact(irit.list(pllcross, irit.GetAxes(), t2)) t3 = irit.surfrevaxs(plgcross, (1, 1, 1)) irit.interact(irit.list(pllcross, irit.GetAxes(), t3)) t4 = irit.surfrevax2(plgcross, 90, 360, (1, 0, 1)) irit.interact(irit.list(pllcross, irit.GetAxes(), t4)) # T9 = surfRevAxs( PlgCross, vector( 0, 1, 0 ) ); irit.free(pllcross) irit.free(plgcross)
pt = irit.ceval( cbsp, irit.FetchRealObject(irit.nth(irit.pdomain(cbsp), 2)) * i / (steps - 1)) irit.snoc(pt, pt_lst) i = i + 1 cpl = irit.poly(pt_lst, irit.TRUE) irit.color(cpl, irit.GREEN) irit.SetResolution(0.02) cbsp2 = cbsp cpl2 = irit.gpolyline(cbsp2, 2) irit.color(cpl2, irit.YELLOW) irit.SetResolution(20) irit.interact(irit.list(cbsp, cpl2, cpl)) irit.save("gpolyln1", irit.list(cbsp, cpl2, cpl)) # ############################################################################ cbsp = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, (-1 ) ), \ irit.ctlpt( irit.E2, 0.3, 1 ), \ irit.ctlpt( irit.E2, 0.7, (-1 ) ), \ irit.ctlpt( irit.E2, 1, 1 ) ), irit.list( irit.KV_OPEN ) ) irit.color(cbsp, irit.RED) steps = 8 pt_lst = irit.nil() i = 0 while (i <= steps - 1): pt = irit.ceval(
# c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-1 ), 0 ), \ irit.ctlpt( irit.E2, (-1 ), 0.1 ), \ irit.ctlpt( irit.E2, (-0.9 ), (-0.1 ) ), \ irit.ctlpt( irit.E2, 0.9, 0 ) ) ) irit.color( c1, irit.MAGENTA ) pts = irit.ffptdist( c1, 0, 1000 ) e2pts = irit.nil( ) i = 1 while ( i <= irit.SizeOf( pts ) ): pt = irit.ceval( c1, irit.FetchRealObject(irit.coord( irit.nth( pts, i ), 0 ) )) irit.snoc( pt, e2pts ) i = i + 10 irit.interact( irit.list( e2pts, c1 ) ) irit.save( "ffptdst1", irit.list( e2pts, c1 ) ) pts = irit.ffptdist( c1, 1, 1000 ) e2pts = irit.nil( ) i = 1 while ( i <= irit.SizeOf( pts ) ): pt = irit.ceval( c1, irit.FetchRealObject(irit.coord( irit.nth( pts, i ), 0 ) )) irit.snoc( pt, e2pts ) i = i + 10 irit.interact( irit.list( e2pts, c1 ) ) irit.save( "ffptdst2", irit.list( e2pts, c1 ) ) c2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-0.8 ), 0 ), \
irit.view( irit.list( irit.GetAxes(), pl1 ), irit.ON ) pts = irit.nil( ) i = 0 while ( i <= 1000 ): p = irit.point( irit.random( (-0.5 ), 0.5 ), irit.random( (-0.5 ), 0.5 ), 0 ) if ( irit.FetchRealObject(irit.ppinclude( pl1, irit.Fetch3TupleObject(p) ) ) ): irit.color( p, irit.GREEN ) else: irit.color( p, irit.RED ) irit.snoc( p * irit.tx( 0 ), pts ) i = i + 1 irit.interact( irit.list( view_mat0, pl1, pts ) ) irit.save( "pt_inpl1", irit.list( irit.GetViewMatrix(), pl1, pts ) ) irit.free( pl1 ) # ############################################################################# # # Point inclusion in a curve: # crv1 = irit.cbspline( 4, irit.list( ( 0, 0, 0 ), ( 0.3, 0, 0 ), irit.point( 0.3, 0.1, 0 ), irit.point( 0.2, 0.1, 0 ), irit.point( 0.2, 0.5, 0 ), irit.point( 0.3, 0.5, 0 ), irit.point( 0.3, 0.6, 0 ), irit.point( 0, 0.6, 0 ), irit.point( 0, 0.5, 0 ), irit.point( 0.1, 0.5, 0 ), irit.point( 0.1, 0.1, 0 ), irit.point( 0, 0.1, 0 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.tx( (-0.15 ) ) * irit.ty( (-0.3 ) ) irit.view( irit.list( irit.GetAxes(), crv1 ), irit.ON ) pts = irit.nil( )
irit.viewstate( "polyaprx", 1 ) irit.viewstate( "polyaprx", 1 ) irit.viewstate( "drawstyle", 1 ) irit.viewstate( "depthcue", 0 ) irit.viewstate( "dsrfpoly", 1 ) # ############################################################################ # # 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 ) ) ) )
# Created by Gershon Elber, Jan. 89 # view_mat1 = irit.GetViewMatrix() * irit.sc(0.2) save_res = irit.GetResolution() irit.SetResolution(8) # ############################################################################ cone1 = irit.con2((0, 0, (-1)), (0, 0, 4), 2, 1, 3) cylin1 = irit.cylin((0, 3, 0), (0, (-6), 2), 0.7, 3) a = (cone1 + cylin1) irit.free(cylin1) irit.free(cone1) irit.interact(irit.list(view_mat1, a)) # # Currently variables can not be introduced in a loop (except the iteration # variable), so we prepare all variables in advance. # cntrs = irit.nil() intrcrv = irit.iritstate("intercrv", irit.GenIntObject(1)) i = (-0.9) while (i <= 2.9): p = irit.circpoly((0, 0, 1), (0, 0, i), 6) c = a * p irit.viewobj(c) irit.snoc(c, cntrs) i = i + 0.1