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
def testccdistfunc(crv1, crv2, refs):
    if (irit.SizeOf(refs) > 0):
        crv1 = irit.crefine(crv1, 0, refs)
        crv2 = irit.crefine(crv2, 0, refs)
    irit.view(irit.list(irit.GetAxes(), crv1, crv2), irit.ON)
    bb = irit.bbox(irit.dist2ff(crv1, crv2, 1))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all1 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("distance square         bound from %8.5lf to %8.5lf  (%s)\n",
                all1)
    bb = irit.bbox(irit.dist2ff(crv1, crv2, 2))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all2 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on crv1nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all2)
    bb = irit.bbox(irit.dist2ff(crv1, crv2, 3))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all3 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on crv2nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all3)
    irit.pause()
    retval = irit.list(all1, all2, all3)
    return retval
Exemple #3
0
def mean2rgb( pl, eps ):
    retval = irit.GetAxes()
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            h = irit.FetchRealObject(irit.pattrib( p, j, "hcurv", irit.nil(  ) ))
            if ( h > 0 ):
                h = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend( h, eps, 64, 255, 64, 255,\
                64, 64 ) ))
            else:
                h = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend( h, eps, 64, 255, 64, 64,\
                64, 255 ) ))
            j = j + 1
        if ( retval == irit.GetAxes() ):
            retval = p
        else:
            irit.insertpoly( p, retval )
        i = i + 1
    return retval
Exemple #4
0
def gauss2rgb2( pl, eps ):
    retval = irit.GetAxes()
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            k = irit.FetchRealObject(irit.pattrib( p, j, "kcurv", irit.nil(  ) ))
            if ( abs( k ) < eps ):
                k = irit.FetchRealObject(irit.pattrib( p, j, "rgb", "64,255,64" ))
            else:
                if ( k > 0 ):
                    k = irit.FetchRealObject(irit.pattrib( p, j, "rgb", "255,64,64" ))
                else:
                    k = irit.FetchRealObject(irit.pattrib( p, j, "rgb", "64,64,255" ))
            j = j + 1
        if ( retval == irit.GetAxes() ):
            retval = p
        else:
            irit.insertpoly( p, retval )
        i = i + 1
    return retval
Exemple #5
0
def drawbiarcs(crv, tol, maxangle):
    arcs = irit.cbiarcs(crv, tol, maxangle) * irit.tz(0.01)
    i = 1
    while (i <= irit.SizeOf(arcs)):
        if (isodd(i)):
            irit.color(irit.nref(arcs, i), irit.YELLOW)
        else:
            irit.color(irit.nref(arcs, i), irit.MAGENTA)
        i = i + 1
    irit.printf("%d arcs were used in this approximation\n",
                irit.list(irit.SizeOf(arcs)))
    irit.color(crv, irit.CYAN)
    irit.interact(irit.list(irit.GetAxes(), crv, arcs))
Exemple #6
0
def gausmean2rgb( pl, keps, heps ):
    retval = irit.GetAxes()
    i = 0
    while ( i <= irit.SizeOf( pl ) - 1 ):
        p = irit.coord( pl, i )
        j = 0
        while ( j <= irit.SizeOf( p ) - 1 ):
            h = irit.FetchRealObject(irit.pattrib( p, j, "hcurv", irit.nil(  ) ))
            k = irit.FetchRealObject(irit.pattrib( p, j, "kcurv", irit.nil(  ) ))
            if ( k > 0 ):
                kh = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend2( float(k)/keps, float(h)/heps, 255, 64, 64, 255,\
                64, 255, 64, 255, 255, 64, 64, 255, 255, 128, 128, 255, 255, 255 ) ))
            else:
                kh = irit.FetchRealObject(irit.pattrib( p, j, "rgb", crvtrcolorblend2( float(-k )/keps, float(h)/heps, 255, 255, 64, 255,\
                64, 64, 64, 255, 64, 64,\
                255, 255, 202, 167, 60, 255,\
                128, 128 ) ))
            j = j + 1
        if ( retval == irit.GetAxes() ):
            retval = p
        else:
            irit.insertpoly( p, retval )
        i = i + 1
    return retval
def testssdistfunc(srf1, srf2, refs):
    if (irit.SizeOf(refs) > 0):
        srf1 = irit.srefine( irit.srefine( srf1, irit.ROW, 0, refs ), \
        irit.COL, \
        0, \
        refs )
        srf2 = irit.srefine( irit.srefine( srf2, irit.ROW, 0, refs ), \
        irit.COL, \
        0, \
        refs )
    irit.view(irit.list(irit.GetAxes(), srf1, srf2), irit.ON)
    bb = irit.bbox(irit.dist2ff(srf1, srf2, 1.0))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all1 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("distance square         bound from %8.5lf to %8.5lf  (%s)\n",
                all1)

    bb = irit.bbox(irit.dist2ff(srf1, srf2, 2.0))
    if ( irit.FetchRealObject(irit.nth( bb, 1 )) * \
   irit.FetchRealObject(irit.nth( bb, 2 )) > 0 ):
        res = "successful"
    else:
        res = "failed"
    all2 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on srf1nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all2)
    bb = irit.bbox(irit.dist2ff(srf1, srf2, 3.0))
    if (irit.FetchRealObject(irit.nth(bb, 1)) *
            irit.FetchRealObject(irit.nth(bb, 2)) > 0):
        res = "successful"
    else:
        res = "failed"
    all3 = irit.list(irit.nth(bb, 1), irit.nth(bb, 2), res)
    irit.printf("projection on srf2nrml bound from %8.5lf to %8.5lf  (%s)\n",
                all3)
    irit.pause()
    retval = irit.list(all1, all2, all3)
    return retval
Exemple #8
0
# 
#  Point inclusion tests.
# 
#                        Gershon Elber, Nov 2007
# 

view_mat0 = irit.tx( 0 )

# #############################################################################
# 
#  Point inclusion in a polygon:
# 
pl1 = irit.poly( 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 ) ), 0 ) * irit.tx( (-0.15 ) ) * irit.ty( (-0.3 ) )


irit.view( irit.list( irit.GetAxes(), pl1 ), 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.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 ) )
    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)
                                     irit.ctlpt( irit.E2, 0.14, 0.26 ), \
                                     irit.ctlpt( irit.E2, 1, 0 ), \
                                     irit.ctlpt( irit.E2, 1, 0 ) ), irit.list( irit.KV_OPEN ) )

n = ( irit.ctlpt( irit.E3, 0, 0, 1 ) + \
      irit.ctlpt( irit.E3, 0, 0, 1 ) )

s2 = irit.blhermite(c1, c2, d1, d2, csec1, n)
irit.color(s2, irit.GREEN)

s3 = irit.blhermite(c1, c2, d1, d2, csec2, n)
irit.color(s3, irit.YELLOW)

irit.save("blending1", irit.list(s1, s2, s3))

irit.interact(irit.list(irit.GetAxes(), s1, s2, s3))

#
#  Blend on a (polynomial approximation of a) sphere:
#

s = (-irit.surfprev(
    irit.cregion(irit.pcircle((0, 0, 0), 1), 0, 2) * irit.rx(90)))
irit.attrprop(s, "u_resolution", irit.GenIntObject(3))
irit.attrprop(s, "v_resolution", irit.GenIntObject(3))
ds = irit.sderive(s, irit.ROW)

c1 = (-irit.csurface(s, irit.ROW, 0.8))
c2 = (-irit.csurface(s, irit.ROW, 1.2))

d1 = (-irit.csurface(ds, irit.ROW, 0.8))
Exemple #11
0
        irit.attrib(crv, "rgb", irit.GenStrObject(getrandrgb()))
        irit.snoc(crv * irit.sc(1), retval)
        i = i + 1
    return retval


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

crvs = randomcrvs(14, 5, 8, 0.8, 3)

intercrvs = irit.carrangmnt(crvs, 1e-008, 1, irit.GenRealObject(0))

interpts = interptseval(intercrvs)
irit.color(interpts, irit.YELLOW)

all = irit.list(irit.GetAxes(), crvs, interpts)
irit.interact(all)

irit.save("crv1arng", all)

irit.free(interpts)

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

crvs = randomcrvs(12, 4, 7, 0.8, 3)

intercrvs = irit.carrangmnt(crvs, 1e-012, 2, irit.GenRealObject(0))

intercrvs = intercrvspaint(intercrvs)
irit.adwidth(intercrvs, 3)
all = irit.list(irit.GetAxes(), intercrvs)
Exemple #12
0
                             irit.ctlpt( irit.E3, 4, 2, 1 ) ) )

cb = irit.cbezier(cbzr) * irit.scale((0.7, 1.4, 1))

irit.color(cb, irit.RED)
sb = irit.sbezier(sbzr)

irit.color(sb, irit.RED)

irit.save(
    "bezier1",
    irit.list(irit.fforder(cb), irit.ffmsize(cb), irit.ffctlpts(cb),
              irit.fforder(sb), irit.ffmsize(sb), irit.ffctlpts(sb)))

if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), cb, sb))
    irit.viewstate("dsrfmesh", 1)
    irit.pause()
    irit.viewstate("dsrfmesh", 0)
    irit.pause()

#
#  Curve refinement (note the returned curve is a bspline curve).
#
cb_ref = irit.crefine(cb, 0, irit.list(0.25, 0.5, 0.75))
irit.color(cb_ref, irit.YELLOW)
if (display == 1):
    irit.interact(irit.list(irit.GetAxes(), cb, cb_ref))

#
#  Curve subdivision.
Exemple #13
0
    conic = irit.conicsec(irit.list(a, b, c, d, e, f), 0, irit.OFF, irit.OFF)
    if (irit.IsNullObject(conic)):
        conic = irit.GenRealObject(0)

    irit.color(conic, irit.MAGENTA)
    ell = boundingellipse(pt1, pt2, pt3)
    irit.color(ell, irit.YELLOW)
    irit.adwidth(ell, 2)
    ell2 = irit.conicsec( irit.ellipse3pt( irit.Fetch3TupleObject(pt1), \
             irit.Fetch3TupleObject(pt2), \
             irit.Fetch3TupleObject(pt3), \
             0.02 ), 0, 0,\
    0 )
    irit.color(ell2, irit.CYAN)
    irit.adwidth(ell2, 3)
    all = irit.list( irit.GetAxes(), ell2, ell, conic, pt1, pt2,\
    pt3, pl )
    irit.view(all, irit.ON)
    irit.milisleep(200)
    i = i + 1

irit.save("ellips2", all)

# ############################################################################
#
#  Do some tests with 2D transformations of ellipses and ellipsoids.
#

n = 360

pt1 = irit.point(irit.random((-0.5), 0.5), irit.random((-0.5), 0.5), 0)
Exemple #14
0
irit.color(c, irit.RED)
irit.adwidth(c, 3)

irit.interact(irit.list(r1, r2, c))

zerosetsrf = irit.rrinter(irit.cmesh(r1, irit.ROW, 0),
                          irit.cmesh(r1, irit.ROW, 1),
                          irit.cmesh(r2, irit.ROW, 0),
                          irit.cmesh(r2, irit.ROW, 1), 10, 1)
zerosetsrfe3 = irit.coerce(zerosetsrf, irit.E3) * irit.rotx((-90)) * irit.roty(
    (-90)) * irit.sz(0.1)
zeroset = irit.contour(zerosetsrfe3, irit.plane(0, 0, 1, 1e-005))
irit.color(zeroset, irit.RED)
irit.adwidth(zeroset, 3)

irit.interact(irit.list(irit.GetAxes(), zerosetsrfe3, zeroset))

# ############################################################################
#
#  Case 2
#

c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0, (-1 ) ), \
                              irit.ctlpt( irit.E3, 0, 1, (-1 ) ), \
                              irit.ctlpt( irit.E3, 0.3, 0, (-1 ) ), \
                              irit.ctlpt( irit.E3, 1, 0, (-1 ) ) ) )

c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0, 1 ), \
                              irit.ctlpt( irit.E3, 0, 1, 1 ), \
                              irit.ctlpt( irit.E3, 0.3, 1, 1 ), \
                              irit.ctlpt( irit.E3, 1, 0, 1 ) ) )
plgcross = irit.poly( irit.list( v1, v2, v3, v4, v5, v6,\

v7, v8, v9, v10, v11, v12 ),\
0 )

pllcross = irit.poly( irit.list( v1, v2, v3, v4, v5, v6,\

v7, v8, v9, v10, v11, v12,\
v1 ), 1 )
irit.color(pllcross, irit.GREEN)
irit.adwidth(pllcross, 5)

irit.SetResolution(16)

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)
irit.color(s2ointer, irit.RED)
irit.attrib(s2ointer, "dwidth", irit.GenRealObject(3))

irit.SetViewMatrix(save_mat)
irit.interact(irit.list(irit.GetViewMatrix(), s2o, s2ointer))
irit.save("selfint2", irit.list(s2o, s2ointer))

# ############################################################################
#
#  Antipodal and self intersection points for curves.
#
c1 = irit.pcircle((0.1, 0.2, 0.3), 0.7) * irit.sy(0.5)

apline1 = evalantipodalptsoncrv(c1)

irit.interact(irit.list(irit.GetAxes(), apline1, c1))

c2 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.707, 0.304 ), \
                                  irit.ctlpt( irit.E2, 0.317, (-0.1 ) ), \
                                  irit.ctlpt( irit.E2, (-0.052 ), 0.147 ), \
                                  irit.ctlpt( irit.E2, (-0.159 ), 0.682 ), \
                                  irit.ctlpt( irit.E2, (-0.592 ), 0.039 ), \
                                  irit.ctlpt( irit.E2, (-0.646 ), (-0.254 ) ), \
                                  irit.ctlpt( irit.E2, (-0.313 ), (-0.532 ) ), \
                                  irit.ctlpt( irit.E2, (-0.568 ), (-0.145 ) ), \
                                  irit.ctlpt( irit.E2, (-0.402 ), 0.336 ), \
                                  irit.ctlpt( irit.E2, (-0.272 ), 0.134 ), \
                                  irit.ctlpt( irit.E2, (-0.168 ), 0.241 ), \
                                  irit.ctlpt( irit.E2, (-0.056 ), 0.641 ), \
                                  irit.ctlpt( irit.E2, 0.272, (-0.069 ) ), \
                                  irit.ctlpt( irit.E2, 0.361, (-0.173 ) ), \
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))

irit.save("genitpot", irit.list(teapot, wgenie, tv))

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

irit.SetViewMatrix(save_mat2)
irit.SetResolution(save_res)

irit.free(teapotorig)
irit.free(teapot)
irit.free(s)
irit.free(tv)
Exemple #18
0
irit.free(wig)
irit.free(c)
irit.free(s)
irit.free(paramumb)

# ############################################################################
#  Mean curvature evolute of surfaces.
# ############################################################################
c1 = irit.pcircle((0, 0, 0), 1)

scone = irit.ruledsrf(c1, c1 * irit.sc(0.1) * irit.tz(1))
irit.color(scone, irit.YELLOW)
sconeev = irit.evolute(scone)
irit.color(sconeev, irit.GREEN)
irit.interact(irit.list(irit.GetAxes(), scone, sconeev))

scylin = irit.ruledsrf(c1, c1 * irit.tz(1))
irit.color(scylin, irit.YELLOW)
scylinev = irit.evolute(scylin)
irit.color(scylinev, irit.GREEN)
irit.interact(irit.list(irit.GetAxes(), scylin, scylinev))

irit.save("sevolute",
          irit.list(irit.GetAxes(), scylin, scylinev, scone, sconeev))

irit.free(scone)
irit.free(sconeev)
irit.free(scylin)
irit.free(scylinev)
                              irit.ctlpt( irit.E3, 0, 0, 1 ) ) )
r1 = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 1 ) ) )

s2 = irit.cylinsrf( 4, 1 ) * irit.tz( (-2 ) ) * irit.rx( 90 ) * irit.tx( 0.5 )
irit.color( s2, irit.MAGENTA )
c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, 0.5, (-1 ), 0 ), \
                              irit.ctlpt( irit.E3, 0.5, 1, 0 ) ) )
r2 = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 1 ) ) )

zerosetsrf = irit.coerce( irit.gginter( c1, r1, c2, r2, 10, 1 ),\
irit.E3 ) * irit.rotx( (-90 ) ) * irit.roty( (-90 ) )
irit.SetResolution(  100)
zeroset = irit.contour( zerosetsrf, irit.plane( 0, 0, 1, 0 ) )
irit.color( zeroset, irit.GREEN )
irit.adwidth( zeroset, 3 )
irit.interact( irit.list( zerosetsrf * irit.sz( 0.1 ), zeroset, irit.GetAxes() ) * irit.sc( 3 ) )

c = irit.nth( irit.gginter( c1, r1, c2, r2, 100, 0 ),\
1 )
irit.interact( irit.list( s1, s2, c ) )

irit.save( "rngrng1", irit.list( zerosetsrf, s1, s2, c ) )


a = 0.9
while ( a >= 0.05 ):
    s2 = irit.cylinsrf( 4, 1 ) * irit.tz( (-2 ) ) * irit.rx( 90 ) * irit.tx( a )
    irit.color( s2, irit.MAGENTA )
    c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, a, (-1 ), 0 ), \
                                   irit.ctlpt( irit.E3, a, 1, 0 ) ) )
    r2 = irit.cbezier( irit.list( \
# ------------------------------------------------


saddle = irit.sbezier( irit.list( irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \
                                             irit.ctlpt( irit.E3, 0.05, 0.2, 0.1 ), \
                                             irit.ctlpt( irit.E3, 0.1, 0.05, 0.2 ) ), irit.list( \
                                             irit.ctlpt( irit.E3, 0.1, (-0.2 ), 0 ), \
                                             irit.ctlpt( irit.E3, 0.15, 0.05, 0.1 ), \
                                             irit.ctlpt( irit.E3, 0.2, (-0.1 ), 0.2 ) ), irit.list( \
                                             irit.ctlpt( irit.E3, 0.2, 0, 0 ), \
                                             irit.ctlpt( irit.E3, 0.25, 0.2, 0.1 ), \
                                             irit.ctlpt( irit.E3, 0.3, 0.05, 0.2 ) ) ) ) * irit.sc( 4 )

irit.attrib(saddle, "rgb", irit.GenStrObject("55, 255, 255"))

all1 = irit.list(saddle, irit.GetAxes(),
                 evalsrfrayinter((0, (-0.5), 0), (1, 1, 1), saddle))
irit.interact(all1)

all2 = irit.list(saddle, irit.GetAxes(),
                 evalsrfrayinter(((-0.5), 0.1, 0.2), (2, 0.2, 0.2), saddle))
irit.interact(all2)

irit.free(saddle)

irit.save("bez1clip", irit.list(all1, all2))

# ------------------------------------------------
#        TEAPOT END
# ------------------------------------------------
Exemple #21
0
intrcrv = irit.iritstate("intercrv", intrcrv)

irit.viewremove("c")
irit.viewobj(cntrs)
irit.pause()

irit.save("contour1", cntrs)

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

irit.SetResolution(50)
view_mat1 = irit.GetViewMatrix() * irit.sc(0.9)

x = irit.sphere((0, 0, 0), 1)
irit.color(x, irit.RED)
irit.view(irit.list(view_mat1, irit.GetAxes(), x), irit.ON)

allcntrs = irit.nil()

l = (-0.95)
while (l <= 0.99):
    c = irit.contour(
        x, irit.plane(1 / math.sqrt(3), 1 / math.sqrt(3), 1 / math.sqrt(3), l))
    irit.viewobj(c)
    irit.milisleep(50)
    irit.snoc(c * irit.tx(0), allcntrs)
    l = l + 0.1
irit.interact(irit.list(irit.GetAxes(), x, allcntrs))

# ############
view_mat1 = irit.GetViewMatrix() * irit.sc(0.7)
def aint(o):
    irit.interact(irit.list(o, irit.GetAxes()))
    retval = o
    return retval
# 
#  Marching cubes of trivariates:
#                   

tv = irit.load( "../data/sphere16.itd" )

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

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

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

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

size = 0.06
srf1 = irit.mrchcube( irit.list( tv, 1, 1, 1 ), ( size, size, size ), 2, 0.25 )
irit.color( srf1, 5 )
srf2 = irit.mrchcube( irit.list( tv, 1, 1, 1 ), ( size, size, size ), 2, 0.5 )
Exemple #24
0
                                    irit.ctlpt( irit.E2, (-1.5 ), (-0.5 ) ), \
                                    irit.ctlpt( irit.E2, 1.5, 0 ), \
                                    irit.ctlpt( irit.E2, (-0.5 ), 2 ), \
                                    irit.ctlpt( irit.E2, (-0.5 ), 1 ) ), irit.list( irit.KV_OPEN ) )
irit.color(crv1, irit.GREEN)
irit.attrib(crv1, "width", irit.GenRealObject(0.02))

pt_param = irit.crvptdst(crv1, (0, 0, 0), 0, (-0.001))
pt_extrem = irit.nil()

i = 1
while (i <= irit.SizeOf(pt_param)):
    pt = irit.ceval(crv1, irit.FetchRealObject(irit.nth(pt_param, i)))
    irit.snoc(irit.coerce(pt, irit.VECTOR_TYPE), pt_extrem)
    i = i + 1
irit.interact(irit.list(irit.GetAxes(), crv1, pt_extrem))
irit.save("crv1dist", irit.list(irit.GetAxes(), crv1, pt_extrem))

pt_min = irit.ceval(
    crv1, irit.FetchRealObject(irit.crvptdst(crv1, (0, 0, 0), 1, 0.001)))
irit.interact(
    irit.list(irit.GetAxes(), crv1, irit.coerce(pt_min, irit.VECTOR_TYPE)))

pt_max = irit.ceval(
    crv1, irit.FetchRealObject(irit.crvptdst(crv1, (0, 0, 0), 0, 0.001)))
irit.interact(
    irit.list(irit.GetAxes(), crv1, irit.coerce(pt_max, irit.VECTOR_TYPE)))
irit.save(
    "crv2dist",
    irit.list(irit.GetAxes(), crv1, irit.coerce(pt_max, irit.VECTOR_TYPE)))
#
c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-0.9 ), (-0.1 ) ), \
                              irit.ctlpt( irit.E2, (-1.3 ), (-1.3 ) ), \
                              irit.ctlpt( irit.E2, 1.3, 0.3 ), \
                              irit.ctlpt( irit.E2, 0.3, 1 ) ) )
pt2 = irit.point((-0.5), 0.5, 0)
irit.color(c1, irit.RED)
irit.adwidth(c1, 3)
irit.color(pt2, irit.RED)
irit.adwidth(pt2, 3)

t = 0
while (t <= 1):
    bisectcrv = irit.calphasector(irit.list(c1, pt2), t)
    irit.color(bisectcrv, irit.GREEN)
    irit.view(irit.list(irit.GetAxes(), c1, pt2, bisectcrv), irit.ON)
    t = t + 0.05

irit.save(
    "asect2d2",
    irit.list(c1, pt2, irit.calphasector(irit.list(c1, pt2), 0.1),
              irit.calphasector(irit.list(c1, pt2), 0.5),
              irit.calphasector(irit.list(c1, pt2), 1)))

irit.pause()

# ############################################################################
#
#  A point and a circle in the XY plane
#
c1 = irit.pcircle((0.3, 0.2, 0), 1.1)
Exemple #26
0
    irit.SetResolution(20)
    antennas = irit.list(
        antantenna() * irit.ry((-110)) * irit.trans(((-0.02), 0.2, 1.6)),
        antantenna() * irit.ry((-70)) * irit.trans((0.02, 0.2, 1.6)))
    irit.attrprop(antennas, "u_resolution", irit.GenRealObject(0.2))
    body = (body + irit.gpolygon(antennas, 1))
    irit.attrib(body, "rgb", irit.GenStrObject("255,50,50"))
    irit.SetResolution(save_res)
    retval = irit.list(
        body, llegs, rlegs,
        eyes) * irit.sz(1.3) * irit.sc(1) * irit.ty(0.28785) * irit.rx(90)
    mov_y = irit.creparam( irit.ctlpt( irit.E1, 0 ) + \
                            irit.ctlpt( irit.E1, (-1 ) ), 0, 1.2 )
    irit.attrib(retval, "animation", mov_y)
    return retval


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

b = (-irit.planesrf((-6), (-6), 6, 6))

all = irit.list(b, irit.GetAxes(), antanim(1))

irit.view(all, irit.ON)

irit.save("ant_anim.itd", all)
irit.pause()

irit.free(b)
irit.free(all)
Exemple #27
0
                                 irit.ctlpt( irit.E2, 0.6, 0.3 ), \
                                 irit.ctlpt( irit.E2, (-0.6 ), 0.3 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.sc( 2 )
d = irit.duality(irit.coerce(c, irit.KV_OPEN))
irit.color(d, irit.YELLOW)

irit.interact(irit.list(c, d))

#
#  An exact circle
#

c = irit.circle((0, 0, 0), 1.1)
d = irit.duality(irit.coerce(c, irit.KV_OPEN))
irit.color(d, irit.YELLOW)

irit.interact(irit.list(c, d, irit.GetAxes()))

c1 = irit.pcircle((0, 0, 0), 1.1)
d1 = irit.duality(irit.coerce(c1, irit.KV_OPEN))
irit.color(d1, irit.YELLOW)

irit.interact(irit.list(c, d, c1, d1, irit.GetAxes()))

#
#  A piecewise linear curve
#
c = irit.cbspline( 2, irit.list( irit.ctlpt( irit.E2, (-0.227 ), 0.243 ), \
                                 irit.ctlpt( irit.E2, (-0.0522 ), 0.203 ), \
                                 irit.ctlpt( irit.E2, (-0.151 ), (-0.0858 ) ), \
                                 irit.ctlpt( irit.E2, (-0.142 ), (-0.219 ) ), \
                                 irit.ctlpt( irit.E2, (-0.00121 ), (-0.288 ) ), \
irit.free(pocket4c)

# ############################################################################
#
#  2D pocketing: CNC
#

import cnc_ltrs

#
#  Deformed letters "CNC"
#

irit.color(cnc_ltrs.cnc, irit.RED)

irit.view(irit.list(irit.GetAxes(), cnc_ltrs.cnc), irit.ON)

tpath = irit.list( irit.ncpcktpath( cnc_ltrs.cnc * irit.rz( 90 ), 0.003, 0.005, 0.01, 0.1, 0,\
1 ) ) * irit.rz( (-90 ) )
irit.attrib(tpath, "ncretractzlevel", irit.GenRealObject(0.5))
irit.attrib(tpath, "ncmaxxybridgegap", irit.GenRealObject(0.05))

irit.interact(irit.list(irit.GetAxes(), tpath))

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)
Exemple #29
0
irit.viewstate( "polyaprx", 1 )
irit.viewstate( "polyaprx", 1 )
irit.viewstate( "drawstyle", 1 )
irit.viewstate( "depthcue", 0 )
irit.viewstate( "dsrfpoly", 1 )

# ############################################################################
# 
#  Polygons:
# 
# ############################################################################

pl = irit.poly( irit.list(  ( 1, 0, 0 ),  ( 0, (-0.8 ), 0 ), irit.point( (-0.5 ), 0, 0 ) ), irit.FALSE )
ppl = plgntoplln( pl )

irit.interact( irit.list( irit.GetAxes(), ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) )

angle = 18
while ( angle < 19.4 ):
    irit.printf( "angle = %.2f\n", irit.list( angle ) )
    irit.view( irit.list( ppl, gammakernelpolysrfs( pl, angle, 2 ) * irit.sz( (-1 ) ) ), irit.ON )
    angle = angle + 0.1

irit.pause(  )

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

pl = irit.poly( irit.list(  ( 0.9, 0, 0 ),  ( 0, (-0.9 ), 0 ), irit.point( (-0.8 ), 0, 0 ), irit.point( (-0.5 ), 0, 0 ), irit.point( 0, 1, 0 ), irit.point( 0.5, 0, 0 ) ), irit.FALSE )
ppl = plgntoplln( pl )

irit.interact( irit.list( irit.GetAxes(), ppl, gammakernelpolysrfs( pl, 25, 2 ) * irit.sz( (-1 ) ) ) )
            diamline = pt1 + pt2
        irit.snoc( irit.list( pt1 + pt2, pt1 * irit.tx( 0 ), pt2 * irit.tx( 0 ) ), retval )
        i = i + 1
    irit.color( retval, irit.YELLOW )
    irit.color( diamline, irit.CYAN )
    irit.adwidth( diamline, 3 )
    irit.snoc( irit.list( diamline ), retval )
    return retval

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

c1 = irit.pcircle( ( 0.1, 0.2, 0.3 ), 0.7 ) * irit.sy( 0.5 )

apline1 = evalantipodalptsoncrv( c1 )

irit.interact( irit.list( irit.GetAxes(), apline1, c1 ) )

c2 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E2, 0.707, 0.304 ), \
                                  irit.ctlpt( irit.E2, 0.317, (-0.1 ) ), \
                                  irit.ctlpt( irit.E2, (-0.052 ), 0.147 ), \
                                  irit.ctlpt( irit.E2, (-0.159 ), 0.682 ), \
                                  irit.ctlpt( irit.E2, (-0.592 ), 0.039 ), \
                                  irit.ctlpt( irit.E2, (-0.646 ), (-0.254 ) ), \
                                  irit.ctlpt( irit.E2, (-0.313 ), (-0.532 ) ), \
                                  irit.ctlpt( irit.E2, (-0.568 ), (-0.145 ) ), \
                                  irit.ctlpt( irit.E2, (-0.402 ), 0.336 ), \
                                  irit.ctlpt( irit.E2, (-0.272 ), 0.134 ), \
                                  irit.ctlpt( irit.E2, (-0.168 ), 0.241 ), \
                                  irit.ctlpt( irit.E2, (-0.056 ), 0.641 ), \
                                  irit.ctlpt( irit.E2, 0.272, (-0.069 ) ), \
                                  irit.ctlpt( irit.E2, 0.361, (-0.173 ) ), \