def cntrpolys( pls, zmin, dz, zmax ): retval = irit.nil( ) intrcrv = irit.iritstate( "intercrv", irit.GenIntObject(1 )) z = zmin while ( z <= zmax ): p = irit.circpoly( ( 0, 0, 1 ), ( 0, 0, z ), 6 ) irit.snoc( pls * p, retval ) z = z + dz intrcrv = irit.iritstate( "intercrv", intrcrv ) irit.color( retval, irit.YELLOW ) return retval
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)
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
# import math import irit # # # Some routines to test bezier curves/surfaces. # # # Set display to on to view some results, off to view nothing. # display = 1 save_res = irit.GetResolution() dlevel = irit.iritstate("dumplevel", irit.GenIntObject(255)) if (irit.GetMachine() == irit.MSDOS): irit.SetResolution(5) else: irit.SetResolution(10) s45 = math.sin(math.pi / 4) cbzr = irit.list( irit.ctlpt( irit.P2, 1, 1, 0 ), \ irit.ctlpt( irit.P2, s45, s45, s45 ), \ irit.ctlpt( irit.P2, 1, 0, 1 ) ) sbzr = irit.list( irit.list( irit.ctlpt( irit.E3, 0.1, 0, 1 ), \ irit.ctlpt( irit.E3, 0.3, 1, 0 ), \ irit.ctlpt( irit.E3, 0, 2, 1 ) ), irit.list( \ irit.ctlpt( irit.E3, 1.1, 0, 0 ), \
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Self and partial intersections' examples # # Gershon Elber, October 1995. # save_mat = irit.GetViewMatrix() save_res = irit.GetResolution() ri = irit.iritstate("randominit", irit.GenRealObject(1960)) # Seed-initiate the randomizer, irit.free(ri) # ############################################################################ def evalantipodalptsoncrv(crv): aps = irit.antipodal(crv, 0.001, (-1e-010)) 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)
irit.free(saddl2) # # Monkey saddle. # monkey = coercetobezsrf(irit.mvexplicit(2, "a^3 - 3 * a * b^2"), (-1), 1, (-1), 1) irit.color(monkey, irit.YELLOW) pln = irit.ruledsrf( irit.ctlpt( irit.E3, 0, (-5 ), (-5 ) ) + \ irit.ctlpt( irit.E3, 0, (-5 ), 5 ), \ irit.ctlpt( irit.E3, 0, 5, (-5 ) ) + \ irit.ctlpt( irit.E3, 0, 5, 5 ) ) icrv = irit.iritstate("intercrv", irit.GenRealObject(1)) irit.SetResolution(60) intcrvs = irit.list(monkey * pln * irit.rz(90), monkey * pln * irit.rz(90 + 60), monkey * pln * irit.rz(90 + 120)) irit.adwidth(intcrvs, 2) irit.color(intcrvs, irit.RED) 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)
# # # Interpolation/least square approximation of curves and surfaces. # # gersktch.gershon Elber, March 1994 # # ############################################################################ save_mat = irit.GetViewMatrix() irit.SetViewMatrix(irit.scale((0.6, 0.6, 0.6))) irit.viewobj(irit.GetViewMatrix()) irit.viewstate("polyaprx", 1) ri = irit.iritstate("randominit", irit.GenIntObject(1964)) # Seed-initiate the randomizer, irit.free(ri) # ############################################################################ len = 1 numpts = 50 pl1 = irit.nil() i = 1 while (i <= numpts): pt = irit.ctlpt(irit.E3, (irit.random((-3.5), 3.5) + len * i * 2) / numpts, (irit.random((-3.5), 3.5) + len * i * (-5)) / numpts, (irit.random((-3.5), 3.5) + len * i * math.pi) / numpts) irit.snoc(pt, pl1)
# Some routines to test the multi variate library. # # We mainly compare against the similar tools for curves/surfaces/trivariates. # # Gershon Elber, July 1997. # def printtest(title, res1, res2): irit.printf("%9s test - %d\n", irit.list(title, res1 == res2)) if (res1 != res2): irit.pause() # Faster product using Bezier decomposition. iprod = irit.iritstate("bspprodmethod", irit.GenRealObject(0)) echosrc = irit.iritstate("echosource", irit.GenRealObject(0)) dlevel = irit.iritstate("dumplevel", irit.GenRealObject(256 + 1)) c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0.5, 2 ), \ irit.ctlpt( irit.E3, 0, 0, 2 ), \ irit.ctlpt( irit.E3, 1, (-1 ), 2 ), \ irit.ctlpt( irit.E3, 1, 1, 2 ) ) ) irit.attrib(c1, "width", irit.GenRealObject(0.02)) irit.attrib(c1, "color", irit.GenRealObject(14)) c2 = irit.pcircle((1, 2, 3), 1.25) c2 = irit.creparam(c2, 0, 1) irit.attrib(c2, "width", irit.GenRealObject(0.02)) irit.attrib(c2, "color", irit.GenRealObject(15))
# Created by Gershon Elber, Apr 90 # t = irit.time(1) save_mat = irit.GetViewMatrix() irit.SetViewMatrix(irit.GetViewMatrix() * irit.scale((0.5, 0.5, 0.5))) save_res = irit.GetResolution() # # Try it with coplanar false for fun. # # irit.iritstate( "coplanar", false ); # psort = irit.iritstate("polysort", irit.GenRealObject(0)) t1 = irit.box(((-2), (-0.35), 0), 4, 0.7, 0.4) irit.SetResolution(80) t2 = irit.cylin((0, 0, 0), (0, 0, 0.4), 1.4, 3) s1 = t1 * t2 irit.free(t1) irit.free(t2) irit.view(irit.list(irit.GetViewMatrix(), s1), irit.ON) irit.SetResolution(40) t3 = irit.cylin((0, 0, 0), (0, 0, 0.4), 0.9, 3) s2 = (s1 + t3) irit.free(t3) irit.free(s1) irit.view(s2, irit.ON)
import math import irit # # # This is the DtoP custom designed Gearbox 'EndPlate' # Designed by Andy Bray <*****@*****.**> 1992 # save_mat = irit.GetViewMatrix() irit.SetViewMatrix( irit.GetViewMatrix() * irit.scale( ( 0.13, 0.13, 0.13 ) )) save_res = irit.GetResolution() cplnr = irit.iritstate( "coplanar", irit.GenIntObject(1) ) # Try 'irit.iritstate("coplanar", false);' box1 = irit.box( ( 0, 0, 1 ), 7.8, 10.4, 1.6 ) # If the line below is uncommented, then the file fails at the first operation # most other resolutions work without problem. This could be because # coincidentally something approximates colinear when it is not, but in that # case a resultion of 50 or 20 might do it, and do not. # resolution = 10; hole1 = irit.cylin( ( 1, 1, 2.601 ), ( 0, 0, (-1.6015 ) ), 0.3, 3 ) solid1 = ( box1 - hole1 ) irit.free( hole1 ) irit.free( box1 ) irit.view( irit.list( irit.GetViewMatrix(), solid1 ), irit.ON ) # resolution = 20;
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # The infamous Teapot data as four B-spline surfaces. Herein, we compute # the Gaussian, Mean, and Curvature bounds as scalar fields attached to the # geometry. Saved data can be rendered and visualized using 'irender'. # echosrc = irit.iritstate("echosource", irit.GenRealObject(0)) body = irit.sbspline( 4, 4, irit.list( irit.list( irit.ctlpt( irit.E3, 1.4, 2.25, 0 ), \ irit.ctlpt( irit.E3, 1.3375, 2.38125, 0 ), \ irit.ctlpt( irit.E3, 1.4375, 2.38125, 0 ), \ irit.ctlpt( irit.E3, 1.5, 2.25, 0 ), \ irit.ctlpt( irit.E3, 1.75, 1.725, 0 ), \ irit.ctlpt( irit.E3, 2, 1.2, 0 ), \ irit.ctlpt( irit.E3, 2, 0.75, 0 ), \ irit.ctlpt( irit.E3, 2, 0.3, 0 ), \ irit.ctlpt( irit.E3, 1.5, 0.075, 0 ), \ irit.ctlpt( irit.E3, 1.5, 0, 0 ) ), irit.list( \ irit.ctlpt( irit.E3, 1.4, 2.25, 0.784 ), \ irit.ctlpt( irit.E3, 1.3375, 2.38125, 0.749 ), \ irit.ctlpt( irit.E3, 1.4375, 2.38125, 0.805 ), \ irit.ctlpt( irit.E3, 1.5, 2.25, 0.84 ), \ irit.ctlpt( irit.E3, 1.75, 1.725, 0.98 ), \ irit.ctlpt( irit.E3, 2, 1.2, 1.12 ), \ irit.ctlpt( irit.E3, 2, 0.75, 1.12 ), \
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Simple demo of handling coplanar Booleans. # # Gershon Elber, July 1992. # save_res = irit.GetResolution() # irit.iritstate( "coplanar", true ); # Try 'iritstate( "coplanar", false );' intrcrv = irit.iritstate("intercrv", irit.GenIntObject(0)) irit.SetResolution(20) 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)))
dpth - 1, vu, vv ), subdivtodepth( irit.nth( tsrfs, 2 ) * \ irit.trans( irit.Fetch3TupleObject(v) ), dpth - 1, vu, vv ) ) else: retval = subdivtodepth(irit.nth(tsrfs, 1), dpth - 1, vu, vv) return retval # ############################################################################ dlevel = irit.iritstate("dumplevel", irit.GenRealObject(255)) spts = irit.list( irit.list( irit.ctlpt( irit.E3, 0.1, 0, 1 ), \ irit.ctlpt( irit.E3, 0.3, 1, 0 ), \ irit.ctlpt( irit.E3, 0, 2, 1 ) ), irit.list( \ irit.ctlpt( irit.E3, 1.1, 0, 0 ), \ irit.ctlpt( irit.E3, 1.3, 1.5, 2 ), \ irit.ctlpt( irit.E3, 1, 2.1, 0 ) ), irit.list( \ irit.ctlpt( irit.E3, 2.1, 0, 2 ), \ irit.ctlpt( irit.E3, 2.3, 1, 0 ), \ irit.ctlpt( irit.E3, 2, 2, 2 ) ), irit.list( \ irit.ctlpt( irit.E3, 3.1, 0, 0 ), \ irit.ctlpt( irit.E3, 3.3, 1.5, 2 ), \ irit.ctlpt( irit.E3, 3, 2.1, 0 ) ), irit.list( \ irit.ctlpt( irit.E3, 4.1, 0, 1 ), \ irit.ctlpt( irit.E3, 4.3, 1, 0 ), \
# # Some routines to test the multi variate library. # # We mainly compare against the similar tools for curves/surfaces/trivariates. # # Gershon Elber, July 1997. # def printtest(title, res1, res2): irit.printf("%9s test - %d\n", irit.list(title, res1 == res2)) if (res1 != res2): irit.pause() echosrc = irit.iritstate("echosource", irit.GenRealObject(0)) dlevel = irit.iritstate("dumplevel", irit.GenRealObject(256 + 1)) cmpeps = irit.iritstate("cmpobjeps", irit.GenRealObject(1e-010)) c = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0.5, 2 ), \ irit.ctlpt( irit.E3, 0, 0, 2 ), \ irit.ctlpt( irit.E3, 1, (-1 ), 2 ), \ irit.ctlpt( irit.E3, 1, 1, 2 ) ) ) irit.attrib(c, "width", irit.GenRealObject(0.02)) irit.attrib(c, "color", irit.GenRealObject(14)) mc = irit.mbezier( irit.list( 4 ), irit.list( irit.ctlpt( irit.E3, (-1 ), 0.5, 2 ), \ irit.ctlpt( irit.E3, 0, 0, 2 ), \ irit.ctlpt( irit.E3, 1, (-1 ), 2 ), \ irit.ctlpt( irit.E3, 1, 1, 2 ) ) )
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Some simple tests for blossom evaluations over Beziers and Bsplines. # # Gershon Elber, February 1999 # echosrc = irit.iritstate("echosource", irit.GenIntObject(0)) dumplvl = irit.iritstate("dumplevel", irit.GenIntObject(256 + 1)) oldeps = irit.iritstate("cmpobjeps", irit.GenRealObject(1e-010)) def printtest(title, ctlstring, reslist): irit.printf(ctlstring, irit.list(title) + reslist) # ############################################################################ c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 1.7, 0 ), \ irit.ctlpt( irit.E2, 0.7, 0.7 ), \ irit.ctlpt( irit.E2, 1.7, 0.3 ), \ irit.ctlpt( irit.E2, 1.5, 0.8 ), \ irit.ctlpt( irit.E2, 1.6, 1 ) ) ) printtest( "bezier test - ", "\n%40s %d %d %d %d %d, %d %d %d %d, %d %d %d\n",
# # # Examples for trimming offsets with the TOFFSET command. # # Gershon ELber, Nov 2002 # save_mat = irit.GetViewMatrix() irit.SetViewMatrix( irit.sc( 0.4 ) * irit.ty( (-0.8 ) )) irit.viewobj( irit.GetViewMatrix() ) # Faster product using Bezier Decomposition oldip = irit.iritstate( "bspprodmethod", irit.GenRealObject(0) ) irit.viewstate( "pllnaprx", 1 ) irit.viewstate( "pllnaprx", 1 ) # ############################################################################ c0 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-1 ), 3 ), \ irit.ctlpt( irit.E2, (-0.3 ), 0 ), \ irit.ctlpt( irit.E2, 0.3, 0 ), \ irit.ctlpt( irit.E2, 1, 3 ) ), irit.list( irit.KV_OPEN ) ) irit.view( c0, irit.ON ) i = (-5 ) while ( i <= 5 ): if ( i != 0 ): ofst = 0.15 * i
# import math import irit # # # Some routines to test the is-geometry type operators. # # Gershon Elber, December 1998 # # # Set states. # # Faster product using Bezier decomposition. intrpprod = irit.iritstate("bspprodmethod", irit.GenRealObject(0)) echosrc = irit.iritstate("echosource", irit.GenRealObject(0)) def printtest(title, res, val): aaa = int(irit.FetchRealObject(irit.nth(res, 1)) == val) print title + " test - " + str(aaa) # # Line # line = irit.circle((0.1, 0.7, 3), math.pi) printtest("line", irit.isgeom(line, irit.GEOM_LINEAR, 1e-010), 0) line = ( irit.ctlpt( irit.E3, (-2 ), 10, (-5 ) ) + \
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Examples of kernel approximation of freeform closed surface objects. # # Gershon Elber, Oct 2002 # oldcnvxpl2vrtices = irit.iritstate("cnvxpl2vrtcs", irit.GenRealObject(0)) # ############################################################################ c = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0, 0.15 ), \ irit.ctlpt( irit.E2, 0.25, 0.15 ), \ irit.ctlpt( irit.E2, 0.52, 0.4 ), \ irit.ctlpt( irit.E2, 0.85, 0.3 ), \ irit.ctlpt( irit.E2, 0.85, 0 ) ), irit.list( irit.KV_OPEN ) ) c = ((-c) + c * irit.sx((-1))) srf8a = irit.surfprev(c * irit.ry(90)) * irit.sx(0.9) * irit.homomat( irit.list(irit.list(1, 0, 0.2, 0), irit.list(0, 1, 0, 0), irit.list(0, 0, 1, 0), irit.list(0, 0, 0, 1))) * irit.homomat( irit.list(irit.list(1, 0, 0, 0), irit.list(0, 1, 0.2, 0), irit.list(0, 0, 1, 0), irit.list(0, 0, 0, 1))) irit.color(srf8a, irit.YELLOW) irit.awidth(srf8a, 0.001)
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.save( "cone-cyl", irit.list(a1, a2 * irit.tx(5), a3 * irit.tx(10), a4 * irit.tx(15), a5 * irit.tx(20))) irit.SetResolution(save_res) irit.SetViewMatrix(save_mat)
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Hausdorff distances between freeforms # # Gershon Elber, October 2006. # # ############################################################################ ri = irit.iritstate( "randominit", irit.GenIntObject(1960 )) # Seed-initiate the randomizer, irit.free( ri ) glblres = irit.nil( ) glbltransx = -5 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 ):
# # Some examples of proper piecewise linear sampling in gpolyline. # save_res = irit.GetResolution() save_mat = irit.GetViewMatrix() irit.SetViewMatrix(irit.rotx(0)) irit.viewobj(irit.GetViewMatrix()) irit.SetViewMatrix(save_mat) irit.viewstate("dblbuffer", 1) irit.viewstate("depthcue", 1) dlevel = irit.iritstate("dumplevel", irit.GenIntObject(255)) # Faster product using Bezier decomposition. iprod = irit.iritstate("bspprodmethod", irit.GenIntObject(0)) # ############################################################################ pl2 = irit.nil() x = 0 while (x <= 5): irit.snoc( irit.point(math.cos(x * math.pi / 10), math.sin(x * 3.14159 / 10), 0), pl2) x = x + 1 crv1 = irit.cinterp(pl2, 4, 4, irit.GenRealObject(irit.PARAM_UNIFORM), 0)
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # A cube from a chain of 27 smaller cubes forming a 3 by 3 by 3 set. # # Gershon Elber, May 1998 # ri = irit.iritstate("randominit", irit.GenRealObject(1964)) # Seed-initiate the randomizer, irit.free(ri) size = 0.25 v1 = (0, 0, 0) v2 = (size * 3, 0, 0) v3 = (size * 3, size * 3, 0) v4 = (0, size * 3, 0) plaux = irit.poly(irit.list(v1, v2, v3, v4, v1), irit.TRUE) cubebbox = irit.list(plaux, plaux * irit.tz(size * 3), plaux * irit.rx(90), plaux * irit.rx(90) * irit.ty(size * 3), plaux * irit.ry((-90)), plaux * irit.ry((-90)) * irit.tx(size * 3)) irit.attrib(cubebbox, "rgb", irit.GenStrObject("255, 255, 255")) irit.free(plaux)
# ############################################################################ # # Warping teapot using FFD trivariates. # # Gershon Elber, Sep 1999. # save_mat2 = irit.GetViewMatrix() irit.SetViewMatrix( irit.rotx( 0 )) # # Get a model of a teapot. # echosrc2 = irit.iritstate( "echosource", irit.GenRealObject(0) ) def interact( none ): irit.viewclear( ) import teapot teapotorig = irit.load( "teapot" ) def interact( none ): irit.viewdclear( ) irit.viewobj( none ) irit.pause( ) echosrc2 = irit.iritstate( "echosource", echosrc2 ) irit.free( echosrc2 ) # # Define the trivarate warping function.
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Display the Gamma-Kernel surfaces. gershon Elber, September 2003. # ri = irit.iritstate( "randominit", irit.GenIntObject(1964 )) # Seed-initiate the randomizer, irit.free( ri ) def cntrpolys( pls, zmin, dz, zmax ): retval = irit.nil( ) intrcrv = irit.iritstate( "intercrv", irit.GenIntObject(1 )) z = zmin while ( z <= zmax ): p = irit.circpoly( ( 0, 0, 1 ), ( 0, 0, z ), 6 ) irit.snoc( pls * p, retval ) z = z + dz intrcrv = irit.iritstate( "intercrv", intrcrv ) irit.color( retval, irit.YELLOW ) return retval def setrandomcolor( obj ): irit.attrib( obj, "rgb", irit.GenStrObject(str(int( irit.random( 100, 255 ) )) + "," + str(int( irit.random( 100, 255 ) )) + "," + str(int( irit.random( 100, 255 ) ) ))) retval = obj return retval
# # Some examples of 3d alpha-sector computations of 3-space freeform curves. # # Gershon Elber, October 1998. # # # Set states. # 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):
#This is an IRIT script and as such requires both math and irit import: # import math import irit import time import os # irit.iritstate("DoGraphics", irit.GenRealObject(0)) # # Test file to include ALL scripts without any pause. # # def empty_function(): pass irit.pause = empty_function def print_time(file_name, a, b): total_time = b - a print "************* Execution Time for %s is %f ******************\\n" % ( file_name, total_time) def work_function(file_name): a = time.time()
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.save( "box-box", irit.list(a1, a2 * irit.tx(10), a3 * irit.tx(20), a4 * irit.tx(30), a5 * irit.tx(40))) irit.SetViewMatrix(save_mat) irit.free(a1) irit.free(a2) irit.free(a3)
# # Display of all primitives of the system: # BOX, GBOX, CONE, CYLIN, SPHERE, TORUS # # Created by Gershon Elber, Dec. 88 # save_mat = irit.GetViewMatrix() irit.SetViewMatrix(irit.GetViewMatrix() * irit.scale((0.5, 0.5, 0.5))) axes15 = irit.GetAxes() * irit.scale((1.5, 1.5, 1.5)) # # Create primitive as approximated integral polynomial surfaces. # save_prim_rat_srfs = irit.iritstate("primratsrfs", irit.GenRealObject(0)) cyls = irit.list(irit.cylin(((-0.8), 0, 0), ((-0.5), 0.3, 0.3), 0.3, 0), irit.cylin((0.8, 0, 0), (0.8, 0, 0), 0.3, 1), irit.cylin((0, (-0.8), 0), (0.1, (-0.5), 0.2), 0.3, 3), irit.cylin((0, 0.8, 0), (0, 0.8, 0), 0.3, 2), irit.cylin((0, 0, (-0.8)), (0.4, 0.2, (-0.5)), 0.3, 3), irit.cylin((0, 0, 0.8), (0, 0, 0.8), 0.3, 1)) irit.color(cyls, irit.RED) cones = irit.list(irit.cone(((-0.5), 0, 0), ((-0.5), 0, 0), 0.5, 0), irit.cone((0.5, 0, 0), (0.5, 0, 0), 0.5, 1), irit.cone((0, (-0.5), 0), (0, (-0.5), 0), 0.5, 1), irit.cone((0, 0.5, 0), (0, 0.5, 0), 0.5, 0), irit.cone((0, 0, (-0.5)), (0, 0, (-0.5)), 0.5, 1), irit.cone((0, 0, 0.5), (0, 0, 0.5), 0.5, 1))
# save_mat = irit.GetViewMatrix() irit.SetViewMatrix( irit.roty( 180 )) irit.viewobj( irit.GetViewMatrix() ) irit.SetViewMatrix( save_mat) irit.viewstate( "polyaprx", 1 ) irit.viewstate( "widthlines", 1 ) # # Animation speed. The lower this number, the faster the animations will be, # skipping more frames. # speed = 0.25 echosrc = irit.iritstate( "echosource", irit.GenIntObject(0 )) # ########################################################################### locally = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.62705, (-0.418086 ) ), \ irit.ctlpt( irit.E2, 0.593439, (-0.416962 ) ), \ irit.ctlpt( irit.E2, 0.414706, (-0.366445 ) ), \ irit.ctlpt( irit.E2, 0.362948, (-0.332803 ) ), \ irit.ctlpt( irit.E2, 0.33727, (-0.293801 ) ), \ irit.ctlpt( irit.E2, 0.288731, (-0.146024 ) ), \ irit.ctlpt( irit.E2, 0.292251, (-0.0630604 ) ), \ irit.ctlpt( irit.E2, 0.326431, (-0.0942595 ) ), \ irit.ctlpt( irit.E2, 0.379121, (-0.513736 ) ), \ irit.ctlpt( irit.E2, 0.324176, (-0.348901 ) ), \ irit.ctlpt( irit.E2, 0.247253, (-0.337912 ) ), \ irit.ctlpt( irit.E2, 0.285714, (-0.32967 ) ), \ irit.ctlpt( irit.E2, 0.339394, (-0.378232 ) ), \
# # Some tests for symbolic computation. # # Gershon Elber, Nov. 1992 # # # Set display to on to view some results, off to view nothing. # display = 1 # # The symbolic computation below is faster this way. # iprod = irit.iritstate("bspprodmethod", irit.GenRealObject(0)) # # Control the surface to polygons subdivison resolution, and isolines gen. # save_res = irit.GetResolution() irit.SetResolution(20) if (irit.GetMachine() == irit.MSDOS): irit.SetResolution(5) s45 = math.sin(math.pi / 4) # # marker function for curves...