Exemplo n.º 1
0
                                   irit.ctlpt( irit.E2, 0.7, 0.06 ), \
                                   irit.ctlpt( irit.E2, 0.1, 0.1 ), \
                                   irit.ctlpt( irit.E2, 0.1, 0.6 ), \
                                   irit.ctlpt( irit.E2, 0.6, 0.6 ), \
                                   irit.ctlpt( irit.E2, 0.8, 0.8 ), \
                                   irit.ctlpt( irit.E2, 0.8, 1.4 ), \
                                   irit.ctlpt( irit.E2, 0.6, 1.6 ) ), irit.list( irit.KV_OPEN ) )

doc_crv_off = irit.loffset(crv, 0.4, 300, 49, 4)
irit.attrib(doc_crv_off, "width", irit.GenRealObject(0.02))
irit.save("doc_crv_0.4_off", irit.list(crv, doc_crv_off))
cmpoffalltols(crv, "doc_crv_0.4", 0.4, 0.1, 3)

doc_crv_off = irit.loffset(crv, (-0.8), 300, 53, 4)
irit.attrib(doc_crv_off, "width", irit.GenRealObject(0.02))
irit.save("doc_crv-0.8_off", irit.list(crv, doc_crv_off))
cmpoffalltols(crv, "doc_crv-0.8", (-0.8), 0.1, 3)

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

irit.free(bez)
irit.free(bez_off)
irit.free(cross)
irit.free(cross_off)
irit.free(circ)
irit.free(circ_off)
irit.free(cpawn)
irit.free(cpawn_off)
irit.free(crv)
irit.free(doc_crv_off)
Exemplo n.º 2
0
zerosetsrfe3 = irit.coerce(zerosetsrf, irit.E3) * irit.rotx((-90)) * irit.roty(
    (-90)) * irit.sz(1)
irit.awidth(zerosetsrfe3, 0.007)

zeroset = irit.contour(zerosetsrfe3, irit.plane(0, 0, 1, 1e-008))
irit.color(zeroset, irit.RED)
irit.adwidth(zeroset, 3)
irit.awidth(zeroset, 0.02)

uextreme = evaluvtoe3(zerosetsrfe3,
                      irit.ciextreme(zerosetsrf, irit.COL, 0.01, (-1e-009)),
                      14)
irit.adwidth(uextreme, 2)

irit.interact(irit.list(genaxes, zerosetsrfe3, zeroset, uextreme))

irit.save("rrint6v", irit.list(genaxes, zerosetsrfe3, zeroset, uextreme))

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

irit.free(uextreme)
irit.free(genaxes)
irit.free(c)
irit.free(c1)
irit.free(c2)
irit.free(r1)
irit.free(r2)
irit.free(zeroset)
irit.free(zerosetsrf)
irit.free(zerosetsrfe3)
Exemplo n.º 3
0
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)
irit.free(a4)
irit.free(a5)

irit.free(b1)
Exemplo n.º 4
0
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)

#
#  Surface of revolution of freeform curves.
#

gcross = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.3, 0, 0 ), \
                                      irit.ctlpt( irit.E3, 0.3, 0, 0.05 ), \
                                      irit.ctlpt( irit.E3, 0.1, 0, 0.05 ), \
                                      irit.ctlpt( irit.E3, 0.1, 0, 0.4 ), \
                                      irit.ctlpt( irit.E3, 0.5, 0, 0.4 ), \
                                      irit.ctlpt( irit.E3, 0.6, 0, 0.8 ) ), irit.list( 0, 0, 0, 1, 2, 3,\
4, 4, 4 ) )
irit.color(gcross, irit.GREEN)
irit.adwidth(gcross, 5)
Exemplo n.º 5
0
#  All units are in centimeters.
#

circ = irit.circle((0, 0, 0), 3)

arc0 = irit.cregion(circ, 0, 1.5)
arc1 = irit.cregion(circ, 0.5, 1.5)
arc2 = irit.cregion(circ, 1, 1.5)
arc3 = irit.cregion(circ, 0.5, 1)
arc4 = irit.cregion(circ, 0.7, 1.5)
arc5 = irit.cregion(circ, 0.7, 1.3)
arc6 = irit.cregion(circ, 0.7, 1)
arc7 = irit.cregion(circ, 1, 1.3)
arc8 = irit.cregion(circ, 0.5, 1.3)
arc9 = irit.cregion(circ, 0.7, 1.5)
irit.free(circ)

prof1 = ((-arc1) + (-arc2) * irit.tx(4.6))
prof1a = prof1 * irit.sy(2)

prof2 = ((-arc3) + (-arc4) * irit.tx(4.6) + (-arc5) * irit.tx(7.6) +
         (-arc5) * irit.tx(10.6) + (-arc5) * irit.tx(13.6) +
         (-arc5) * irit.tx(16.6))
prof2a = prof2 * irit.sy(2) * irit.trans(((-2), (-4), 0))

prof3 = ((-arc6) + (-arc8) * irit.tx(3) + (-arc1) * irit.tx(7.6) +
         (-arc9) * irit.tx(12.3) + (-arc7) * irit.tx(15.3))
prof3a = prof3 * irit.sy(2) * irit.trans(((-2), (-8), 0))

prof4 = ((-arc6) + (-arc8) * irit.tx(3) + (-arc1) * irit.tx(7.6) +
         (-arc0) * irit.tx(12.3))
Exemplo n.º 6
0
#                                Created by Gershon Elber,       Feb 89
#
#    High resolution version. Do not try this on an IBM PC.
#

t = irit.time(1)

save_res = irit.GetResolution()

irit.SetResolution(32)
t1 = irit.cylin(((-1.1), 0, 0), (2.2, 0, 0), 0.2, 3)
t2 = irit.cylin(((-0.8), 0, 0), (0.05, 0, 0), 0.3, 3)
t3 = irit.cylin((0.8, 0, 0), ((-0.05), 0, 0), 0.3, 3)

s1 = (t1 + t2 + t3)
irit.free(t1)
irit.free(t2)
irit.free(t3)
s1 = irit.convex(s1)
irit.view(s1, irit.ON)

s2 = s1 * irit.roty(90)
s3 = s1 * irit.rotz(90)
irit.view(irit.list(s2, s3), irit.OFF)

s4 = (s1 + s2 + s3)
irit.free(s1)
irit.free(s2)
irit.free(s3)
irit.view(s4, irit.ON)
Exemplo n.º 7
0
import math
import irit
#

#
#  Convex Hull and related computation for freeform curves.
#
#                                Gershon Elber, February 1996
#

save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.sc(0.5))
irit.viewobj(irit.GetViewMatrix())
ri = irit.iritstate("randominit", irit.GenIntObject(1964))
#  Seed-initiate the randomizer,
irit.free(ri)

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

pts = irit.nil()
len = 1
numpts = 5
i = 0
while (i <= numpts):
    r = irit.random(0, 2)
    pt = irit.ctlpt(irit.E2, len * r * math.cos(i * 2 * math.pi / numpts),
                    len * r * math.sin(i * 2 * 3.14159 / numpts))
    irit.snoc(pt, pts)
    i = i + 1
c0 = irit.coerce(irit.cbspline(4, pts, irit.list(irit.KV_PERIODIC)),
                 irit.KV_OPEN)
Exemplo n.º 8
0
import math
import irit
#

#
#  Combination of a square, triangle, and a circle
#
#                                Gershon Elber, Feb 2009.
#

#
#  The Sqriancle
#

c = irit.circle((0, 0, 0), 1)

stc = irit.ruledsrf(c, c * irit.tz(2) * irit.sx(0.0001))
irit.attrib(stc, "rgb", irit.GenStrObject("255, 200, 200"))

stcisos = irit.getisocurvetubes(stc, 8, 4, 0.03)
irit.attrib(stcisos, "rgb", irit.GenStrObject("25, 20, 200"))
irit.attrib(stcisos, "specilar", irit.GenRealObject(2))

irit.view(irit.list(stc, stcisos), irit.ON)
irit.save("sqriacle", irit.list(stc, stcisos))
irit.pause()

irit.free(c)
irit.free(stc)
irit.free(stcisos)
Exemplo n.º 9
0
                                    irit.ctlpt( irit.E2, 0.487, 0.14 ), \
                                    irit.ctlpt( irit.E2, 0.882, 0.112 ), \
                                    irit.ctlpt( irit.E2, 0.878, 0.198 ), \
                                    irit.ctlpt( irit.E2, 0.559, 0.403 ), \
                                    irit.ctlpt( irit.E2, (-0.183 ), 0.252 ), \
                                    irit.ctlpt( irit.E2, (-0.525 ), (-0.04 ) ) ), irit.list( irit.KV_OPEN ) ) * irit.tx( (-0.2 ) ) * irit.ty( (-0.2 ) )

sec2 = sec1 * irit.sy(0.5) * irit.sc(1.2) * irit.tz(2.5) * irit.rz(30)

bladeside = irit.ruledsrf(sec1, sec2)

bladetop = irit.ruledsrf(irit.cregion(sec2, 0, 0.5),
                         (-irit.cregion(sec2, 0.5, 1)))

blademain = irit.list(bladeside, bladetop) * irit.tz(0.2)
irit.free(bladeside)
irit.free(bladetop)

bladefillet = irit.sfromcrvs(
    irit.list(sec1 * irit.sc(1.35) * irit.sy(1.5) * irit.tz((-0.1)), sec1,
              sec1 * irit.tz(0.2)), 3, irit.KV_OPEN)
irit.free(sec1)
irit.free(sec2)

blade = irit.list(blademain, bladefillet) * irit.tx(0.1) * irit.ry(
    90) * irit.sc(0.285) * irit.tx(0.636) * irit.rx(20)
irit.attrib(blade, "rgb", irit.GenStrObject("128,128,128"))

irit.free(blademain)
irit.free(bladefillet)
Exemplo n.º 10
0
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(  )

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.cpinclude( crv1, irit.Fetch3TupleObject(p), 1e-006 )) == 1 ):
Exemplo n.º 11
0
#
#  An object that has three projections of a cross, circle and a square.
#

w = 0.4
cross = ( irit.ctlpt( irit.E3, 1, 0, 0 ) + \
          irit.ctlpt( irit.E3, 1, w, 0 ) + \
          irit.ctlpt( irit.E3, w, w, 0 ) + \
          irit.ctlpt( irit.E3, w, 1, 0 ) + \
          irit.ctlpt( irit.E3, 0, 1, 0 ) )

cross = (cross + cross * irit.rz(90) + cross * irit.rz(180) +
         cross * irit.rz(270))

s1 = irit.extrude(cross * irit.tz((-2)), (0, 0, 4), 0)
irit.free(cross)

s2 = irit.extrude(irit.circle((0, 0, 0), 0.999) * irit.tz((-2)),
                  (0, 0, 4), 0) * irit.rx(90)

s = s1 * s2
irit.free(s1)
irit.free(s2)

irit.view(irit.list(irit.GetAxes(), s), irit.ON)
irit.save("crosplug", s)
irit.pause()

irit.free(s)
Exemplo n.º 12
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)
irit.viewobj(irit.list(pl2, crv1))

crv2 = irit.cbspline( 5, irit.list( irit.ctlpt( irit.E1, 0 ), \
                                    irit.ctlpt( irit.E1, 0 ), \
                                    irit.ctlpt( irit.E1, 0 ), \
                                    irit.ctlpt( irit.E1, 0 ), \
                                    irit.ctlpt( irit.E1, 1 ) ), irit.list( irit.KV_OPEN ) )
cbsp = irit.compose(crv1, crv2)
irit.free(crv1)
irit.free(crv2)

steps = 8
pt_lst = irit.nil()
i = 0
while (i <= steps - 1):
    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)
Exemplo n.º 13
0
					 irit.scale( ( 0.6, 0.6, 0.6 ) ) * \
					 irit.rotx( 20 ) * \
					 irit.roty( 45 ) * \
					 irit.trans( ( (-0.3 ), 0.2, 0 ) ))

irit.SetResolution(  16)
s1 = irit.sphere( ( 0, 0, 0 ), 0.2 )
s2 = irit.sphere( ( 1, 0, 0 ), 0.2 )

irit.SetResolution(  8)
c1 = irit.cylin( ( 0, 0, 0 ), ( 1, 0, 0 ), 0.05, 3 )

irit.view( irit.list( irit.GetViewMatrix(), s1, s2, c1 ), irit.ON )

b1 = ( (s1 ^ s2) + c1 )
irit.free( s1 )
irit.free( s2 )
irit.free( c1 )
b2 = b1 * irit.trans( ( 0, 1, 0 ) )

irit.view( irit.list( b1, b2 ), irit.ON )

c2 = irit.cylin( ( 0, 0, 0 ), ( 0, 1, 0 ), 0.05, 3 )
c3 = irit.cylin( ( 1, 0, 0 ), ( 0, 1, 0 ), 0.05, 3 )

b12 = ( (b1 ^ b2) + (c2 ^ c3) )
irit.free( b1 )
irit.free( b2 )
irit.free( c2 )
irit.free( c3 )
b34 = b12 * irit.trans( ( 0, 0, 1 ) )
Exemplo n.º 14
0
crv1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 0 ), \
                                    irit.ctlpt( irit.E2, 0, 0.1 ), \
                                    irit.ctlpt( irit.E2, 0.1, 0.1 ), \
                                    irit.ctlpt( irit.E2, 0.1, (-0.1 ) ), \
                                    irit.ctlpt( irit.E2, (-0.1 ), (-0.1 ) ), \
                                    irit.ctlpt( irit.E2, (-0.1 ), 0.2 ), \
                                    irit.ctlpt( irit.E2, 0.2, 0.2 ), \
                                    irit.ctlpt( irit.E2, 0.2, (-0.2 ) ), \
                                    irit.ctlpt( irit.E2, (-0.2 ), (-0.2 ) ), \
                                    irit.ctlpt( irit.E2, (-0.2 ), 0.3 ), \
                                    irit.ctlpt( irit.E2, 0, 0.3 ) ), irit.list( irit.KV_OPEN ) )
crv1a = crv1 * irit.trans( ( (-0.4 ), 0, 0 ) )
crv1b = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 0.3, (-0.3 ) ), \
                                 irit.ctlpt( irit.E2, 0.4, 0 ), \
                                 irit.ctlpt( irit.E2, 0.3, 0.3 ) ) )
irit.free( crv1 )
irit.color( crv1a, irit.GREEN )
irit.color( crv1b, irit.GREEN )
irit.ffcompat( crv1a, crv1b )
irit.view( irit.list( crv1a, crv1b ), irit.ON )

i = 0
while ( i <= 1 ):
    crv = irit.cmorph( crv1a, crv1b, 0, i )
    irit.color( crv, irit.YELLOW )
    irit.view( irit.list( crv1a, crv1b, crv ), irit.ON )
    i = i + 0.01

crvs = irit.cmorph( crv1a, crv1b, 1, 0.01 )
irit.snoc( crv1b, crvs )
i = 1
Exemplo n.º 15
0
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("crv2tan", 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.free(c1)
irit.free(c2)
irit.free(pts)
irit.free(ptsdsp)
irit.free(view_mat1)
Exemplo n.º 16
0
        ((-5), (-0.5), (-4)), 6, 1, 8) + irit.box(((-1.001), (-1), (-0.5)),
                                                  (-0.5), 2, 1))
irit.attrib(block1, "rgb", irit.GenStrObject("50, 100, 255"))

block2 = block1 * irit.rz(180)
irit.attrib(block2, "rgb", irit.GenStrObject("100, 50, 255"))

#
#  Add the animation curves:
#

mov_xyz = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \
                                                      irit.ctlpt( irit.E3, 0, 0, 16 ), \
                                                      irit.ctlpt( irit.E3, 0, 4, 16 ) ), irit.list( irit.KV_OPEN ) ), 0, 2 )
irit.attrib(stick1, "animation", mov_xyz)
irit.free(mov_xyz)

mov_xyz = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \
                                                      irit.ctlpt( irit.E3, 0, 0, 16 ), \
                                                      irit.ctlpt( irit.E3, 0, (-2 ), 16 ) ), irit.list( irit.KV_OPEN ) ), 0, 2 )
irit.attrib(bar1, "animation", mov_xyz)
irit.free(mov_xyz)

mov_xyz = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \
                                                      irit.ctlpt( irit.E3, 0, (-1 ), 0 ), \
                                                      irit.ctlpt( irit.E3, 0, (-1 ), 12 ) ), irit.list( irit.KV_OPEN ) ), 2, 3 )
irit.attrib(bar2, "animation", mov_xyz)
irit.free(mov_xyz)

mov_y = irit.creparam( irit.cbspline( 2, irit.list( irit.ctlpt( irit.E1, 0 ), \
                                                    irit.ctlpt( irit.E1, (-2 ) ) ), irit.list( irit.KV_OPEN ) ), 3, 4 )
Exemplo n.º 17
0
#  by mark Segal and Carlo H. Sequin, IEE CG&A, January 1988, pp 53-67.
#

save_mat = irit.GetViewMatrix()

b1 = irit.box((0.2, 0.2, 0.2), 0.8, 0.8, 0.8)
b2 = irit.box((0.2, 0.2, (-0.2)), 0.8, 0.8, (-0.8))
b3 = irit.box((0.2, (-0.2), 0.2), 0.8, (-0.8), 0.8)
b4 = irit.box((0.2, (-0.2), (-0.2)), 0.8, (-0.8), (-0.8))
b5 = irit.box(((-0.2), 0.2, 0.2), (-0.8), 0.8, 0.8)
b6 = irit.box(((-0.2), 0.2, (-0.2)), (-0.8), 0.8, (-0.8))
b7 = irit.box(((-0.2), (-0.2), 0.2), (-0.8), (-0.8), 0.8)
b8 = irit.box(((-0.2), (-0.2), (-0.2)), (-0.8), (-0.8), (-0.8))

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)
Exemplo n.º 18
0
    dpath = irit.cderive(path)
    while (t < irit.FetchRealObject(irit.nth(crvdomain, 2))):
        d = irit.Fetch3TupleObject(
            irit.coerce(irit.ceval(dpath, t), irit.POINT_TYPE))
        dlen = math.sqrt(DotProd(d, d))

        rot_x = irit.creparam(rot_x, animtime, animtime + piecetimestep)
        irit.attrib(dominopiece, "animation", irit.list(rot_x))
        irit.setname(irit.getattr(dominopiece, "animation"), 0, "rot_x")

        dp = dominopiece * irit.rz(
            -math.atan2(d[0], d[1]) * 180 / math.pi) * irit.trans(
                irit.Fetch3TupleObject(
                    irit.coerce(irit.ceval(path, t), irit.VECTOR_TYPE)))
        irit.snoc(dp, retval)

        t = t + 0.04 * scl / dlen
        animtime = animtime + piecetimestep * 0.6
    return retval


doms = dominos(irit.circle((0, 0, 0), 1), 1.5, 0.1)

irit.view(irit.list(irit.GetAxes(), doms), irit.ON)

irit.pause()

irit.save("dominos", doms)

irit.free(doms)
Exemplo n.º 19
0
irit.color( srf2, 2 )
srf3 = irit.mrchcube( irit.list( tv, 1, 2, 1 ), ( size, size, size ), 2, 0.75 )
irit.color( srf3, 14 )

irit.interact( irit.list( irit.GetAxes(), wirebox3( size * 16/2.0 ), srf1, srf2, srf3 ) )

size = 0.12
srf1 = irit.mrchcube( irit.list( tv, 1, 2, 1 ), ( size, size, size ), 4, 0.25 )
irit.color( srf1, 5 )
srf2 = irit.mrchcube( irit.list( tv, 1, 2, 1 ), ( size, size, size ), 4, 0.5 )
irit.color( srf2, 2 )
srf3 = irit.mrchcube( irit.list( tv, 1, 2, 1 ), ( size, size, size ), 4, 0.75 )
irit.color( srf3, 14 )

irit.interact( irit.list( irit.GetAxes(), wirebox3( size * 16/4.0 ), srf1, srf2, srf3 ) )
irit.free( tv )

irit.save( "mrchcub1", irit.list( irit.GetAxes(), wirebox3( size * ( 16 - 1 )/4.0 ), srf1, srf2, srf3 ) )

# 
#  marching cubes of volume data:
# 

size = 0.03
srf1 = irit.mrchcube( irit.list( "../data/3dhead.32", 1, 32, 32, 13 ), ( size, size, size ), 1, 500 )
irit.color( srf1, 5 )
srf2 = irit.mrchcube( irit.list( "../data/3dhead.32", 1, 32, 32, 13 ), ( size, size, size ), 1, 150 )
irit.color( srf2, 2 )

irit.interact( irit.list( irit.GetAxes(), wirebox( size * 32, size * 32, size * 13 ), srf1, srf2 ) )
Exemplo n.º 20
0
#  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):
    p = irit.circpoly((0, 0, 1), (0, 0, i), 6)
    c = a * p
    irit.viewobj(c)
    irit.snoc(c, cntrs)
Exemplo n.º 21
0
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)

irit.SetResolution(80)
t4 = irit.cylin((1.45, (-0.5), 1), (0, 1, 0), 0.8, 3)
t5 = irit.cylin(((-1.45), (-0.5), 1), (0, 1, 0), 0.8, 3)
s3 = (s2 - t4 - t5)
irit.free(t4)
Exemplo n.º 22
0
#  Yet another simple 3D mechanical object.
#
#                                Created by Gershon Elber,       Sep 89
#

save_mat = irit.GetViewMatrix()
save_res = irit.GetResolution()

irit.SetResolution(16)
irit.SetViewMatrix(irit.GetViewMatrix() * irit.trans(
    (0, (-0.3), 0)) * irit.scale((0.8, 0.8, 0.8)))
b1 = irit.box(((-0.6), (-0.3), 0), 1.2, 0.6, 0.6)
c1 = irit.cylin((0, (-0.25), 0.59), (0, 0.5, 0), 0.55, 3)
s1 = (b1 + c1)
irit.color(s1, irit.YELLOW)
irit.free(b1)
irit.free(c1)
irit.view(irit.list(irit.GetViewMatrix(), s1), irit.ON)

b2 = irit.box(((-0.4), (-0.4), (-0.1)), 0.8, 0.8, 0.35)
irit.view(b2, irit.OFF)
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)
Exemplo n.º 23
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)
Exemplo n.º 24
0
        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
#
irit.free(m2)
irit.free(m1)
irit.free(m)
irit.free(mt1)
irit.free(mt2)
irit.free(ms1)
irit.free(ms2)
irit.free(mc1)
irit.free(mc2)
irit.free(t1)
irit.free(t2)
irit.free(s1)
irit.free(s2)
irit.free(c1)
irit.free(c2)
irit.free(sol)
Exemplo n.º 25
0
crv1b = irit.cbezier( irit.list( \
                                 irit.ctlpt( irit.E2, 0.2, (-0.5 ) ), \
                                 irit.ctlpt( irit.E2, 0.5, 4 ), \
                                 irit.ctlpt( irit.E2, 1.3, (-0.45 ) ) ) ) * irit.sy( 0.2 )
crv2b = irit.cbezier( irit.list( \
                                 irit.ctlpt( irit.E2, (-0 ), (-0.5 ) ), \
                                 irit.ctlpt( irit.E2, 0.25, 1.09 ), \
                                 irit.ctlpt( irit.E2, 1.1, (-0.5 ) ) ) ) * irit.ty( 0.3 ) * irit.sx( 1.5 )
irit.save(
    "dist2ff1",
    irit.list(testccdistfunc(crv1a, crv2a, irit.nil()),
              testccdistfunc(crv1a, crv2a, irit.list(0.5)),
              testccdistfunc(crv1b, crv2b, irit.nil()),
              testccdistfunc(crv1b, crv2b, irit.list(0.5))))

irit.free(crv1a)
irit.free(crv2a)
irit.free(crv1b)
irit.free(crv2b)

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




crv1a = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0.2 ), \
                                 irit.ctlpt( irit.E2, 0.95, 3.6 ), \
                                 irit.ctlpt( irit.E2, 0.35, 3.6 ), \
                                 irit.ctlpt( irit.E2, 1.3, 0.05 ) ) ) * irit.sy( 0.2 )

crv2a = irit.cbezier( irit.list( \
Exemplo n.º 26
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.
# 

s1 = irit.ruledsrf( irit.ctlpt( irit.E3, 0.5, 0, 0 ) + \
                    irit.ctlpt( irit.E3, 1.5, 0, 0 ), \
                    irit.ctlpt( irit.E3, 0.5, 1.2, 0 ) + \
                    irit.ctlpt( irit.E3, 1.5, 1.2, 0 ) )
tv = irit.tfromsrfs( irit.list( s1, s1 * irit.ry( 30 ), s1 * irit.ry( 60 ), s1 * irit.ry( 90 ), s1 * irit.ry( 120 ), s1 * irit.ry( 150 ), s1 * irit.ry( 180 ) ), 3, irit.KV_OPEN )
tv = irit.treparam( irit.treparam( tv, irit.COL, 0, 0.5 ), irit.ROW, 0.2,\
0.8 )
irit.awidth( tv, 0.001 )
irit.free( s1 )
Exemplo n.º 27
0
    i = i + 1
irit.interact( irit.list( e3pts, s2 ) )

irit.save( "ffptdst7", irit.list( e3pts, s2 ) )

pts = irit.ffptdist( s2, 1, 1000 )
e3pts = irit.nil(  )
i = 1
while ( i <= irit.SizeOf( pts ) ):
    prmpt = irit.nth( pts, i )
    pt = irit.seval( s2, irit.FetchRealObject(irit.coord( prmpt, 0 )), irit.FetchRealObject(irit.coord( prmpt, 1 ) ))
    irit.snoc( pt, e3pts )
    i = i + 1
irit.interact( irit.list( e3pts, s2 ) )

irit.save( "ffptdst8", irit.list( e3pts, s2 ) )

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


irit.free( pts )
irit.free( e3pts )
irit.free( e2pts )
irit.free( prmpt )
irit.free( pt )
irit.free( c1 )
irit.free( c2 )
irit.free( s1 )
irit.free( s2 )

Exemplo n.º 28
0
irit.color( q1, irit.YELLOW )
irit.printf( "%d quadratic segements\n", irit.list( irit.SizeOf( q1 ) ) )

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( "pp7apprx", all )

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

irit.free( crv )
irit.free( q1 )
irit.free( q2 )
irit.free( q3 )
irit.free( q4 )
irit.free( all )

Exemplo n.º 29
0
#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
Exemplo n.º 30
0
                                    irit.ctlpt( irit.E3, (-0.3 ), 0.4, 0 ), \
                                    irit.ctlpt( irit.E3, (-0.07 ), 0.46, 0 ), \
                                    irit.ctlpt( irit.E3, 0, 0.75, 0 ), \
                                    irit.ctlpt( irit.E3, 0.07, 0.46, 0 ), \
                                    irit.ctlpt( irit.E3, 0.3, 0.4, 0 ), \
                                    irit.ctlpt( irit.E3, 0.4, 0.3, 0 ), \
                                    irit.ctlpt( irit.E3, 0.5, 0, 0 ) ), irit.list( 0, 0, 0, 0, 0.8, 0.85,\
1, 1.15, 1.2, 2, 2, 2,\
2 ) )

srf = irit.sfromcrvs(
    irit.list(crv2, crv2 * irit.tz(0.02),
              crv * irit.sc(0.96) * irit.tz(0.2),
              crv * irit.sc(0.87) * irit.tz(0.35),
              crv * irit.sc(0.7) * irit.tz(0.5)), 3, irit.KV_OPEN)
irit.free(crv)
irit.free(crv2)

tcrvs1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0.3, 1.4 ), \
                                      irit.ctlpt( irit.E2, 0.7, 1.4 ), \
                                      irit.ctlpt( irit.E2, 0.7, 2.2 ), \
                                      irit.ctlpt( irit.E2, 0.3, 2.2 ) ), irit.list( irit.KV_PERIODIC ) )
tcrvs2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 1.3, 1.4 ), \
                                      irit.ctlpt( irit.E2, 1.7, 1.4 ), \
                                      irit.ctlpt( irit.E2, 1.7, 2.2 ), \
                                      irit.ctlpt( irit.E2, 1.3, 2.2 ) ), irit.list( irit.KV_PERIODIC ) )
tcrvs3 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 0 ), \
                                      irit.ctlpt( irit.E2, 1, 0 ), \
                                      irit.ctlpt( irit.E2, 2, 0 ), \
                                      irit.ctlpt( irit.E2, 2, 2.9 ), \
                                      irit.ctlpt( irit.E2, 1, 2.6 ), \