コード例 #1
0
ファイル: ant.py プロジェクト: AlessandroScrem/irit-sm_V11
def antanim(scl):
    save_res = irit.GetResolution()
    bodyall = antbody()
    body = irit.nth(bodyall, 1)
    eyes = irit.nth(bodyall, 2)
    llegs = irit.list(
        antlleganim(1) * irit.sc(1.1) * irit.sx(1.3) * irit.ry(
            (-45)) * irit.trans((0.1, 0, 1.02)),
        antlleganim((-1)) * irit.sc(1.3) * irit.ry(10) * irit.trans(
            (0.1, 0.05, 1)),
        antlleganim(1) * irit.sc(1.2) * irit.sx(1.4) * irit.ry(40) *
        irit.trans((0.1, 0.02, 0.95)))
    rlegs = irit.list(
        antrleganim(
            (-1)) * irit.sc(1.1) * irit.sx(1.3) * irit.ry(45) * irit.trans(
                ((-0.1), 0, 1.02)),
        antrleganim(1) * irit.sc(1.3) * irit.ry((-10)) * irit.trans(
            ((-0.1), 0.05, 1)),
        antrleganim((-1)) * irit.sc(1.2) * irit.sx(1.4) * irit.ry(
            (-40)) * irit.trans(((-0.1), 0.02, 0.95)))
    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
コード例 #2
0
ファイル: ant.py プロジェクト: AlessandroScrem/irit-sm_V11
def ant(scl):
    save_res = irit.GetResolution()
    bodyall = antbody()
    body = irit.nth(bodyall, 1)
    eyes = irit.nth(bodyall, 2)
    leg = antleg()
    llegs = irit.list(
        leg * irit.sc(1.1) * irit.sx(1.3) * irit.ry((-45)) * irit.trans(
            (0.1, 0, 1.02)),
        leg * irit.sc(1.3) * irit.ry(10) * irit.trans((0.1, 0.05, 1)),
        leg * irit.sc(1.2) * irit.sx(1.4) * irit.ry(40) * irit.trans(
            (0.1, 0.02, 0.95)))
    irit.SetResolution(20)
    irit.attrprop(llegs, "u_resolution", irit.GenRealObject(0.2))
    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(llegs, 1) + irit.gpolygon(llegs, 1) * irit.sx(
        (-1)) + irit.gpolygon(antennas, 1))
    irit.attrib(body, "rgb", irit.GenStrObject("255,50,50"))
    irit.SetResolution(save_res)
    retval = irit.list(
        body,
        eyes) * irit.sz(1.3) * irit.sc(1) * irit.ty(0.28785) * irit.rx(90)
    return retval
コード例 #3
0
def squareunitbars( w, d, h, legw, legd ):
    fbar = irit.box( ( legw, 0, 0 ), w - 2 * legw, legd, legw )
    sbar = irit.box( ( 0, legd, 0 ), legd, d - 2 * legd, legw )
    barframe = irit.list( fbar, sbar, fbar * irit.ty( d - legd ), sbar * irit.tx( w - legd ) )
    retval = irit.list( barframe * irit.tz( 0.1 ), barframe * irit.tz( h - 0.1 ) )
    irit.attrprop( retval, "ptexture", woodtext )
    irit.attrprop( retval, "rgb", woodclr )
    return retval
コード例 #4
0
def snakepiece(clr, xrot, ypos, zpos):
    retval = (irit.box((0, 0, (-0.1)), 1, 1.1, 1.1) - irit.box(
        (0, (-1), (-2)), 2, 3, 2) * irit.rx(45) * irit.tx((-0.5)))
    retval = retval * irit.sc(1.0 / math.sqrt(2)) * irit.rx(
        (-225)) * irit.trans(((-1) / (2.0 * math.sqrt(2)), 1, 0.5))
    retval = retval * irit.rx(xrot) * irit.ty(ypos) * irit.tz(zpos)
    irit.color(retval, clr)
    return retval
コード例 #5
0
def makebboxunit(obj):
    b = irit.bbox(obj)
    xmin = irit.FetchRealObjecy(irit.nth(b, 1))
    xmax = irit.nth(b, 2)
    ymin = irit.nth(b, 3)
    ymax = irit.nth(b, 4)
    retval = obj * irit.tx((-xmin)) * irit.ty(
        (-ymin)) * irit.sx(1.0 / (xmax - xmin)) * irit.sy(1.0 / (ymax - ymin))
    return retval
コード例 #6
0
ファイル: msc_ch.py プロジェクト: AlessandroScrem/irit-sm_V11
def genrandomcrv(d, n, size):
    ctlpts = irit.nil()
    i = 1
    while (i <= n):
        irit.snoc(
            irit.ctlpt(irit.E2, irit.random((-size), size),
                       irit.random((-size), size)), ctlpts)
        i = i + 1
    retval = irit.cbspline(
        d,
        ctlpts * irit.tx(irit.random((-1), 1)) * irit.ty(irit.random((-1), 1)),
        irit.list(irit.KV_PERIODIC))
    retval = irit.coerce(retval, irit.KV_OPEN)
    return retval
コード例 #7
0
ファイル: ant.py プロジェクト: AlessandroScrem/irit-sm_V11
def antantenna():
    c = irit.pcircle((0, 0, 0), 0.03) * irit.ry(90)
    retval = (-irit.sfromcrvs(
        irit.list(
            c * irit.sy(1.4) * irit.rz(45) * irit.tx(0.1) * irit.ty((-0.15)),
            c * irit.rz(45) * irit.tx(0.2) * irit.ty(0.2),
            c * irit.sy(1.4) * irit.tx(0.3) * irit.ty(0.4),
            c * irit.rz((-55)) * irit.tx(0.4) * irit.ty(0.15),
            c * irit.sc(0.8) * irit.rz((-45)) * irit.tx(0.5) * irit.ty((-0.1)),
            c * irit.sc(0.65) * irit.rz((-45)) * irit.tx(0.58) * irit.ty(
                (-0.22)),
            c * irit.sc(0.001) * irit.rz((-45)) * irit.tx(0.58) * irit.ty(
                (-0.22))), 3, irit.KV_OPEN))
    irit.attrib(retval, "rgb", irit.GenStrObject("255,50,50"))
    return retval
コード例 #8
0
def genrandomcrv(d, n, size):
    ctlpts = irit.nil()
    i = 1
    while (i <= n):
        irit.snoc(
            irit.ctlpt(irit.E2, irit.random((-size), size),
                       irit.random((-size), size)), ctlpts)
        i = i + 1
    if (irit.random(0, 1) > 0.3):
        kv = irit.KV_PERIODIC
    else:
        kv = irit.KV_OPEN
    retval = irit.cbspline(
        d,
        ctlpts * irit.tx(irit.random(
            (-0.2), 0.2)) * irit.ty(irit.random((-0.2), 0.2)), irit.list(kv))
    retval = irit.coerce(retval, irit.KV_OPEN)
    return retval
コード例 #9
0
def cornerunitwalls( w, h, legw, legd ):
    lwall = irit.box( ( legd, 0, 0.2 ), 2 * w - 2 * legd, 0.002, h - 0.3 )
    irit.attrib( lwall, "ptexture", woodtext )
    irit.attrib( lwall, "rgb", woodclr )
    swall = irit.box( ( legd, 0, 0.2 ), w - 2 * legd, 0.002, h - 0.3 )
    irit.attrib( swall, "transp", irit.GenRealObject(0.3 ))
    arcbar1 = irit.arc( ( w, 0, 0 ), ( w, w, 0 ), ( 2 * w, w, 0 ) )
    arcbar2 = irit.offset( arcbar1, irit.GenRealObject(-0.03 ), 0.1, 0 )
    arcbar = irit.list( irit.extrude( arcbar1 + (-arcbar2 ) + irit.ctlpt( irit.E3, w, 0, 0 ), ( 0, 0, 0.03 ), 0 ), irit.ruledsrf( arcbar1, arcbar2 ), irit.ruledsrf( arcbar1, arcbar2 ) * irit.tz( 0.03 ) )
    rdoorframe = irit.list( irit.box( ( w, 0, 0.2 ), 0.03, 0.03, h - 0.3 ),\
    irit.box( ( 2 * w - 0.03, w - 0.03, 0.2 ), 0.03, 0.03, h - 0.3 ),\
    arcbar * irit.tz( 0.2 ), arcbar * irit.tz( h - 0.1 - 0.03 ) )
    irit.attrib( rdoorframe, "ptexture", woodtext )
    irit.attrib( rdoorframe, "rgb", woodclr )
    rdoorglass = irit.extrude( irit.offset( arcbar1, irit.GenRealObject(-0.02 ), 0.1, 0 ) + (-irit.offset( arcbar1, irit.GenRealObject(-0.03 ), 0.1, 0 ) ) + \
                                                               irit.ctlpt( irit.E3, w - 0.02, 0, 0 ), ( 0, 0, h - 0.3 - 0.04 ), 0 ) * irit.tz( 0.22 )
    irit.attrib( rdoorglass, "transp", irit.GenRealObject(0.3 ))
    rdoor = irit.list( rdoorframe, rdoorglass )
    rot_z = ( \
                                                               irit.ctlpt( irit.E1, 0 ) + \
                                                               irit.ctlpt( irit.E1, 130 ) )
    irit.attrib( rdoor, "animation", irit.list( irit.tx( (-w ) ), rot_z, irit.tx( w ) ) )
    retval = irit.list( lwall * irit.ty( 2 * w ), swall * irit.rz( 90 ) * irit.tx( 2 * w ) * irit.ty( w ), lwall * irit.rz( 90 ), swall, rdoor )
    return retval
コード例 #10
0
                                  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 ), \
                                  irit.ctlpt( irit.E2, (-0.384 ), (-0.0247 ) ), \
                                  irit.ctlpt( irit.E2, 0.0562, (-0.272 ) ), \
                                  irit.ctlpt( irit.E2, (-0.218 ), 0.142 ), \
                                  irit.ctlpt( irit.E2, (-0.0157 ), 0.64 ), \
                                  irit.ctlpt( irit.E2, 0.501, 0.407 ), \
                                  irit.ctlpt( irit.E2, 0.362, 0.0247 ), \
                                  irit.ctlpt( irit.E2, 0.11, 0.407 ), \
                                  irit.ctlpt( irit.E2, 0.0112, 0.191 ), \
                                  irit.ctlpt( irit.E2, 0.231, (-0.173 ) ), \
                                  irit.ctlpt( irit.E2, 0.675, 0.057 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.ty( (-0.2 ) )
irit.color( c4, irit.GREEN )

c5 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E3, (-0.288 ), (-0.117 ), 0 ), \
                                  irit.ctlpt( irit.E2, (-0.248 ), 0.612 ), \
                                  irit.ctlpt( irit.E2, 0.452, 0.726 ), \
                                  irit.ctlpt( irit.E2, (-0.38 ), 0.939 ), \
                                  irit.ctlpt( irit.E2, (-1.19 ), 0.801 ), \
                                  irit.ctlpt( irit.E2, (-0.219 ), 0.663 ), \
                                  irit.ctlpt( irit.E2, (-0.592 ), 0.152 ), \
                                  irit.ctlpt( irit.E2, 0.0965, (-0.37 ) ), \
                                  irit.ctlpt( irit.E2, (-1.02 ), 0.198 ), \
                                  irit.ctlpt( irit.E2, (-1.18 ), (-0.387 ) ), \
                                  irit.ctlpt( irit.E2, (-0.529 ), (-0.238 ) ), \
                                  irit.ctlpt( irit.E2, (-0.856 ), (-0.524 ) ), \
                                  irit.ctlpt( irit.E2, (-0.213 ), (-0.415 ) ), \
コード例 #11
0
crvs = randomcrvs(11, 3, 3, 0.8, 2)

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 ), \
コード例 #12
0
ファイル: logos.py プロジェクト: AlessandroScrem/irit-sm_V11
irit.interact(logo3)

irit.save("logo3", logo3)

irit.free(logo3)

#
#  Israeli flag.
#

strip1 = irit.poly(
    irit.list(((-2), (-1.3), 0), (2, (-1.3), 0), irit.point(2, (-1.1), 0),
              irit.point((-2), (-1.1), 0)), irit.FALSE)
irit.color(strip1, irit.CYAN)

strip2 = strip1 * irit.ty(2.4)
irit.color(strip2, irit.CYAN)

backgrnd = irit.poly(
    irit.list(((-2), (-1.5), 0),
              (2, (-1.5), 0), irit.point(2, 1.5, 0), irit.point(
                  (-2), 1.5, 0)), 0) * irit.tz((-0.01))

irit.color(backgrnd, irit.WHITE)

isflag = irit.list(davidstar * irit.sc(0.7), strip1, strip2, backgrnd)

irit.interact(isflag)

irit.save("isflag", isflag)
コード例 #13
0
                                  irit.ctlpt( irit.E2, 0.052, 0.229 ), \
                                  irit.ctlpt( irit.E2, 0.047, 0.332 ) ), irit.list( irit.KV_PERIODIC ) )
c1 = irit.coerce(c1, irit.KV_OPEN)

drawbiarcs(c1, 0.25, 180)

drawbiarcs(c1, 0.1, 180)

drawbiarcs(c1, 0.01, 180)

irit.save("biarc2", irit.list(c1, irit.cbiarcs(c1, 0.01, 180)))

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

c1 = irit.cregion(irit.circle((0, 0, 0), 1), 0, 1) * irit.sc(0.25)
c1 = (c1 + c1 * irit.rz(90) * irit.tx((-0.5))) * irit.tx(0.25) * irit.ty(0.5)
c1 = (c1 + c1 * irit.rz(180) + irit.ctlpt(irit.E2, 0.5, 0.5))

drawbiarcs(c1, 0.25, 180)

drawbiarcs(c1, 0.1, 180)

drawbiarcs(c1, 1e-006, 180)

irit.save("biarc3", irit.list(c1, irit.cbiarcs(c1, 0.01, 180)))

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

irit.viewstate("pllnaprx", 0)
irit.viewstate("pllnaprx", 0)
コード例 #14
0
                all3)
    irit.pause()
    retval = irit.list(all1, all2, all3)
    return retval


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


crv1a = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0.2 ), \
                                 irit.ctlpt( irit.E2, 0.5, 4 ), \
                                 irit.ctlpt( irit.E2, 1.3, 0.05 ) ) ) * irit.sy( 0.2 )
crv2a = irit.cbezier( irit.list( \
                                 irit.ctlpt( irit.E1, (-0.2 ) ), \
                                 irit.ctlpt( irit.E2, 0.25, 1.9 ), \
                                 irit.ctlpt( irit.E2, 1.3, 0.05 ) ) ) * irit.ty( 0.3 ) * irit.sx( 1.5 )
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))))
コード例 #15
0
#

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)


def cubeat(x, y, z):
    retval = irit.box((x - size / 2.0, y - size / 2.0, z - size / 2.0), size,
                      size, size)
    irit.attrib(
        retval, "rgb",
        irit.GenStrObject(
            str(int(irit.random(64, 255))) + "," +
            str(int(irit.random(64, 255))) + "," +
            str(int(irit.random(64, 255)))))
コード例 #16
0
#
pt = (0.9, 0, 0)

helix = circ * irit.rotx(0)

i = 0
while (i <= irit.SizeOf(helix) - 1):
    pth = irit.coord(helix, i)
    helix = irit.ceditpt(
        helix,
        irit.ctlpt(irit.E3, i / 4, irit.FetchRealObject(irit.coord(pth, 2)),
                   irit.FetchRealObject(irit.coord(pth, 3))), i)
    i = i + 1

a = 0
while (a <= 1):
    c1y = irit.cmorph(circ, helix, 0, a)
    bisectsrf = irit.cbisector3d(irit.list(c1y, pt), 0)
    display(c1y, pt, bisectsrf)
    a = a + 0.1 * speed

a = 1
while (a <= 0):
    hel = irit.cregion(helix, 0, 0.999 * a + 0.0001) * irit.ty(1.1 * (1 - a))
    pt = ((-0.9) * a, 2.1 * a - 2.1, 0)
    bisectsrf = irit.cbisector3d(irit.list(hel, pt), 0)
    display(hel, pt, bisectsrf)
    a = a + (-0.02) * speed

# ############################################################################
コード例 #17
0
printtest("circle", irit.isgeom(pcirc, irit.GEOM_CIRCULAR, 0.01), 1)

irit.free(circ)
irit.free(pcirc)
irit.free(line)

#
#  Plane
#
pln = irit.ruledsrf( irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                     irit.ctlpt( irit.E3, 1, 0, 0 ), \
                     irit.ctlpt( irit.E3, 0, 2, 0 ) + \
                     irit.ctlpt( irit.E3, 1, 1, 0 ) )
printtest("plane", irit.isgeom(pln, irit.GEOM_PLANAR, 1e-010), 1)

pln = pln * irit.rx(45) * irit.rz(45) * irit.tx(1) * irit.ty((-2))
printtest("plane", irit.isgeom(pln, irit.GEOM_PLANAR, 1e-010), 1)

pln = irit.ruledsrf( irit.ctlpt( irit.E3, 0, 0, 0 ) + \
                     irit.ctlpt( irit.E3, 1, 0, 0 ), \
                     irit.ctlpt( irit.E3, 0, 2, 0 ) + \
                     irit.ctlpt( irit.E3, 1, 1, 1 ) )
printtest("plane", irit.isgeom(pln, irit.GEOM_PLANAR, 0.001), 0)

pln = irit.ruledsrf( irit.cbezier( irit.list( irit.ctlpt( irit.E3, (-1 ), 0, 10.01 ), \
                                              irit.ctlpt( irit.E3, 0, 0.2, 10.01 ), \
                                              irit.ctlpt( irit.E3, 1, 0, 10.01 ) ) ), irit.cbezier( irit.list( \
                                              irit.ctlpt( irit.E3, (-1 ), 1, 10.01 ), \
                                              irit.ctlpt( irit.E3, 0, 0.5, 10.01 ), \
                                              irit.ctlpt( irit.E3, 1, 1, 10.01 ) ) ) )
printtest("plane", irit.isgeom(pln, irit.GEOM_PLANAR, 1e-010), 1)
コード例 #18
0
#
#  General quadratic curve
#
c = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, (-0.0398 ), 0.263, 0 ), \
                                 irit.ctlpt( irit.E2, (-0.668 ), 0.333 ), \
                                 irit.ctlpt( irit.E2, (-0.0634 ), 0.161 ), \
                                 irit.ctlpt( irit.E2, (-0.299 ), (-0.378 ) ), \
                                 irit.ctlpt( irit.E2, 0.0664, 0.0859 ), \
                                 irit.ctlpt( irit.E2, 0.444, (-0.359 ) ), \
                                 irit.ctlpt( irit.E2, 0.161, 0.149 ), \
                                 irit.ctlpt( irit.E2, 0.723, 0.2 ), \
                                 irit.ctlpt( irit.E2, 0.362, 0.228 ), \
                                 irit.ctlpt( irit.E2, 0.171, 0.265 ), \
                                 irit.ctlpt( irit.E2, 0.424, 0.813 ), \
                                 irit.ctlpt( irit.E2, 0.0703, 0.283 ), \
                                 irit.ctlpt( irit.E2, (-0.244 ), 0.88 ) ), irit.list( irit.KV_PERIODIC ) ) * irit.sc( 3 ) * irit.tx( (-0.1 ) ) * irit.ty( (-0.4 ) )
d = irit.duality(irit.coerce(c, irit.KV_OPEN))
irit.color(d, irit.YELLOW)

view_mat1 = irit.sc(0.25)
irit.interact(irit.list(c, d, irit.GetAxes(), view_mat1))

#
#  Another cubic general curve
#
c = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E3, (-0.02 ), 0.289, 0 ), \
                                 irit.ctlpt( irit.E2, (-0.668 ), 0.333 ), \
                                 irit.ctlpt( irit.E2, (-0.192 ), 0.156 ), \
                                 irit.ctlpt( irit.E2, (-0.252 ), (-0.417 ) ), \
                                 irit.ctlpt( irit.E2, 0.0858, 0.0777 ), \
                                 irit.ctlpt( irit.E2, 0.194, (-0.00113 ) ), \
コード例 #19
0
irit.free(t1)
irit.free(t2)
irit.free(t3)
irit.free(techlist)

#  Make solids out of the profiles:

vec = (0, 0, 0.1)

c1psolid = irit.extrude(c1p, vec, 3)
c2psolid = irit.extrude(c2p, vec, 3)
c3psolid = irit.extrude(c3p, vec, 3)
techsolid = irit.extrude(tech, vec, 3)

irit.free(c1p)
irit.free(c2p)
irit.free(c3p)
irit.free(tech)

all = irit.list(c1psolid, c2psolid, c3psolid,
                techsolid) * irit.sc(3) * irit.tx((-1)) * irit.ty((-1))
irit.view(all, irit.ON)
irit.pause()
irit.save("cslogo", all)

irit.free(c1psolid)
irit.free(c2psolid)
irit.free(c3psolid)
irit.free(techsolid)
irit.free(all)
コード例 #20
0
                        irit.FALSE)
irit.color(paramdomain, irit.GREEN)

irit.SetViewMatrix(irit.tx((-1)) * irit.sc(0.6))
irit.interact(irit.list(irit.GetViewMatrix(), paramdomain, s1inter))

#
#  Computing self intersection by a Boolean operation with itself - Euclidean.
#
dummy = irit.iritstate("intercrv", irit.GenRealObject(1))
dummy = irit.iritstate("uvboolean", irit.GenRealObject(0))
s1inter = (s1 + s1)
irit.color(s1inter, irit.RED)
irit.attrib(s1inter, "dwidth", irit.GenRealObject(5))

irit.SetViewMatrix(save_mat * irit.sc(0.7) * irit.ty((-0.3)))
irit.interact(irit.list(irit.GetViewMatrix(), s1, s1inter))
irit.save("selfint1", irit.list(s1, s1inter))

irit.free(s1)
irit.free(s1inter)

#
#  A self intersecting offset.
#
c1 = irit.cbspline( 4, irit.list( irit.ctlpt( irit.E3, (-1.1 ), (-1 ), 0 ), \
                                  irit.ctlpt( irit.E3, (-1 ), (-0.5 ), 0.1 ), \
                                  irit.ctlpt( irit.E3, (-1 ), (-0.1 ), 0.1 ), \
                                  irit.ctlpt( irit.E3, (-1.2 ), 0.2, 0.1 ), \
                                  irit.ctlpt( irit.E3, (-1 ), 0.5, 0.1 ), \
                                  irit.ctlpt( irit.E3, (-0.9 ), 1, 0 ) ), irit.list( irit.KV_OPEN ) )
コード例 #21
0
ファイル: skel2d.py プロジェクト: AlessandroScrem/irit-sm_V11
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 )
    skel2dcolor( pt1, pt2, crv3, 0.001, irit.list( 0.01, (-1e-010 ) ), 1, "" )
    irit.milisleep( delay )
    i = i + 1

skel2dcolor( pt1, pt2, crv3, 0.001, irit.list( 0.01, (-1e-010 ) ), 1, "skel2d5" )
irit.pause(  )

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

ln1 = ( irit.ctlpt( irit.E2, (-1 ), (-1 ) ) + \
        irit.ctlpt( irit.E2, 1, (-1 ) ) )
ln2 = ln1 * irit.rz( 120 ) * irit.tx( (-0.5 ) ) * irit.ty( (-0.5 ) )
crv3 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, (-0.5 ), 0 ), \
                                    irit.ctlpt( irit.E2, 0.4, (-1 ) ), \
                                    irit.ctlpt( irit.E2, 0.6, 0.5 ), \
                                    irit.ctlpt( irit.E2, 0.6, (-1 ) ) ), irit.list( irit.KV_OPEN ) ) * irit.tx( (-0.4 ) ) * irit.ty( 0.1 )

skel2dcolor( ln1, ln2, crv3, 1e-006, irit.list( 1e-007, 1e-010 ), 1, "skel2d6" )
irit.pause(  )
'''
# ############################################################################

pt1 =  irit.point( 0.1, 0, 0 )
crv2 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-1 ), 0 ), \
                                irit.ctlpt( irit.E2, (-0.3 ), (-0.5 ) ), \
                                irit.ctlpt( irit.E2, 0.6, 1 ) ) )
crv3 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-0.5 ), (-1 ) ), \
コード例 #22
0
    bisectsrf = irit.cbisector3d(irit.list(c1, c2), 1)
    display(c1, c2, bisectsrf)
    a = a + (-0.01) * speed

a = 0
while (a <= 0.9):
    c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E3, 0, 0 + a, (-1 ) ), \
                                   irit.ctlpt( irit.E3, 0, 0 - a, 0 ), \
                                   irit.ctlpt( irit.E3, 0, 0 + a, 1 ) ) )
    bisectsrf = irit.cbisector3d(irit.list(c1, circ), 1)
    display(c1, circ, bisectsrf)
    a = a + 0.01 * speed

a = 0
while (a <= 180):
    c1x = c1 * irit.ty((-1)) * irit.rx(a) * irit.ty(1)
    bisectsrf = irit.cbisector3d(irit.list(c1x, circ), 1)
    display(c1x, circ, bisectsrf)
    a = a + 2 * speed

circ2 = irit.creparam(irit.pcircle((0, 0, 0), 1), 0, 1) * irit.rz(
    (-90)) * irit.ry(270) * irit.ty(1)
irit.ffcompat(c1x, circ2)

a = 0
while (a <= 1):
    c1 = irit.cmorph(c1x, circ2, 0, a)
    bisectsrf = irit.cbisector3d(irit.list(c1, circ), 1)
    display(c1, circ, bisectsrf)
    a = a + 0.01 * speed
コード例 #23
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
コード例 #24
0
ファイル: ant.py プロジェクト: AlessandroScrem/irit-sm_V11
def antbody():
    save_res = irit.GetResolution()
    c = irit.pcircle((0, 0, 0), 1)
    body = (-irit.sfromcrvs(
        irit.list(
            c * irit.sc(1e-006) * irit.ty((-0.1)) * irit.tz(0.19),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(0.19),
            c * irit.sy(0.8) * irit.sc(0.11) * irit.ty((-0.1)) * irit.tz(0.21),
            c * irit.sy(0.8) * irit.sc(0.14) * irit.ty((-0.1)) * irit.tz(0.23),
            c * irit.sy(0.8) * irit.sc(0.14) * irit.ty((-0.1)) * irit.tz(0.26),
            c * irit.sy(0.8) * irit.sc(0.11) * irit.ty((-0.1)) * irit.tz(0.28),
            c * irit.sy(0.8) * irit.sc(0.11) * irit.ty((-0.1)) * irit.tz(0.29),
            c * irit.sy(0.8) * irit.sc(0.24) * irit.ty(
                (-0.05)) * irit.tz(0.31),
            c * irit.sy(0.8) * irit.sc(0.27) * irit.ty(
                (-0.05)) * irit.tz(0.41),
            c * irit.sy(0.8) * irit.sc(0.19) * irit.ty(
                (-0.05)) * irit.tz(0.44),
            c * irit.sy(0.8) * irit.sc(0.19) * irit.ty(
                (-0.05)) * irit.tz(0.45),
            c * irit.sy(0.8) * irit.sc(0.3) * irit.ty(
                (-0.035)) * irit.tz(0.47),
            c * irit.sy(0.8) * irit.sc(0.32) * irit.ty(
                (-0.035)) * irit.tz(0.59),
            c * irit.sy(0.8) * irit.sc(0.24) * irit.ty(
                (-0.035)) * irit.tz(0.62),
            c * irit.sy(0.8) * irit.sc(0.24) * irit.ty(
                (-0.035)) * irit.tz(0.63),
            c * irit.sy(0.8) * irit.sc(0.3) * irit.ty((-0.03)) * irit.tz(0.65),
            c * irit.sy(0.8) * irit.sc(0.28) * irit.ty(
                (-0.03)) * irit.tz(0.76),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(0.85),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(0.87),
            c * irit.sy(0.8) * irit.sc(0.18) * irit.ty((-0.1)) * irit.tz(0.93),
            c * irit.sy(0.8) * irit.sc(0.18) * irit.ty((-0.1)) * irit.tz(1.03),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(1.1),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0.1)) * irit.tz(1.12),
            c * irit.sy(0.8) * irit.sc(0.18) * irit.ty(
                (-0.06)) * irit.tz(1.18),
            c * irit.sy(0.8) * irit.sc(0.18) * irit.ty(
                (-0.03)) * irit.tz(1.32),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0)) * irit.tz(1.41),
            c * irit.sy(0.8) * irit.sc(0.07) * irit.ty((-0)) * irit.tz(1.43),
            c * irit.sy(0.8) * irit.sc(0.22) * irit.ty(0.05) * irit.tz(1.5),
            c * irit.sy(0.8) * irit.sc(0.2) * irit.ty((-0)) * irit.tz(1.66),
            c * irit.sy(0.8) * irit.sc(0.05) * irit.ty(
                (-0.22)) * irit.tz(1.85),
            c * irit.sy(0.8) * irit.sc(1e-006) * irit.ty(
                (-0.22)) * irit.tz(1.86)), 3, irit.KV_OPEN))
    irit.SetResolution(15)
    eye1 = irit.sphere((0, 0, 0), 0.08) * irit.rx(20) * irit.ry(
        (-20)) * irit.trans((0.15, 0.05, 1.59))
    eye2 = eye1 * irit.sx((-1))
    irit.SetResolution(20)
    bodycut = body / eye1 ^ eye2
    irit.attrib(bodycut, "rgb", irit.GenStrObject("255,50,50"))
    eye1cut = eye1 / body
    irit.attrib(eye1cut, "reflection", irit.GenStrObject("0.85"))
    irit.attrib(eye1cut, "rgb", irit.GenStrObject("15,15,15"))
    eye2cut = eye2 / body
    irit.attrib(eye2cut, "reflection", irit.GenStrObject("0.85"))
    irit.attrib(eye2cut, "rgb", irit.GenStrObject("15,15,15"))
    irit.SetResolution(save_res)
    retval = irit.list(bodycut, irit.list(eye1cut, eye2cut))
    return retval
コード例 #25
0
#
#  A simple turbinee blade, Gershon Elber, Feb 2004
#

#
#  The Blade
#

sec1 = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, (-0.525 ), (-0.041 ), 0 ), \
                                    irit.ctlpt( irit.E2, (-0.0935 ), 0.102 ), \
                                    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)
コード例 #26
0
#  Set states.
#
save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.sc(1))
irit.viewobj(irit.GetViewMatrix())

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

# ############################################################################
#
#  Example 0 - Two simple open curves
#

c1 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-0.441758 ), (-0.503296 ) ), \
                              irit.ctlpt( irit.E2, 0.560439, (-0.516483 ) ) ) ) * irit.ty( 0.3 )

c2 = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 0.608924, (-0.358027 ) ), \
                              irit.ctlpt( irit.E2, 0.164947, (-0.371462 ) ), \
                              irit.ctlpt( irit.E2, 0.173393, 0.881714 ), \
                              irit.ctlpt( irit.E2, 0.107802, (-0.37589 ) ), \
                              irit.ctlpt( irit.E2, (-0.507619 ), (-0.363037 ) ) ) ) * irit.ty( 0.3 )

irit.view(irit.list(c1, c2), irit.ON)

voronoi = irit.cvoronoicell(irit.list(c1, c2))
irit.color(voronoi, irit.GREEN)
irit.attrib(voronoi, "width", irit.GenRealObject(0.005))

irit.interact(irit.list(c1, c2, voronoi))
コード例 #27
0
    irit.poly( \

     irit.cnvrtpolytoptlist( \
      irit.cnvrtcrvtopolygon( backcross, 50, 0 ) \
            ) + \
     backcrosspts, 0 \
      ), \
    ( 0, 2, 0 ), \
    3 \
     ) - \
  irit.extrude( \
    irit.cnvrtcrvtopolygon( heartcross, 50, 0 ), \
    ( 0, (-2 ), 0 ), \
    3 \
     ) \
  ) * irit.ty( 189 )
irit.attrib(back, "rgb", irit.GenStrObject("244,164,96"))
irit.free(backcrosspts)
irit.free(heartcross)
irit.free(backcross)

all = irit.list(legs, skel, cover, back)
irit.free(back)
irit.free(cover)
irit.free(skel)
irit.free(legs)

irit.view(all, irit.ON)
irit.pause()
irit.save("bed", all)
コード例 #28
0
topround = topround / tmpbody

base = (base + topround)

#
#  Top round control.
#

button = irit.coerce( irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0, 0, 0 ), \
                                                   irit.ctlpt( irit.E3, 2, 0, 0 ), \
                                                   irit.ctlpt( irit.E3, 3, 0, 0 ), \
                                                   irit.ctlpt( irit.E3, 3, 1.4, 0 ), \
                                                   irit.ctlpt( irit.E3, 2, 1.4, 0 ), \
                                                   irit.ctlpt( irit.E3, 0, 1.4, 0 ), \
                                                   irit.ctlpt( irit.E3, (-1 ), 1.4, 0 ), \
                                                   irit.ctlpt( irit.E3, (-1 ), 0, 0 ) ), irit.list( irit.KV_PERIODIC ) ), irit.KV_OPEN ) * irit.tx( (-1 ) ) * irit.ty( (-0.7 ) )
button = irit.sfromcrvs(
    irit.list(button * irit.tz((-1)), button, button * irit.tz(0.6),
              button * irit.sx(0.7) * irit.sy(0.001) * irit.tz(0.6)), 3,
    irit.KV_OPEN) * irit.sc(0.1)
irit.attrib(button, "rgb", irit.GenStrObject("155,155,155"))

redbutton = irit.cylin((0, 0, 0), (0, 0, 0.1), 0.1, 3)
irit.attrib(redbutton, "rgb", irit.GenStrObject("255,0,0"))

greenbutton = irit.cylin((0, 0, 0), (0, 0, 0.1), 0.075, 3)
irit.attrib(greenbutton, "rgb", irit.GenStrObject("0,255,0"))

buttons = irit.list(
    button * irit.rx(8) * irit.ty((-0.5)) * irit.tx(0.3) * irit.tz(7.55),
    button * irit.rx(8) * irit.ty((-0.5)) * irit.tx(0.75) * irit.tz(7.55),
コード例 #29
0
irit.pause(  )

# ############################################################################
# 
#  Curves
#  
# ############################################################################

view_mat1 = irit.sc( 0.5 )

irit.viewobj( view_mat1 )

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

c = irit.cbezier( irit.list( irit.ctlpt( irit.E2, 0, (-1 ) ), \
                             irit.ctlpt( irit.E2, 0, 1 ) ) ) * irit.tx( 0.3 ) * irit.ty( 0.5 )
irit.adwidth( c, 3 )

k = irit.crvkernel( c, 15, 0, irit.GenIntObject(2), 2 )
irit.color( k, irit.YELLOW )

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

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

c = irit.cbezier( irit.list( irit.ctlpt( irit.E2, (-1 ), 1 ), \
                             irit.ctlpt( irit.E2, 0, (-1 ) ), \
                             irit.ctlpt( irit.E2, 1, 1 ) ) )
irit.adwidth( c, 3 )
irit.color( c, irit.RED )
ct = c * irit.tz( 1 )
コード例 #30
0
#
#  Some simple examples of NC GCode generation.  Gershon Elber, Mar. 07
#

# ############################################################################
#
#  2D pocketing: rounded pockets
#

basecrv = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 0 ), \
                                       irit.ctlpt( irit.E2, 0, 1 ), \
                                       irit.ctlpt( irit.E2, 1, 0.5 ), \
                                       irit.ctlpt( irit.E2, 1, 1.5 ), \
                                       irit.ctlpt( irit.E2, 0, 1 ), \
                                       irit.ctlpt( irit.E2, 0, 2 ) ), irit.list( irit.KV_FLOAT ) ) * irit.ty( (-0.5 ) )

crv = (basecrv + basecrv * irit.ty(1) + basecrv * irit.ty(2) +
       basecrv * irit.ty(3)) * irit.sc(0.4) * irit.ty((-0.75))
irit.color(crv, irit.RED)

tpath = irit.ncpcktpath( crv, (-0.05 ), (-0.06 ), 0.02, 0.05, 0,\
1 )
irit.attrib(tpath, "ncretractzlevel", irit.GenRealObject(1))
irit.attrib(tpath, "ncmaxxybridgegap", irit.GenRealObject(0.05))

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

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

crv = ( basecrv + basecrv * irit.ty( 1 ) + basecrv * irit.ty( 2 ) + basecrv * irit.ty( 3 ) + irit.cbspline( 3, irit.list( irit.ctlpt( irit.E2, 0, 4 ), \