Пример #1
0
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)
Пример #2
0
tv = irit.tfromsrfs(discs, 3, irit.KV_OPEN)
irit.attrib(tv, "transp", irit.GenRealObject(0.5))
#  view( list( irit.GetAxes(), Tv, Teapot ), 1 );

# ############################################################################
#
#  Let the Teapot and Spheres come out of the teapot...
#

irit.SetResolution(10)

s1 = irit.sphere((0.2, 0.2, 0.8), 0.18)
irit.color(s1, irit.YELLOW)
s2 = irit.sphere((0.75, 0.25, 0.16667), 0.12) * irit.sz(3)
irit.color(s2, irit.MAGENTA)
c1 = irit.maxedgelen( irit.triangl( irit.cylin( ( 0.15, 0.85, 0.01 ), ( 0, 0, 0.98 ), 0.1, 3 ), 1 ),\
0.2 )
irit.color(c1, irit.CYAN)
c2 = irit.maxedgelen( irit.triangl( irit.cylin( ( 0.85, 0.85, 0.01 ), ( 0, 0, 0.98 ), 0.1, 3 ), 1 ),\
0.2 )
irit.color(c2, irit.CYAN)

genie = irit.list( teapotorig * irit.sc( 0.15 ) * irit.ry( (-90 ) ) * irit.trans( ( 0.5, 0.4, 0.47 ) ), s1, s2, c1,\
c2 )

b = irit.box((0, 0, 0), 1, 1, 1)
irit.attrib(b, "transp", irit.GenRealObject(0.5))

irit.interact(irit.list(irit.GetAxes(), b, genie))

wgenie = warpobj(genie, tv)
irit.interact(irit.list(teapot, wgenie, tv))
Пример #3
0
irit.SetResolution(5)
x2 = irit.triangl(irit.sphere(((-1.4), 2.2, 5.3), 1.4), 1)

spfit = irit.list(irit.fitpmodel(x1, 1, 0.01, 100),
                  irit.fitpmodel(x1, 1, 1e-005, 100),
                  irit.fitpmodel(x2, 1, 0.01, 100),
                  irit.fitpmodel(x2, 1, 1e-006, 100))

#
#  A cylinder: returned is (Error, Xcntr, Ycntr, Zcntr,
#                                  Xdir, Ydir, Zdir, Radius)
#

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 ),\
Пример #4
0
            n = n + 1
            j = j + 1
        i = i + 1
    retval = mean/float(n)
    return retval

# ############################################################################

irit.SetResolution( 30 )

b1 = irit.box( ( (-0.3 ), (-0.3 ), 0 ), 0.6, 0.6, 0.15 )
c1 = irit.cylin( ( 0, 0, 0.1 ), ( 0, 0, 0.65 ), 0.14, 3 )
s1 = irit.sphere( ( 0, 0, 0.65 ), 0.3 )
t1 = irit.torus( ( 0, 0, 0.7 ), ( 0, 0, 1 ), 0.3, 0.15 )

obj = irit.maxedgelen( irit.triangl( b1 + c1 + s1 - t1, 1 ), 0.1 )

irit.free( b1 )
irit.free( c1 )
irit.free( s1 )
irit.free( t1 )

crvtrobj = irit.pcrvtr( obj, 1, 0 )
irit.free( obj )

crvtrobjrgb = gauss2rgb( crvtrobj, 15 )
irit.interact( crvtrobjrgb )

crvtrobjrgb = mean2rgb( crvtrobj, 1 )
irit.interact( crvtrobjrgb )
irit.save( "pl1crvtr", crvtrobjrgb )
Пример #5
0
#

save_res = irit.GetResolution()
save_mat2 = irit.GetViewMatrix()
irit.SetViewMatrix(irit.rotx(0))

#
#  Get a model.
#

irit.SetResolution(20)
s = irit.ruledsrf( irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                   irit.ctlpt( irit.E3, 1, 0, 0 ), \
                   irit.ctlpt( irit.E3, 0, 1, 0 ) + \
                   irit.ctlpt( irit.E3, 1, 1, 0 ) )
pls = irit.maxedgelen(irit.triangl(irit.gpolygon(s, 1), 0), 0.2)

#
#  Define the trivarate warping function.
#

s1 = irit.ruledsrf( irit.ctlpt( irit.E3, (-0 ), 0, 0.01 ) + \
                    irit.ctlpt( irit.E3, 0.5, 0, (-0.01 ) ) + \
                    irit.ctlpt( irit.E3, 1, 0, 0.01 ), \
                    irit.ctlpt( irit.E3, (-0 ), 1, 0.01 ) + \
                    irit.ctlpt( irit.E3, 0.5, 1, (-0.01 ) ) + \
                    irit.ctlpt( irit.E3, 1, 1, 0.01 ) )
tv = irit.tfromsrfs(
    irit.list(s1 * irit.tz((-0.5)),
              s1 * irit.sc(0.96) * irit.tx(0.02) * irit.tz(0.5)), 2,
    irit.KV_OPEN)