def computetopoaspectgraph(s, spc): ag = irit.saspctgrph(s) irit.color(ag, irit.YELLOW) irit.adwidth(ag, 3) sp = irit.spheresrf(1) irit.color(sp, irit.RED) s1 = s * irit.tx(0) irit.color(s1, irit.GREEN) irit.adwidth(s1, 2) retval = irit.list( irit.list(ag, sp, irit.GetAxes()) * irit.sc(0.6) * irit.tx(spc), irit.list(s1, irit.GetAxes()) * irit.tx((-spc))) return retval
irit.attrib(c2, "width", irit.GenRealObject(0.02)) irit.attrib(c2, "color", irit.GenRealObject(15)) s1 = irit.sbezier( irit.list( irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \ irit.ctlpt( irit.E3, 0.25, 1, 0.5 ), \ irit.ctlpt( irit.E3, 0.5, 0.25, 1 ) ), irit.list( \ irit.ctlpt( irit.E3, 0.5, (-1 ), 0 ), \ irit.ctlpt( irit.E3, 0.75, 0.25, 0.5 ), \ irit.ctlpt( irit.E3, 1, (-0.5 ), 1 ) ), irit.list( \ irit.ctlpt( irit.E3, 1, 0, 0 ), \ irit.ctlpt( irit.E3, 1.25, 1, 0.5 ), \ irit.ctlpt( irit.E3, 1.3, 0.25, 1 ) ) ) ) irit.attrib(s1, "color", irit.GenRealObject(7)) irit.attrib(s1, "rgb", irit.GenStrObject("244,164,96")) s2 = irit.spheresrf(1.25) # s2 = sregion( sregion( sphereSrf( 1.25 ), row, 0, 2 ), col, 0, 4 ); s2 = irit.sreparam( irit.sreparam( s2, irit.ROW, 0, 1 ), irit.COL, 0,\ 1 ) irit.attrib(s2, "color", irit.GenRealObject(7)) irit.attrib(s2, "rgb", irit.GenStrObject("164,244,96")) t1 = irit.tbezier( irit.list( irit.list( irit.list( irit.ctlpt( irit.E3, (-0.69 ), 0.31, (-0.6 ) ), \ irit.ctlpt( irit.E3, (-0.68 ), 0.35, (-0.39 ) ), \ irit.ctlpt( irit.E3, (-0.67 ), 0.31, (-0.18 ) ) ), irit.list( \ irit.ctlpt( irit.E3, (-0.66 ), 0.63, (-0.65 ) ), \ irit.ctlpt( irit.E3, (-0.75 ), 0.67, (-0.23 ) ), \ irit.ctlpt( irit.E3, (-0.64 ), 0.63, (-0.11 ) ) ), irit.list( \ irit.ctlpt( irit.E3, (-0.63 ), 0.84, (-0.65 ) ), \ irit.ctlpt( irit.E3, (-0.62 ), 0.96, (-0.36 ) ), \ irit.ctlpt( irit.E3, (-0.61 ), 0.88, (-0.17 ) ) ) ), irit.list( irit.list( \
irit.ctlpt( irit.E3, 1, 1, 0 ) ) printtest("sphere", irit.isgeom(spr, irit.GEOM_SPHERICAL, 1e-010), 0) # too slow for regular testing. #spr = coerce( sregion( sregion( sphereSrf( 1 ), row, 0.1, 1 ), col, 0, 1 ), # BEZIER_TYPE ) * sc( 0.99 ) * tx( 1.1 ) * ty( 2.2 ) * tz( -3.3 ); #PrintTest( "Sphere", isgeom( spr, irit.GEOM_SPHERICAL, 1e-10 ), 1 ); # irit.free(spr) # # Ruled surface. # printtest("ruled", irit.isgeom(irit.spheresrf(1), 13, 1e-010), 0) arc3 = irit.arc((0, 0, 1), (0.5, (-0.2), 1), (1, 0, 1)) ruled = irit.ruledsrf( arc3, irit.ctlpt( irit.E2, 0, 0 ) + \ irit.ctlpt( irit.E2, 1, 0 ) ) irit.free(arc3) printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2) printtest("ruled", irit.isgeom(irit.sreverse(ruled), irit.GEOM_RULED_SRF, 1e-010), 1) circ = irit.circle((0, 0, 0), 0.25) ruled = irit.ruledsrf(circ, circ * irit.rx(10) * irit.sc(0.5) * irit.tz(1)) printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2) printtest("ruled", irit.isgeom(irit.sreverse(ruled), irit.GEOM_RULED_SRF, 1e-010), 1)
irit.interact(all) irit.save("duality1", all) irit.free(pt1) irit.free(pt2) irit.free(mov_xyz1) irit.free(mov_xyz2) irit.free(all) # ############################################################################ # # A sphere centered at the origin # s = irit.spheresrf(1.1) d = irit.duality(s) irit.color(d, irit.YELLOW) view_mat1 = irit.GetViewMatrix() * irit.sc(0.5) irit.interact(irit.list(s, d, irit.GetAxes(), view_mat1)) # # A sphere tangent to the origin # s = irit.spheresrf(1) * irit.tx(1) d = irit.duality(s) irit.color(d, irit.YELLOW) view_mat1 = irit.GetViewMatrix() * irit.sc(0.5) * irit.tx(0.3) * irit.ty(0.3)
while (z >= (-1)): pt = irit.point(0, 0, z) irit.adwidth(pt, 3) irit.color(pt, irit.YELLOW) bisectsrf = irit.sbisector(s1, irit.Fetch3TupleObject(pt)) irit.color(bisectsrf, irit.GREEN) irit.view(irit.list(s1, pt, bisectsrf), irit.ON) z = z + (-0.01) irit.pause() # ############################################################################ # # A sphere--sphere/sphere-pt bisector # s = irit.spheresrf(1) irit.color(s, irit.RED) s1 = irit.sregion( irit.sregion( s, irit.ROW, 0.5, 1.5 ), irit.COL, 2.5,\ 3.5 ) s2 = irit.sregion( irit.sregion( s, irit.ROW, 0.001, 1.999 ), irit.COL, 0.001,\ 1.999 ) pt = (0, 2, 0) irit.adwidth(irit.point(pt[0], pt[1], pt[2]), 3) irit.color(irit.point(pt[0], pt[1], pt[2]), irit.YELLOW) bisectsrf1 = irit.sbisector(s1, pt) bisectsrf2 = irit.sbisector(s2, pt) irit.color(bisectsrf1, irit.GREEN) irit.color(bisectsrf2, irit.GREEN)
irit.trans( irit.Fetch3TupleObject(irit.coerce( p, irit.VECTOR_TYPE ) + n * r1 )) c2 = c * \ irit.sc( r2 ) * \ irit.rotz2v( irit.Fetch3TupleObject(d2) ) * \ irit.trans( irit.Fetch3TupleObject(irit.coerce( p, irit.VECTOR_TYPE ) + n * r2) ) retval = irit.list( p, c1, c2, p + irit.coerce(irit.coerce(p, irit.POINT_TYPE) + v1, irit.E3), p + irit.coerce(irit.coerce(p, irit.POINT_TYPE) + v2, irit.E3), positionasymptotes(srf, u, v)) irit.adwidth(retval, 2) irit.color(retval, irit.YELLOW) return retval spr = irit.spheresrf(0.5) * irit.sx(0.5) * irit.tx(2) cyl = irit.cylinsrf(1, 1) * irit.sc(0.5) trs = irit.torussrf(1, 0.3) * irit.sc(0.5) * irit.tx((-2)) all = irit.list(spr, cyl, trs, positioncurvature(trs, 0.5, 0.5), positioncurvature(trs, 2.2, 2.8), positioncurvature(trs, 2.8, 1.8), positioncurvature(spr, 0.5, 0.5), positioncurvature(spr, 1, 1), positioncurvature(cyl, 1.5, 1.25), positioncurvature(cyl, 2, 1.5)) irit.interact(all) irit.save("scrvtrev", all) irit.free(all)
irit.save("nc_pckt5.itd", irit.list(cnc_ltrs.cnc, tpath)) irit.save("nc_pckt5.nc", tpath) irit.interact(irit.load("nc_pckt5.nc")) irit.free(cnc_ltrs.cnc) # ############################################################################ # # 3D contouring: A Sphere # # Add points to control the bounding box in XY. # These points have no other effect. # sp = irit.list(irit.spheresrf(5) * irit.rx(90), ((-6), (-6), 0), (6, 6, 0)) irit.color(sp, irit.RED) ofst = 0.25 baselevel = (-ofst) tpathspace = 0.2 ncpath = irit.nccntrpath(sp, ofst, baselevel, tpathspace, 0) irit.attrib(ncpath, "ncretractzlevel", irit.GenRealObject(10)) irit.attrib(ncpath, "ncmaxxybridgegap", irit.GenRealObject(0.5)) irit.interact( irit.list(irit.GetAxes() * irit.sc(6), sp, ncpath) * irit.sc(0.16)) irit.save("nc_spher.nc", ncpath)
# ############################################################################ # # Doing reflection circles! # # ############################################################################ s = irit.ruledsrf( irit.ctlpt( irit.E3, (-1 ), (-1 ), 0 ) + \ irit.ctlpt( irit.E3, 1, (-1 ), 0 ), \ irit.ctlpt( irit.E3, (-1 ), 1, 0 ) + \ irit.ctlpt( irit.E3, 1, 1, 0 ) ) * irit.rx( 90 ) s = irit.sraise(irit.sraise(s, irit.ROW, 3), irit.COL, 3) s = (-irit.seditpt(s, irit.ctlpt(irit.E3, 0, 1, 0), 1, 1)) irit.color(s, irit.MAGENTA) refsprs = irit.list( irit.spheresrf(1) * irit.sc(0.1), irit.spheresrf(1) * irit.sc(0.3), irit.spheresrf(1) * irit.sc(0.5), irit.spheresrf(1) * irit.sc(0.7)) * irit.ty(2) irit.color(refsprs, irit.GREEN) irit.SetResolution(10) rf = irit.rflctln(s, (1, 1, 0), irit.list(irit.point(0, 2, 0), irit.list(5, 25, 45, 65, 85)), 1) irit.color(rf, irit.GREEN) irit.adwidth(rf, 3) all = irit.list(irit.GetAxes() * irit.sc(1.1), rf, s, refsprs) irit.interact(all)
(1, 0.1, 0), (0.9, 0.1, 0), (0.9, 0, 0)) + irit.ctlpt(irit.E2, 0.2, 0)) crossply = irit.cnvrtcrvtopolygon(cross, 50, 0) cyl = irit.extrude(crossply, (0, 0, 1), 3) irit.interact(irit.list(cyl, crossply, cross)) irit.save("macros6", irit.list(cyl, crossply, cross)) irit.free(crossply) irit.free(cross) irit.free(cyl) s = irit.planesrf((-1), (-1), 1, 1) irit.interact(s) s1 = irit.spheresrf(0.4) irit.interact(s1) s2 = irit.spheresrf(0.7) irit.interact(s2) s3 = irit.torussrf(0.5, 0.4) irit.interact(s3) s4 = irit.torussrf(0.5, 0.05) irit.interact(s4) s5 = irit.cylinsrf(0.5, 0.4) irit.interact(s5) s6 = irit.cylinsrf(0.5, 0.05) irit.interact(s6) s7 = irit.conesrf(0.5, 0.4)
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # Demonstrates and adaptively reduced the degeneracies of Gimbell Lock. # # Gershon Elber, April 1995. # # # Extracts and displays a half a sphere. # s = irit.sregion(irit.spheresrf(1), irit.ROW, 0, 1) irit.viewobj(s) # # Computes a curve on a sphere between two spheical angles by interpolating # between the two angles a piecewise linear curve. # def computesphericalcrv(theta1, theta2, phi1, phi2): ptlist = irit.nil() t = 0 while (t <= 100): theta = (theta2 * t + theta1 * (100 - t)) * math.pi / (180 * 100) phi = (phi2 * t + phi1 * (100 - t)) * math.pi / (180 * 100) irit.snoc( irit.point(
irit.color(s1, irit.RED) irit.color(s2, irit.GREEN) i = testinter(s1, s2) all = irit.list(s1, s2, i) irit.interact(all) irit.save("ssi4", all) # # 5. Two biquadratic rational surface intersection - a cone and a sphere. # s1 = irit.conesrf(3, 0.7) s2 = irit.spheresrf(0.8) * irit.trans((0.35, 0.65, 1.3)) irit.color(s1, irit.RED) irit.color(s2, irit.GREEN) i = testinter(s1, s2) all = irit.list(s1, s2, i) irit.interact(all) irit.save("ssi5", all) # # 6. Same as 5, but the poles of the sphere are on the cone's surface. # s1 = irit.conesrf(3, 0.7)
def knight(s, clr): sec4 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.275, 0 ), \ irit.ctlpt( irit.E2, 0.275, 0.185 ), \ irit.ctlpt( irit.E2, 0.101, 0.442 ), \ irit.ctlpt( irit.E2, 0.051, 0.601 ), \ irit.ctlpt( irit.E2, 0.012, 0.909 ), \ irit.ctlpt( irit.E2, 0.153, 0.843 ), \ irit.ctlpt( irit.E2, 0.309, 0.789 ), \ irit.ctlpt( irit.E2, 0.34, 0.805 ), \ irit.ctlpt( irit.E2, 0.248, 0.879 ), \ irit.ctlpt( irit.E2, 0.359, 0.836 ), \ irit.ctlpt( irit.E2, 0.362, 0.88 ), \ irit.ctlpt( irit.E2, 0.218, 1.014 ), \ irit.ctlpt( irit.E2, 0.061, 1.133 ), \ irit.ctlpt( irit.E2, (-0.132 ), 1.135 ), \ irit.ctlpt( irit.E2, (-0.212 ), 1.062 ), \ irit.ctlpt( irit.E2, (-0.209 ), 0.923 ), \ irit.ctlpt( irit.E2, (-0.156 ), 0.852 ), \ irit.ctlpt( irit.E2, (-0.124 ), 0.578 ), \ irit.ctlpt( irit.E2, (-0.126 ), 0.463 ), \ irit.ctlpt( irit.E2, (-0.263 ), 0.211 ), \ irit.ctlpt( irit.E2, (-0.266 ), 0 ) ), irit.list( irit.KV_OPEN ) ) sec3 = irit.cbspline( 4, irit.list( \ irit.ctlpt( irit.E3, 0.275, 0, 0.143 ), \ irit.ctlpt( irit.E3, 0.275, 0.185, 0.143 ), \ irit.ctlpt( irit.E3, 0.101, 0.442, 0.07 ), \ irit.ctlpt( irit.E3, 0.051, 0.601, 0.05 ), \ irit.ctlpt( irit.E3, 0.012, 0.909, 0.04 ), \ irit.ctlpt( irit.E3, 0.153, 0.843, 0.031 ), \ irit.ctlpt( irit.E3, 0.218, 0.816, 0.03 ), \ irit.ctlpt( irit.E3, 0.319, 0.788, 0.032 ), \ irit.ctlpt( irit.E3, 0.336, 0.806, 0.035 ), \ irit.ctlpt( irit.E3, 0.246, 0.875, 0.034 ), \ irit.ctlpt( irit.E3, 0.393, 0.836, 0.036 ), \ irit.ctlpt( irit.E3, 0.274, 0.943, 0.037 ), \ irit.ctlpt( irit.E3, 0.0825, 1.08, 0.035 ), \ irit.ctlpt( irit.E3, (-0.0448 ), 1.15, 0.035 ), \ irit.ctlpt( irit.E3, (-0.157 ), 1.2, 0.035 ), \ irit.ctlpt( irit.E3, (-0.179 ), 1.12, 0.035 ), \ irit.ctlpt( irit.E3, (-0.213 ), 0.994, 0.035 ), \ irit.ctlpt( irit.E3, (-0.158 ), 0.795, 0.05 ), \ irit.ctlpt( irit.E3, (-0.0873 ), 0.483, 0.07 ), \ irit.ctlpt( irit.E3, (-0.263 ), 0.211, 0.145 ), \ irit.ctlpt( irit.E3, (-0.266 ), 0, 0.143 ) ), irit.list( irit.KV_OPEN ) ) sec2 = irit.cbspline( 4, irit.list( \ irit.ctlpt( irit.E3, 0.137, 0, 0.286 ), \ irit.ctlpt( irit.E3, 0.137, 0.185, 0.286 ), \ irit.ctlpt( irit.E3, 0.047, 0.44, 0.14 ), \ irit.ctlpt( irit.E3, 0.007, 0.6, 0.1 ), \ irit.ctlpt( irit.E3, (-0.0273 ), 0.855, 0.0879 ), \ irit.ctlpt( irit.E3, 0.025, 0.91, 0.0634 ), \ irit.ctlpt( irit.E3, 0.111, 0.886, 0.0608 ), \ irit.ctlpt( irit.E3, 0.151, 0.859, 0.0644 ), \ irit.ctlpt( irit.E3, 0.177, 0.848, 0.0813 ), \ irit.ctlpt( irit.E3, 0.202, 0.838, 0.0785 ), \ irit.ctlpt( irit.E3, 0.28, 0.804, 0.0767 ), \ irit.ctlpt( irit.E3, 0.323, 0.865, 0.0646 ), \ irit.ctlpt( irit.E3, 0.284, 0.93, 0.0615 ), \ irit.ctlpt( irit.E3, 0.173, 1.02, 0.0639 ), \ irit.ctlpt( irit.E3, 0.00423, 1.09, 0.0804 ), \ irit.ctlpt( irit.E3, (-0.275 ), 1.5, 0.07 ), \ irit.ctlpt( irit.E3, (-0.135 ), 1.12, 0.07 ), \ irit.ctlpt( irit.E3, (-0.2 ), 1.05, 0.07 ), \ irit.ctlpt( irit.E3, (-0.155 ), 0.91, 0.07 ), \ irit.ctlpt( irit.E3, (-0.085 ), 0.59, 0.1 ), \ irit.ctlpt( irit.E3, (-0.074 ), 0.468, 0.14 ), \ irit.ctlpt( irit.E3, (-0.133 ), 0.212, 0.29 ), \ irit.ctlpt( irit.E3, (-0.133 ), 0, 0.286 ) ), irit.list( irit.KV_OPEN ) ) sec1 = irit.cbspline( 4, irit.list( \ irit.ctlpt( irit.E3, 0, 0, 0.286 ), \ irit.ctlpt( irit.E3, (-0.004 ), 0.216, 0.286 ), \ irit.ctlpt( irit.E3, (-0.018 ), 0.444, 0.14 ), \ irit.ctlpt( irit.E3, (-0.036 ), 0.62, 0.1 ), \ irit.ctlpt( irit.E3, (-0.061 ), 0.8, 0.08 ), \ irit.ctlpt( irit.E3, (-0.09 ), 1.01, 0.07 ), \ irit.ctlpt( irit.E3, (-0.06 ), 1.04, 0.065 ), \ irit.ctlpt( irit.E3, 0.007, 1.01, 0.065 ), \ irit.ctlpt( irit.E3, 0.165, 0.927, 0.07 ), \ irit.ctlpt( irit.E3, 0.235, 0.897, 0.068 ), \ irit.ctlpt( irit.E3, 0.276, 0.876, 0.072 ), \ irit.ctlpt( irit.E3, 0.235, 0.897, 0.068 ), \ irit.ctlpt( irit.E3, 0.165, 0.927, 0.07 ), \ irit.ctlpt( irit.E3, 0.007, 1.01, 0.065 ), \ irit.ctlpt( irit.E3, (-0.06 ), 1.04, 0.065 ), \ irit.ctlpt( irit.E3, (-0.09 ), 1.01, 0.07 ), \ irit.ctlpt( irit.E3, (-0.061 ), 0.8, 0.08 ), \ irit.ctlpt( irit.E3, (-0.036 ), 0.62, 0.1 ), \ irit.ctlpt( irit.E3, (-0.018 ), 0.444, 0.14 ), \ irit.ctlpt( irit.E3, (-0.004 ), 0.216, 0.286 ), \ irit.ctlpt( irit.E3, 0, 0, 0.286 ) ), irit.list( irit.KV_OPEN ) ) knightbody = (-irit.sfromcrvs( irit.list(sec1, sec2, sec3, sec4, sec3 * irit.sz( (-1)), sec2 * irit.sz((-1)), sec1 * irit.sz( (-1))), 4, irit.KV_OPEN)) irit.attrib(knightbody, "rgb", irit.GenStrObject(clr)) knighteyes = irit.list( irit.spheresrf(0.025) * irit.ty(1) * irit.tz(0.05), irit.spheresrf(0.025) * irit.ty(1) * irit.tz((-0.05))) irit.color(knighteyes, irit.CYAN) retval = irit.list(knightbody, knighteyes) * irit.sc( 0.65 * s) * irit.rx(90) return retval
import math import irit # # # Alpha sectors between linear entities. # # # Gershon Elber, December 1999 # # Point-Plane alpha sector, # pt = irit.spheresrf( 0.1 ) * irit.tx( 1 ) l = 2 pln = irit.ruledsrf( irit.ctlpt( irit.E3, 0, (-l ), (-l ) ) + \ irit.ctlpt( irit.E3, 0, (-l ), l ), \ irit.ctlpt( irit.E3, 0, l, (-l ) ) + \ irit.ctlpt( irit.E3, 0, l, l ) ) # A B C D E F G H I J def makealpha( a, clr ): aa = ( 2 * a - 1 )/float(a * a) alp = irit.quadric( irit.list( aa, 1, 1, 0, 0, 0,\ (-2 ), 0, 0, 1 ) ) if ( a < 0.5 ): alp1 = irit.sregion( irit.sregion( alp, irit.ROW, 0, 1 ), irit.COL, 0,\ 0.7 ) alp1 = irit.smoebius( irit.smoebius( alp1, 0, irit.COL ), 0, irit.ROW )
t1 = irit.textwarp( s1, "computer graphics", 0.1, 0.25, 0.75, 1 ) irit.color( t1, irit.CYAN ) irit.adwidth( t1, 2 ) irit.interact( irit.list( t1, s1 ) ) s2 = irit.sreparam( irit.ruledsrf( c1, irit.offset( c1, c2, 0.01, 0 ) ), irit.COL, 0,\ 6 ) irit.color( s2, irit.RED ) t2 = irit.textwarp( s2, "computer graphics", 0.15, 0.25, 0.75, 0.55 ) irit.color( t2, irit.CYAN ) irit.adwidth( t2, 2 ) irit.interact( irit.list( t2, s2 ) ) s3 = irit.sreparam( irit.spheresrf( 1 ), irit.COL, 0, 6.5 ) irit.color( s3, irit.RED ) t3 = irit.textwarp( s3, "a sphere", 0.1, 0.2, 0.9, 0.85 ) irit.color( t3, irit.CYAN ) irit.adwidth( t3, 2 ) irit.interact( irit.list( t3, s3 ) ) irit.save( "textwarp", irit.list( irit.list( s1, t1 ) * irit.ty( 1 ), irit.list( s2, t2 ), irit.list( s3, t3 ) * irit.rx( (-90 ) ) * irit.ty( (-2 ) ) ) ) irit.free( c1 ) irit.free( c2 ) irit.free( s1 ) irit.free( s2 ) irit.free( s3 ) irit.free( t1 ) irit.free( t2 )
#This is an IRIT script and as such requires both math and irit import: # import math import irit # # # An example of the cosine shader - setting the cosine exponent for irender. # s = irit.spheresrf(0.2) * irit.rx(90) s1 = s * irit.trans(((-0.5), 0.3, 0)) irit.attrib(s1, "srf_cosine", irit.GenIntObject(1)) s2 = s * irit.trans((0, 0.3, 0)) irit.attrib(s2, "srf_cosine", irit.GenIntObject(4)) s3 = s * irit.trans((0.5, 0.3, 0)) irit.attrib(s3, "srf_cosine", irit.GenIntObject(16)) s4 = s * irit.trans((-0.5, -0.3, 0)) irit.attrib(s4, "srf_cosine", irit.GenIntObject(32)) s5 = s * irit.trans((0, (-0.3), 0)) irit.attrib(s5, "srf_cosine", irit.GenIntObject(128)) s6 = s * irit.trans((0.5, (-0.3), 0)) irit.attrib(s6, "srf_cosine", irit.GenIntObject(256)) allspheres = irit.list(s1, s2, s3, s4, s5, s6)