# # # Intersection of cone and a cylinder: # Try this one with resolution equal 20 - slower, but much nicer! # # 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):
trns = irit.trans(((-7.75), 0, (-7.45))) irit.attrib(stopper, "animation", irit.list(trns, rot_y, trns ^ (-1))) irit.free(rot_y) irit.free(trns) # # Top round. # topround = irit.poly( lj8samplecurve( irit.cbezier( irit.list( irit.ctlpt( irit.E3, 0, (-0.7 ), 7.5 ), \ irit.ctlpt( irit.E3, 0, 2.5, 8 ), \ irit.ctlpt( irit.E3, 0, 5.7, 7.5 ) ) ), 10 ) + irit.list( ( 0, 5.7, 7.2 ), ( 0, 5.2, 7.2 ), irit.point( 0, 4.9, 6.8 ), irit.point( 0, 4.9, 6 ), irit.point( 0, 0.1, 6 ), irit.point( 0, 0.1, 6.3 ), irit.point( 0, (-0.2 ), 6.3 ), irit.point( 0, (-0.7 ), 7.1 ) ), 0 ) topround = irit.extrude(topround, (2, 0, 0), 3) * irit.tx(0.001) irit.SetResolution(4) screen = irit.con2((0, 0, 0), (0, 0, (-0.15)), 0.3, 0.2, 3) * irit.rz(45) topround = (topround - screen * irit.rx(5.5) * irit.sx(3) * irit.tx(1) * irit.tz(7.65)) irit.SetResolution(20) screen = irit.ruledsrf( irit.ctlpt( irit.E3, 0.1414, 0.1414, (-0.14 ) ) + \ irit.ctlpt( irit.E3, (-0.1414 ), 0.1414, (-0.14 ) ), \ irit.ctlpt( irit.E3, 0.1414, (-0.1414 ), (-0.14 ) ) + \ irit.ctlpt( irit.E3, (-0.1414 ), (-0.1414 ), (-0.14 ) ) ) * irit.rx( 5.5 ) * irit.sx( 3 ) * irit.tx( 1 ) * irit.tz( 7.65 ) irit.attrib(screen, "rgb", irit.GenStrObject("20,100,20")) tmpbody = irit.box((1, 0.75, 6.5), 2, 3.5, 0.15) z = 7.2 while (z <= 7.5): tmpbody = tmpbody ^ irit.box(((-0.1), 1, z), 0.2, 3, 0.05) z = z + 0.1
irit.SetResolution(20) x1 = irit.triangl(irit.cylin((1, 2, 3), (0, 0, 1), 0.3, 0), 1) x1 = irit.maxedgelen(x1, 0.3) irit.SetResolution(50) x2 = irit.triangl(irit.cylin(((-1.1), 3.7, 0.1), (1, 2, 1), 0.23, 0), 1) x2 = irit.maxedgelen(x2, 0.3) cylfit = irit.list(irit.fitpmodel(x1, 2, 1e-006, 100), irit.fitpmodel(x2, 2, 0.001, 100)) # # A cone: returned is (Error, Xapex, Yapex, Zapex, angle, # Xdir, Ydir, Zdir) # x1 = irit.maxedgelen( irit.triangl( irit.con2( ( 0, 0, 0 ), ( 0, 0, 1 ), 1, 2, 0 ),\ 1 ), 0.3 ) x2 = irit.maxedgelen( irit.triangl( irit.con2( ( (-1 ), 1.2, (-0.5 ) ), ( 2, 1, 1 ), 0.5, 0, 0 ),\ 1 ), 0.3 ) conefit = irit.list(irit.fitpmodel(x1, 4, 0.001, 30), irit.fitpmodel(x2, 4, 1e-005, 30)) # # Planar fit: return is (Error, A, B, C, D) # x1 = irit.triangl(irit.gpolygon(irit.planesrf(0, 0, 1, 1), 1), 1) x1 = irit.maxedgelen(x1, 0.2) x2 = x1 * irit.rx(45)
b = irit.box( ( (-3 ), (-2 ), (-1 ) ), 6, 4, 2 ) c = irit.cylin( ( 0, 0, (-4 ) ), ( 0, 0, 8 ), 1, 3 ) save_view = irit.GetViewMatrix() irit.SetViewMatrix( irit.GetViewMatrix() * irit.scale( ( 0.1, 0.1, 0.1 ) )) a1 = ( b + c ) irit.interact( irit.list( irit.GetViewMatrix(), a1 ) ) a2 = b * c irit.interact( a2 ) a3 = ( b - c ) irit.interact( a3 ) c = ( irit.con2( ( 0, 0, 0 ), ( 0, 0, 28 ), 17, 12, 3 ) - irit.con2( ( 0, 0, (-1 ) ), ( 0, 0, 30 ), 14, 9, 3 ) ) a4 = ( c - irit.box( ( (-50 ), (-50 ), (-1 ) ), 100, 100, 28 ) ) irit.save( "closloop", irit.list( a1, a2, a3, a4 ) ) # ############################################################################ irit.SetViewMatrix( save_view) irit.free(b) irit.free(c) irit.free(a1) irit.free(a2) irit.free(a3) irit.free(a4)
# same topology. # # Gershon Elber, July 1998. # # # Animation speed. The lower this number, the faster the animations will be, # skipping more frames. # speed = 0.5 output = irit.nil() # ########################################################################### pl1 = irit.con2((0, (-0.5), (-0.5)), (0, 0, 1), 0.4, 0.1, 3) irit.color(pl1, irit.RED) pl2 = irit.con2((0, 0.5, 0), (0, 0, 1), 0.1, 0.4, 3) irit.color(pl2, irit.MAGENTA) i = 0 while (i <= 300 * speed): c = irit.pmorph(pl1, pl2, i / (300.0 * speed)) irit.color(c, irit.YELLOW) irit.view(irit.list(pl1, pl2, c), irit.ON) i = i + 1 irit.snoc(irit.pmorph(pl1, pl2, 0.5) * irit.tx((-4)), output) irit.pause() # ###########################################################################