Пример #1
0
def display(c1, pt, bisrf):
    irit.color(c1, irit.YELLOW)
    irit.adwidth(c1, 3)
    irit.color(irit.point(pt[0], pt[1], pt[2]), irit.GREEN)
    irit.adwidth(irit.point(pt[0], pt[1], pt[2]), 3)
    irit.color(bisrf, irit.MAGENTA)
    irit.view(irit.list(c1, pt, bisrf), irit.ON)
Пример #2
0
def genanimationorthomatchcrvpts(ppl, crv, scl):
    pt1 = irit.point(0, 0, 0)
    pt2 = irit.point(0, 0, 0)
    vec1 = ( irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 0, scl ) )
    irit.color(vec1, irit.YELLOW)
    vec2 = ( \
              irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 0, scl ) )
    irit.color(vec2, irit.CYAN)
    pos1 = irit.nil()
    pos2 = irit.nil()
    rot1 = irit.nil()
    rot2 = irit.nil()
    i = 0
    while (i <= irit.SizeOf(ppl) - 1):
        pl = irit.coord(ppl, i)
        j = 0
        while (j <= irit.SizeOf(pl) - 1):
            pt = irit.coord(pl, j)
            t1 = irit.coord(pt, 0)
            t2 = irit.coord(pt, 1)
            if (t1 > t2):
                irit.snoc(
                    irit.coerce(irit.ceval(crv, irit.FetchRealObject(t1)),
                                irit.POINT_TYPE), pos1)
                irit.snoc(
                    irit.coerce(irit.ceval(crv, irit.FetchRealObject(t2)),
                                irit.POINT_TYPE), pos2)
                n1 = irit.cnormal(crv, irit.FetchRealObject(t1))
                n2 = irit.cnormal(crv, irit.FetchRealObject(t2))
                irit.snoc(
                    irit.vector(
                        math.atan2(irit.FetchRealObject(irit.coord(n1, 0)),
                                   irit.FetchRealObject(irit.coord(n1, 1))) *
                        180 / math.pi, 0, 0), rot1)
                irit.snoc(
                    irit.vector(
                        math.atan2(irit.FetchRealObject(irit.coord(n2, 0)),
                                   irit.FetchRealObject(irit.coord(n2, 1))) *
                        180 / math.pi, 0, 0), rot2)
            j = j + 1
        if (t1 > t2):
            irit.snoc(irit.vector(10000, 0, 0), pos1)
            irit.snoc(irit.vector(10000, 0, 0), pos2)
            irit.snoc(irit.vector(0, 0, 0), rot1)
            irit.snoc(irit.vector(0, 0, 0), rot2)
        i = i + 1
    irit.attrib(pt1, "animation", makerottransanimobj(irit.nil(), pos1))
    irit.attrib(pt2, "animation", makerottransanimobj(irit.nil(), pos2))
    irit.attrib(vec1, "animation", makerottransanimobj(rot1, pos1))
    irit.attrib(vec2, "animation", makerottransanimobj(rot2, pos2))
    retval = irit.list(pt1, pt2, vec1, vec2)
    return retval
Пример #3
0
def computeorthovector(theta1, theta2, phi1, phi2):
    theta1d = theta1 * math.pi / 180
    theta2d = theta2 * math.pi / 180
    phi1d = phi1 * math.pi / 180
    phi2d = phi2 * math.pi / 180
    pt1 = irit.point(
        math.cos(theta1d) * math.cos(phi1d),
        math.cos(theta1d) * math.sin(phi1d), math.sin(theta1d))
    pt2 = irit.point(
        math.cos(theta2d) * math.cos(phi2d),
        math.cos(theta2d) * math.sin(phi2d), math.sin(theta2d))
    retval = irit.coerce(irit.normalizePt(pt1 ^ pt2), irit.VECTOR_TYPE)
    irit.attrib(retval, "dwidth", irit.GenRealObject(3))
    irit.color(retval, irit.GREEN)
    return retval
Пример #4
0
def rook(s, clr):
    rookbase = (-irit.surfprev( ( irit.ctlpt( irit.E2, 0.001, 0.55 ) + \
                                   irit.ctlpt( irit.E2, 0.11, 0.55 ) + \
                                   irit.ctlpt( irit.E2, 0.11, 0.63 ) + \
                                   irit.ctlpt( irit.E2, 0.13, 0.63 ) + irit.cbspline( 3, irit.list( \
                                   irit.ctlpt( irit.E2, 0.13, 0.53 ), \
                                   irit.ctlpt( irit.E2, 0.05, 0.51 ), \
                                   irit.ctlpt( irit.E2, 0.07, 0.29 ), \
                                   irit.ctlpt( irit.E2, 0.18, 0.12 ), \
                                   irit.ctlpt( irit.E2, 0.18, 0 ) ), irit.list( irit.KV_OPEN ) ) ) * irit.rx( 90 ) ) )
    axs = irit.crefine( irit.creparam( irit.pcircle( ( 0, 0, 0 ), 1 ), 0, 1 ),\
    0, irit.list( 0.05, 0.1, 0.15, 0.2, 0.3, 0.35,\
    0.4, 0.45, 0.55, 0.6, 0.65, 0.7,\
    0.8, 0.85, 0.9, 0.95 ) )
    scl = irit.cbspline( 2, irit.list( \
                                   irit.ctlpt( irit.E2, 0, 0.01 ), \
                                   irit.ctlpt( irit.E2, 0.5, 0.01 ), \
                                   irit.ctlpt( irit.E2, 0.5, 1 ), \
                                   irit.ctlpt( irit.E2, 1, 1 ), \
                                   irit.ctlpt( irit.E2, 0, 0.01 ) ), irit.list( 0, 0, 0.7, 0.701, 1.999, 2,\
    3 ) )
    scl = irit.creparam( scl + scl * irit.tx( 1 ) + scl * irit.tx( 2 ) + scl * irit.tx( 3 ) + scl * irit.tx( 4 ) + scl * irit.tx( 5 ) + \
                                   irit.ctlpt( irit.E2, 6, 0.01 ), 0, 1 )
    rookwall = irit.swpsclsrf( \
                                   irit.ctlpt( irit.E2, (-0.08 ), 0 ) + \
                                   irit.ctlpt( irit.E2, 0.08, 0 ) + \
                                   irit.ctlpt( irit.E2, 0.08, 0.6 ) + \
                                   irit.ctlpt( irit.E2, (-0.08 ), 0.6 ) + \
                                   irit.ctlpt( irit.E2, (-0.08 ), 0 ), axs, scl, irit.point( 0, 0, 1 ), 2 ) * irit.sc( 0.12 ) * irit.tz( 0.63 )
    irit.attrib(rookwall, "rgb", irit.GenStrObject("255,255,100"))
    irit.attrib(rookbase, "rgb", irit.GenStrObject(clr))
    retval = irit.list(rookbase, rookwall) * irit.sc(s)
    return retval
Пример #5
0
def buildvisibilitymap( c, step, highlightangle ):
    retval = irit.nil(  )
    i = 0
    while ( i <= 360 ):
        dir =  irit.point( math.cos( i * math.pi/180 ), math.sin( i * 3.14159/180 ), 0 )
        crvs = irit.cvisible( c, irit.Fetch3TupleObject(dir), 1e-005 )
        crvdmn = cnvrtcrvs2domains( crvs, i )
        if ( highlightangle == i ):
            irit.attrib( crvdmn, "width", irit.GenRealObject(0.01 ))
            irit.attrib( crvdmn, "gray", irit.GenRealObject(0 ))
            irit.attrib( crvdmn, "rgb", irit.GenStrObject("255, 255, 128" ))
            irit.adwidth( crvdmn, 3 )
            highcrvdmn = crvdmn * irit.sx( 1/360.0 )
            irit.attrib( crvs, "width", irit.GenRealObject(0.03 ))
            irit.adwidth( crvs, 3 )
            irit.attrib( crvs, "rgb", irit.GenStrObject("255, 255, 128" ))
            irit.snoc( crvs, retval )
        else:
            irit.attrib( crvdmn, "width", 0.01 )
            irit.attrib( crvdmn, "gray", 0.5 )
            irit.attrib( crvdmn, "rgb", "128, 128, 255" )
            irit.snoc( crvdmn * irit.sx( 1/360 ), retval )
        i = i + step
    retval = ( retval + irit.list( highcrvdmn ) )
    return retval
Пример #6
0
def buildvisibilitymap( c, step ):
    retval = irit.nil(  )
    i = 0
    while ( i <= 360 ):
        dir = irit.point( math.cos( i * math.pi/180 ), math.sin( i * math.pi/180 ), 0 )
        crvs = irit.cvisible( c, dir, 1e-005 )
        irit.snoc( cnvrtcrvs2domains( crvs, i ) * irit.sx( 1/360.0 ), retval )
        i = i + step
    return retval
Пример #7
0
def evalsrfrayinter(raypt, raydir, srf):
    raygeom = irit.list(
        irit.coerce(irit.point(raypt[0], raypt[1], raypt[2]), irit.E3) +
        irit.coerce(
            irit.point(raypt[0], raypt[1], raypt[2]) +
            irit.vector(raydir[0], raydir[1], raydir[2]), irit.E3),
        irit.point(raypt[0], raypt[1], raypt[2]))
    irit.color(raygeom, irit.MAGENTA)
    interpts = irit.srayclip(raypt, raydir, srf)
    numinters = irit.FetchRealObject(irit.nth(interpts, 1))
    intere3 = irit.nil()
    i = 1
    while (i <= numinters):
        irit.snoc(irit.nth(interpts, i * 2 + 1), intere3)
        i = i + 1
    irit.color(intere3, irit.YELLOW)
    retval = irit.list(raygeom, intere3)
    return retval
Пример #8
0
def forest3(n, m, blevel, level):
    retval = irit.nil()
    i = 0
    while (i <= n):
        j = 0
        while (j <= m):
            irit.snoc( virttree3( irit.point( i * 5, j * 5, 0 ), irit.vector( 0, 0, 1 ), 0.3, blevel, level ),\
            retval )
            j = j + 1
        i = i + 1
    return retval
Пример #9
0
def randompts3d(n):
    l = irit.nil()
    i = 1
    while (i <= n):
        irit.snoc(
            irit.point(irit.random((-1), 1), irit.random((-1), 1),
                       irit.random((-1), 1)), l)
        i = i + 1
    retval = l
    irit.color(retval, irit.GREEN)
    irit.adwidth(retval, 5)
    return retval
Пример #10
0
def menugengeometry(menuitems, itemsize, minx, miny, maxx, maxy):
    n = irit.SizeOf(menuitems)
    retval = irit.nil()
    i = 0
    while (i <= n - 1):
        x1 = minx
        x2 = maxx
        y1 = miny + (maxy - miny) * i / n
        y2 = y1 + (maxy - miny) * 0.8 / n
        irit.snoc(
            irit.list(
                irit.poly(
                    irit.list((x1, y1, 0), irit.point(x1, y2, 0),
                              irit.point(x2, y2, 0), irit.point(x2, y1, 0),
                              irit.point(x1, y1, 0)), 1),
                irit.textgeom(irit.FetchStrObject(irit.nth(menuitems, i + 1)),
                              (itemsize * 0.06, 0, 0), itemsize * 0.06) *
                irit.trans((x1 + itemsize * 0.07, (y1 + y2) / 2, 0))), retval)

        i = i + 1
    return retval
Пример #11
0
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(
                math.cos(theta) * math.cos(phi),
                math.cos(theta) * math.sin(phi), math.sin(theta)), ptlist)
        t = t + 1
    retval = irit.cbspline(2, ptlist, irit.list(irit.KV_OPEN))
    irit.attrib(retval, "dwidth", irit.GenRealObject(3))
    irit.color(retval, irit.RED)
    return retval
Пример #12
0
def boundingellipse(pt1, pt2, pt3):
    m = irit.map3pt2eql( irit.Fetch3TupleObject(pt1), \
       irit.Fetch3TupleObject(pt2), \
       irit.Fetch3TupleObject(pt3) )
    minv = m ^ (-1)
    pt = m * pt1
    r = math.sqrt(irit.FetchRealObject(pt * pt))
    el = irit.nil()
    j = 0
    while (j <= 360):
        irit.snoc(
            irit.point(r * math.cos(j * math.pi / 180),
                       r * math.sin(j * math.pi / 180), 0) * minv, el)
        j = j + 10
    retval = irit.poly(el, irit.TRUE)
    irit.color(retval, irit.YELLOW)
    return retval
Пример #13
0
def pyramidprisa(n, s):
    pts = irit.nil()
    i = 0
    while (i <= n):
        irit.snoc(
            irit.point(math.cos(i * 2 * math.pi / n),
                       math.sin(i * 2 * 3.14159 / n), 0), pts)
        i = i + 1
    retval = irit.list(irit.poly(pts, 1))

    i = 1
    while (i <= n):
        irit.snoc( irit.poly( irit.list( irit.nth( pts, i ), \

         irit.nth( pts, i + 1 ), \
         ( irit.nth( pts, i ) + irit.nth( pts, i + 1 ) ) * s ), 0 ), retval )
        i = i + 1
    return retval
Пример #14
0
def genanimationorthomatchprmpts(ppl):
    prm1 = ( irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 0, 1 ) )
    irit.color(prm1, irit.YELLOW)
    prm2 = ( \
              irit.ctlpt( irit.E2, 0, 0 ) + \
              irit.ctlpt( irit.E2, 1, 0 ) )
    irit.color(prm2, irit.CYAN)
    pos1 = irit.nil()
    pos2 = irit.nil()
    pos12 = irit.nil()
    i = 0
    while (i <= irit.SizeOf(ppl) - 1):
        pl = irit.coord(ppl, i)
        j = 0
        while (j <= irit.SizeOf(pl) - 1):
            pt = irit.coord(pl, j)
            t1 = irit.coord(pt, 0)
            t2 = irit.coord(pt, 1)
            if (t1 > t2):
                irit.snoc(irit.vector(irit.FetchRealObject(t1), 0, 0), pos1)
                irit.snoc(irit.vector(0, irit.FetchRealObject(t2), 0), pos2)
                irit.snoc(pt, pos12)
            j = j + 1
        if (t1 > t2):
            irit.snoc(irit.vector(10000, 0, 0), pos1)
            irit.snoc(irit.vector(10000, 0, 0), pos2)
        i = i + 1
    pt = irit.point(0, 0, 0)
    irit.color(pt, irit.RED)
    irit.adwidth(pt, 3)
    irit.attrib(pt, "animation", makerottransanimobj(irit.nil(), pos12))
    irit.attrib(prm1, "animation", makerottransanimobj(irit.nil(), pos1))
    irit.attrib(prm2, "animation", makerottransanimobj(irit.nil(), pos2))
    retval = irit.list(pt, prm1, prm2)
    return retval
Пример #15
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
Пример #16
0
irit.viewstate("dblbuffer", 1)
irit.viewstate("depthcue", 1)

dlevel = irit.iritstate("dumplevel", irit.GenIntObject(255))

#  Faster product using Bezier decomposition.
iprod = irit.iritstate("bspprodmethod", irit.GenIntObject(0))

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

pl2 = irit.nil()
x = 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)
Пример #17
0
linearlowenv = irit.carrangmnt(crvs, 1e-012, 3, irit.GenRealObject(0))
irit.attrib(linearlowenv, "rgb", irit.GenStrObject("255, 255, 200"))
irit.adwidth(linearlowenv, 5)

all = irit.list(irit.GetAxes(), crvs, linearlowenv * irit.tz((-0.2)))
irit.interact(all)

irit.save("crv3arng", all)
# ############################################################################

crvs = randomcrvs(8, 3, 3, 0.8, 2)
b = irit.bbox(crvs)
crvs = crvs * irit.ty(0.1 - irit.FetchRealObject(irit.coord(b, 3)))
irit.free(b)

radiallowenv = irit.carrangmnt(crvs, 1e-012, 4, irit.point(0, 0, 0))
irit.attrib(radiallowenv, "rgb", irit.GenStrObject("255, 255, 200"))
irit.adwidth(radiallowenv, 5)

all = irit.list(irit.GetAxes(), crvs, radiallowenv * irit.tz((-0.2)))
irit.interact(all)

irit.save("crv4arng", all)

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

c1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-0.2 ), 0.5 ), \
                                  irit.ctlpt( irit.E2, 0.2, 0.5 ), \
                                  irit.ctlpt( irit.E2, 0.1, 0.2 ) ), irit.list( irit.KV_PERIODIC ) )
c1 = irit.coerce(c1, irit.KV_OPEN)
Пример #18
0
logo1 = irit.list(circ, star)

irit.interact(logo1)

irit.save("logo1", logo1)

irit.free(logo1)

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

eps = 0.12
poly1 = irit.poly(
    irit.list(
        ((-1.8) - eps, (-0.2) - eps, 0),
        ((-1.8) - eps, 0.2 + eps, 0), irit.point(1.8 + eps, 0.2 + eps, 0),
        irit.point(1.8 + eps, (-0.2) - eps, 0)), 0) * irit.tz((-0.04))

irit.color(poly1, irit.BLUE)
irit.attrib(poly1, "rgb", irit.GenStrObject("0,0,8"))
poly2 = irit.poly(
    irit.list(((-1.8), (-0.2), 0), ((-1.8), 0.2, 0), irit.point(1.8, 0.2, 0),
              irit.point(1.8, (-0.2), 0)), 0) * irit.tz((-0.03))

irit.color(poly2, irit.WHITE)
poly3 = irit.poly(
    irit.list(((-1.8), (-0.07), 0), ((-1.8), 0.07, 0), irit.point(
        1.8, 0.07, 0), irit.point(1.8, (-0.07), 0)), 0) * irit.tz((-0.02))

irit.color(poly3, irit.RED)
Пример #19
0
pt_min = irit.ceval(
    crv3, irit.FetchRealObject(irit.crvptdst(crv3, (0, 0, 0), 1, 0.001)))
irit.interact(
    irit.list(irit.GetAxes(), crv3, irit.coerce(pt_min, irit.VECTOR_TYPE)))
pt_max = irit.ceval(
    crv3, irit.FetchRealObject(irit.crvptdst(crv3, (0, 0, 0), 0, 0.001)))
irit.interact(
    irit.list(irit.GetAxes(), crv3, irit.coerce(pt_max, irit.VECTOR_TYPE)))
irit.save(
    "crv6dist",
    irit.list(irit.GetAxes(), crv3, irit.coerce(pt_max, irit.VECTOR_TYPE)))

#
#  Curve line distance.
#
line_pt = irit.point((-1), 1.2, 0)
line_vec = irit.vector(1, (-1), 0)
line_pt2 = line_pt + line_vec * 2
line = irit.poly(irit.list(line_pt, line_pt2), irit.TRUE)
crv1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 1.5, (-0.5 ) ), \
                                    irit.ctlpt( irit.E2, 0.5, (-1 ) ), \
                                    irit.ctlpt( irit.E2, (-1.5 ), (-0.5 ) ), \
                                    irit.ctlpt( irit.E2, 2.5, 0 ), \
                                    irit.ctlpt( irit.E2, (-1.5 ), 0.5 ) ), irit.list( irit.KV_OPEN ) )
irit.color(crv1, irit.GREEN)
irit.attrib(crv1, "width", irit.GenRealObject(0.02))

pt_param = irit.crvlndst( crv1, \
        irit.Fetch3TupleObject(line_pt), \
        irit.Fetch3TupleObject(line_vec), \
        0, \
Пример #20
0
stopper = irit.box((6.85, 2.05, 7.37), 0.9, 0.9, 0.13)

rot_y = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                 irit.ctlpt( irit.E1, (-80 ) ) ) )
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
Пример #21
0
#  Set states.
#
save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.GetViewMatrix() * irit.sc(0.35))
irit.viewobj(irit.GetViewMatrix())

#  Faster product using Bezier decomposition.
iprod = irit.iritstate("bspprodmethod", irit.GenIntObject(0))

# ############################################################################
#
#  A point and a line in the XY plane
#
c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-0.3 ), (-1 ) ), \
                              irit.ctlpt( irit.E2, (-0.3 ), 1 ) ) )
pt2 = irit.point(0.4, 0.2, 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(c1, pt2, bisectcrv), irit.ON)
    t = t + 0.03

irit.save(
    "asect2d1",
    irit.list(c1, pt2, irit.calphasector(irit.list(c1, pt2), 0.1),
Пример #22
0
#  A helix and a point
#

helix = irit.pcircle((0, 0, 0), 1) * irit.rz(90) * irit.ry((-90))
i = 0
while (i <= irit.SizeOf(helix) - 1):
    pth = irit.coord(helix, i)
    helix = irit.ceditpt(
        helix,
        irit.ctlpt(irit.E3, i / 4, irit.coord(pth, 2), irit.coord(pth, 3)), i)
    i = i + 1
helix = (helix + helix * irit.tx(9 / 4)) * irit.sx(0.5)
irit.color(helix, irit.RED)
irit.adwidth(helix, 3)

pt = irit.point(1.2, 0, 0)
irit.color(pt, irit.YELLOW)
irit.adwidth(pt, 3)

bisectsrf = irit.cbisector3d(irit.list(helix, pt), 1)
irit.color(bisectsrf, irit.GREEN)

irit.interact(irit.list(helix, pt, bisectsrf))

irit.save("bisectr6", irit.list(helix, pt, bisectsrf))

# ############################################################################
#
#  A bilinear surface: sphere--plane bisector
#
s1 = irit.ruledsrf( irit.ctlpt( irit.E3, (-1 ), (-1 ), 0 ) + \
Пример #23
0
irit.interact(
    irit.list(evalgaussiancrvs(bump, 1, (-1), 0.3, 0.2),
              evalmeancrvs(bump, 1, 0, 1, 0.1), bump))

irit.free(bump)

pl = irit.nil()
pll = irit.nil()
x = (-3)
while (x <= 3):
    pl = irit.nil()
    y = (-3)
    while (y <= 3):
        irit.snoc(
            irit.point(x, y,
                       math.sin(x * math.pi / 2) * math.cos(y * math.pi / 2)),
            pl)
        y = y + 1
    irit.snoc(pl, pll)
    x = x + 1

eggbase = irit.sinterp(pll, 4, 4, 0, 0, irit.PARAM_UNIFORM)
irit.color(eggbase, irit.WHITE)
irit.free(pl)
irit.free(pll)

irit.SetResolution(20)
param = irit.sparabolc(eggbase, 1)
irit.color(param, irit.RED)

irit.interact(irit.list(eggbase, param))
Пример #24
0
        equapt )
    else:
        all = irit.list( prim1, prim2, prim3, circs )
    if ( irit.SizeOf( irit.GenStrObject(fname) ) > 0 ):
        irit.save( fname, all )
    irit.view( all, irit.ON )

save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(  irit.sc( 0.8 ))
irit.viewobj( irit.GetViewMatrix() )

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

i = 0
while ( i <= 20 ):
    pt1 =  irit.point( irit.random( (-0.5 ), 0.5 ), irit.random( (-0.5 ), 0.5 ), 0 )
    pt2 =  irit.point( irit.random( (-0.5 ), 0.5 ), irit.random( (-0.5 ), 0.5 ), 0 )
    pt3 =  irit.point( irit.random( (-0.5 ), 0.5 ), irit.random( (-0.5 ), 0.5 ), 0 )
    skel2dcolor( pt1, pt2, pt3, 0.01, irit.list( 0.01, (-1e-010 ) ), 1, "" )
    irit.milisleep( delay )
    i = i + 1

skel2dcolor( pt1, pt2, pt3, 0.01, irit.list( 0.01, (-1e-010 ) ), 1, "skel2d1" )
irit.pause(  )

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

i = 0
while ( i <= 20 ):
    ln1 = irit.ctlpt( irit.E2, irit.random( (-1 ), 1 ), irit.random( (-1 ), 1 ) ) + \
           irit.ctlpt( irit.E2, irit.random( (-1 ), 1 ), irit.random( (-1 ), 1 ) )
Пример #25
0
           dumvar,\
           modaxes(), \
           dumvar ) )

irit.free(dumvar)


#
#  Make sure operator overloading is still valid inside a function:
#
def add(x, y):
    retval = (x + y)
    return retval

irit.save( "functn4", irit.list( add( 1, 2 ), \
         add( irit.vector( 1, 2, 3 ),  irit.point( 1, 2, 3 ) ), \
         add( irit.box( ( (-3 ), (-2 ), (-1 ) ), 6, 4, 2 ), \
           irit.box(( (-4 ), (-3 ), (-2 ) ), 2, 2, 4 ) ) ) )

#
#  Prisa (layout) of pyramids
#


def pyramidprisa(n, s):
    pts = irit.nil()
    i = 0
    while (i <= n):
        irit.snoc(
            irit.point(math.cos(i * 2 * math.pi / n),
                       math.sin(i * 2 * 3.14159 / n), 0), pts)
Пример #26
0
        tr2 = virttree3(
            newpos,
            rotatevector2(dir, rfactor * irit.random((-1), 1)) * lfactor,
            size * wfactor, blevel, level - 1)
        tr3 = virttree3(newpos,
                        rotatevector2(dir, (-rfactor)) * lfactor,
                        size * wfactor, blevel, level - 1)
        retval = retval + tr1 + tr2 + tr3
    return retval


irit.SetViewMatrix(
    irit.rotx((-90)) * irit.roty(135) * irit.rotx((-30)) * irit.scale(
        (0.2, 0.2, 0.2)) * irit.trans((0, (-0.5), 0)))

tree1 = virttree2(irit.point(0, 0, 0), irit.vector(0, 0, 1), 0.3, 4, 7)
irit.interact(irit.list(irit.GetViewMatrix(), tree1))
irit.free(tree1)

tree2 = virttree3(irit.point(0, 0, 0), irit.vector(0, 0, 1), 0.5, 3, 5)
irit.interact(tree2)
irit.free(tree2)


def forest3(n, m, blevel, level):
    retval = irit.nil()
    i = 0
    while (i <= n):
        j = 0
        while (j <= m):
            irit.snoc( virttree3( irit.point( i * 5, j * 5, 0 ), irit.vector( 0, 0, 1 ), 0.3, blevel, level ),\
Пример #27
0
irit.interact(irit.list(ch, p))
irit.save("ffcnvhl2", irit.list(p, ch))

#
#  Tangents to curve through a point.
#

irit.viewclear()
p = (0, 1, 0)
t1c0 = irit.crvpttan(c0, p, 0.01)
i = 1
while (i <= irit.SizeOf(t1c0)):
    irit.viewobj(
        irit.ceval(c0, irit.FetchRealObject(irit.nth(t1c0, i))) +
        irit.coerce(irit.point(p[0], p[1], p[2]), irit.E3))
    i = i + 1
irit.viewobj(irit.list(p, c0))
irit.pause()

irit.viewclear()
p = (1, 1, 0)
t1c1 = irit.crvpttan(c1, p, 0.01)
i = 1
while (i <= irit.SizeOf(t1c1)):
    irit.viewobj(
        irit.ceval(c1, irit.FetchRealObject(irit.nth(t1c1, i))) +
        irit.coerce(irit.point(p[0], p[1], p[2]), irit.E3))
    i = i + 1
irit.viewobj(irit.list(p, c1))
irit.pause()
Пример #28
0
#This is an IRIT script and as such requires both math and irit import:
#
import math
import irit
#

#
#  A puzzle of transparent boxes in ball inside.
#
#                                        Gershon Elber, June 1996

sqr1 = irit.poly(
    irit.list(irit.point((-1), (-1), 1), irit.point((-1), 1, 1),
              irit.point(1, 1, 1), irit.point(1, (-1), 1)), irit.FALSE)
sclfctr = 0.6
sqr2 = sqr1 * irit.sc((-sclfctr)) * irit.tz(sclfctr * 2)

trap1 = irit.poly(
    irit.list(
        irit.point((-1), (-1), 1) * irit.sc(sclfctr),
        irit.point((-1), 1, 1) * irit.sc(sclfctr), irit.point((-1), 1, 1),
        irit.point((-1), (-1), 1)), 0)
trap2 = trap1 * irit.rz(180)

prim1 = irit.list(sqr1, sqr2, trap1, trap2)
prim2 = prim1 * irit.rx(90)
prim3 = prim1 * irit.rx((-90))

baseunitaux = irit.list(prim1, prim2, prim3,
                        trap1 * irit.rx(90) * irit.ry((-90)),
                        trap2 * irit.rx((-90)) * irit.ry(90))
Пример #29
0
irit.viewstate( "numisos", 1 )
irit.viewstate( "numisos", 1 )
irit.viewstate( "polyaprx", 1 )
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 )
Пример #30
0
c2 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.2404, 0.8787, 0 ), \
                                  irit.ctlpt( irit.E2, (-0.1015 ), (-0.2361 ) ), \
                                  irit.ctlpt( irit.E2, (-0.8429 ), 0.9734 ), \
                                  irit.ctlpt( irit.E2, (-0.9849 ), (-0.3465 ) ), \
                                  irit.ctlpt( irit.E2, (-0.05939 ), (-0.499 ) ), \
                                  irit.ctlpt( irit.E2, 0.356, 0.7367 ), \
                                  irit.ctlpt( irit.E2, 0.3823, (-0.3834 ) ), \
                                  irit.ctlpt( irit.E2, 1.176, (-0.3465 ) ), \
                                  irit.ctlpt( irit.E2, 1.182, 0.3686 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.sc( 0.7 )
irit.color( c2, irit.GREEN )

pts = irit.nil(  )
i = 1
while ( i <= 12 ):
    irit.snoc(  irit.point( math.cos( i * math.pi/6 ), math.sin( i * 3.14159/6 ), 0 ) * irit.sc( irit.iseven( i ) + 0.15 ), pts )
    i = i + 1
c3 = irit.cbspline( 3, pts, irit.list( irit.KV_PERIODIC ) )
irit.color( c3, irit.GREEN )
irit.free( pts )

c4 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.631, 0.798, 0 ), \
                                  irit.ctlpt( irit.E2, 0.24, 0.604 ), \
                                  irit.ctlpt( irit.E2, 0.11, 0.942 ), \
                                  irit.ctlpt( irit.E2, (-0.187 ), 0.654 ), \
                                  irit.ctlpt( irit.E2, (-0.461 ), 0.721 ), \
                                  irit.ctlpt( irit.E2, (-0.267 ), 0.524 ), \
                                  irit.ctlpt( irit.E2, (-0.47 ), 0.492 ), \
                                  irit.ctlpt( irit.E2, (-0.272 ), 0.407 ), \
                                  irit.ctlpt( irit.E2, (-0.506 ), 0.303 ), \
                                  irit.ctlpt( irit.E2, (-0.254 ), 0.285 ), \