コード例 #1
0
c4 = irit.cylin( ( 0, 0, 0 ), ( 0, 0, 1 ), 0.05, 3 )
c5 = irit.cylin( ( 0, 1, 0 ), ( 0, 0, 1 ), 0.05, 3 )
c6 = irit.cylin( ( 1, 0, 0 ), ( 0, 0, 1 ), 0.05, 3 )
c7 = irit.cylin( ( 1, 1, 0 ), ( 0, 0, 1 ), 0.05, 3 )

b1234 = ( b12 ^ b34 + c4 ^ c5 ^ c6 ^ c7 )

irit.free( b12 )
irit.free( b34 )
irit.free( c4 )
irit.free( c5 )
irit.free( c6 )
irit.free( c7 )

final = irit.convex( b1234 )
irit.free( b1234 )

irit.printf( "total time = %f\n", irit.list( irit.time( 0 ) ) )

irit.beep(  )
irit.interact( final )

irit.save( "molecule", final )

irit.free( final )

irit.SetResolution(  save_res)
irit.SetViewMatrix(  save_view)

コード例 #2
0
ファイル: cubes.py プロジェクト: AlessandroScrem/irit-sm_V11
rot_cubes = cubes * irit.rotx(30) * irit.rotz(25)

intrcrv = irit.iritstate("intercrv", irit.GenIntObject(1))
crvs_cubes = (cubes + rot_cubes)
irit.color(crvs_cubes, irit.GREEN)
irit.interact(irit.list(crvs_cubes, cubes, rot_cubes))
irit.free(crvs_cubes)
intrcrv = irit.iritstate("intercrv", intrcrv)
irit.free(intrcrv)

u_cubes = (cubes + rot_cubes)
irit.interact(u_cubes)

i_cubes = cubes * rot_cubes
irit.interact(i_cubes)

s_cubes = (cubes - rot_cubes)
irit.interact(s_cubes)

irit.SetViewMatrix(irit.rotx(0))
u_cubes = irit.convex(u_cubes)
i_cubes = irit.convex(i_cubes)
s_cubes = irit.convex(s_cubes)

irit.save("cubes_u", u_cubes)
irit.save("cubes_i", i_cubes)
irit.save("cubes_s", s_cubes)

irit.SetViewMatrix(save_mat)
コード例 #3
0
front = irit.list(fronttray, frontdoor)

irit.free(fronttray)
irit.free(frontdoor)

rot_y = irit.cbezier( irit.list( irit.ctlpt( irit.E1, 0 ), \
                                 irit.ctlpt( irit.E1, 56 ) ) )
trns = irit.trans(((-0.05), 0, (-1.1)))
irit.attrib(front, "animation", irit.list(trns, rot_y, trns ^ (-1)))
irit.free(rot_y)
irit.free(trns)

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

all = irit.convex( irit.list( base, topround, stopper, screen, buttons, hplogo,\
topfeed, onoff, drawer1, drawer2, drawer3, backdoor0,\
backdoor1, backdoor2, front ) )
irit.free(base)
irit.free(topround)
irit.free(stopper)
irit.free(screen)
irit.free(buttons)
irit.free(hplogo)
irit.free(topfeed)
irit.free(onoff)
irit.free(drawer1)
irit.free(drawer2)
irit.free(drawer3)
irit.free(backdoor0)
irit.free(backdoor1)
irit.free(backdoor2)
コード例 #4
0
irit.free(m1)
irit.free(c1)
irit.view(m2, irit.ON)

c2 = irit.circle((0.55, 0, 0), 0.12)
c2 = irit.extrude(c2, ((-0.2), 0, 0.2), 0)
c2 = c2 * irit.circpoly((0, 0, 1), (0.55, 0, 0.05), 0.25)
c3 = irit.circle(((-0.55), 0, 0), 0.12)
c3 = irit.extrude(c3, (0.2, 0, 0.2), 0)
c3 = c3 * irit.circpoly((0, 0, 1), ((-0.55), 0, 0.05), 0.25)
c2 = putrgbonvertices(c2, irit.GenStrObject("255,0,255"))
c3 = putrgbonvertices(c3, irit.GenStrObject("255,128,128"))
irit.view(irit.list(c2, c3), irit.OFF)

m3 = (m2 - c2 - c3)
irit.free(m2)
irit.free(c2)
irit.free(c3)
final = irit.convex(m3)
irit.free(m3)

irit.printf("total time = %f\n", irit.list(irit.time(0)))
#  In Seconds

irit.interact(final)

irit.save("solid3", final)
irit.free(final)
irit.SetResolution(save_res)
irit.SetViewMatrix(save_mat)
コード例 #5
0
ファイル: solid0.py プロジェクト: AlessandroScrem/irit-sm_V11
irit.view(irit.list(irit.GetViewMatrix(), i1, r2, i3, t4), irit.ON)

ext_dir = (0, (-1), 0)

i1x = irit.extrude(i1, ext_dir, 3)
r2x = irit.extrude(r2, ext_dir, 3)
i3x = irit.extrude(i3, ext_dir, 3)
t4x = irit.extrude(t4, ext_dir, 3)
irit.free(i1)
irit.free(r2)
irit.free(i3)
irit.free(t4)

s1 = i1x ^ r2x ^ i3x ^ t4x
final = irit.convex(s1)
irit.free(s1)
irit.interact(final)
irit.free(final)

s2 = i1outline ^ r2outline ^ i3outline ^ t4outline
irit.free(i1outline)
irit.free(r2outline)
irit.free(i3outline)
irit.free(t4outline)
final = irit.convex(s2)
irit.free(s2)
irit.interact(final)
irit.free(final)

#
コード例 #6
0
eps = 0.015
rad = 0.3
len = (rad + eps) * 2
itemaux1 = irit.box(
    ((-rad) / sqrt2, (-rad) / sqrt2,
     (-len)), rad * 2 / sqrt2, rad * 2 / sqrt2, len * 2) * irit.rz(45)
itemaux2 = (
    itemaux1 * irit.tx(rad) - itemaux1 * irit.rotx(90) * irit.tz(rad + eps) -
    itemaux1 * irit.rotx(90) * irit.tz((-rad) - eps)) * irit.tx(eps / 2)
diag = (len + eps)
diagpoly = irit.poly(
    irit.list((diag, diag, 0), ((-diag), diag, 0), ((-diag), 0, diag),
              (diag, 0, diag)), irit.FALSE)
item1 = (itemaux2 - diagpoly - diagpoly * irit.sy((-1)) - diagpoly * irit.sz(
    (-1)) - diagpoly * irit.sz((-1)) * irit.sy((-1)))
item1 = irit.convex(item1)
irit.color(item1, irit.RED)

item2 = item1 * irit.sx((-1))
irit.color(item2, irit.MAGENTA)

item3 = item1 * irit.rx(90) * irit.rz(90)
irit.color(item3, irit.GREEN)

item4 = item1 * irit.rx(90) * irit.rz((-90))
irit.color(item4, irit.YELLOW)

item5 = item1 * irit.rx(90) * irit.ry(90)
irit.color(item5, irit.BLUE)

item6 = item1 * irit.rx(90) * irit.ry((-90))
コード例 #7
0
hole2 = irit.cylin( ( 6.8, 1, 2.601 ), ( 0, 0, (-1.6015 ) ), 0.3, 3 )
solid2 = ( solid1 - hole2 )
irit.free( hole2 )
irit.free( solid1 )
irit.view( solid2, irit.ON )

pocket1 = irit.cylin( ( 3.9, 3.9, 2.601),  ( 0, 0, -0.501), 2.4, 3)
pocket2 = irit.cylin( ( 3.9, 6.5, 2.601),  ( 0, 0, -0.501), 1.4, 3)
irit.view(irit.list(pocket1, pocket2), irit.TRUE)
pockets = pocket1 + pocket2
irit.free(pocket1)
irit.free(pocket2)

intsolid5 = solid4 - pockets
solid5 = irit.convex(intsolid5)
irit.free(solid4)
irit.free(pockets)
irit.free(intsolid5)

hole5 = irit.cylin( ( 3.91, 3.91, 2.602),  ( 0.0, 0.0, -2.603), 0.3, 3)
solid6 = solid5 - hole5
irit.free(hole5)
irit.free(solid5)
irit.view(solid6, irit.TRUE)

# This hole passes straight through the centre of pocket2. If pocket2 and this
#hole are moved away from pocket1, then the error passes.  Unless I am
#mistaken, (I have been messing around with this) pocket1 does not pass
#through the centre of hole6, and they do not (quite) have colinear surfaces
#Even if quite big variations are tries, it still seems to fail.  I have got
コード例 #8
0
ファイル: wheel.py プロジェクト: AlessandroScrem/irit-sm_V11
irit.SetResolution(  32)
wheel = irit.cylin( ( 0, 0, 0 ), ( 0, 0, 0.08 ), 0.6, 3 )

irit.SetResolution(  16)
h1 = irit.cylin( ( 0, 0, (-0.1 ) ), ( 0, 0, 0.3 ), 0.1, 3 )
h2 = irit.box( ( (-0.2 ), (-0.05 ), (-0.1 ) ), 0.4, 0.1, 0.3 )
h = ( h1 + h2 )
irit.free( h1 )
irit.free( h2 )

irit.view( irit.list( wheel, h ), irit.ON )
wheel = ( wheel - h )
irit.free( h )

wheel = irit.convex( wheel )

irit.interact( wheel )

wheel = ( wheel - c )
irit.free( c )

irit.interact( wheel )

final = irit.convex( wheel )
irit.free( wheel )

irit.printf( "total time = %f\n", irit.list( irit.time( 0 ) ) )
#  In Seconds

final = irit.uvpoly( final, irit.list( 2, 2, 0.1 ), irit.list( 0, 0 ) )
コード例 #9
0
ファイル: solid9.py プロジェクト: AlessandroScrem/irit-sm_V11
               (0, 0.7, 0))
boxes = (b2 + b3)
irit.free(b2)
irit.free(b3)
irit.view(boxes, irit.OFF)
obj = (obj - boxes)
irit.free(boxes)
irit.view(obj, irit.ON)

c2 = irit.cylin((0, 0, (-0.1)), (0, 0, 1.2), 0.08, 3)
c3 = irit.cylin((0, (-0.3), 0.25), (0, 0.6, 0), 0.05, 3)
irit.view(irit.list(c2, c3), irit.OFF)
obj = (obj - c2 - c3)
irit.free(c2)
irit.free(c3)
irit.view(obj, irit.ON)

final = irit.convex(obj)
irit.free(obj)

irit.printf("total time = %f\n", irit.list(irit.time(0)))
#  In Seconds

irit.interact(final)

irit.save("solid9", final)
irit.free(final)

irit.SetResolution(save_res)
irit.SetViewMatrix(save_mat)
コード例 #10
0
ファイル: solid7.py プロジェクト: AlessandroScrem/irit-sm_V11
irit.free(b2)
irit.view(b3, irit.ON)

#
#  Time to do the final hole in the big cylinder. Note we couldnt do it before
#  as E1 would have penetrate it...
#
irit.SetResolution(16)
c3 = irit.cylin((0, 0, (-0.1)), (0, 0, 0.9), 0.165, 3)
irit.attrib(c3, "id", irit.GenRealObject(6))

b4 = (b3 - c3)
irit.free(b3)
irit.free(c3)

final = irit.convex(b4)
irit.free(b4)

finalsplit = irit.list(extractidparts(final, 1, "255, 0, 0"),
                       extractidparts(final, 2, "0, 255, 0"),
                       extractidparts(final, 3, "0, 255, 255"),
                       extractidparts(final, 4, "255, 0, 255"),
                       extractidparts(final, 5, "255, 255, 0"),
                       extractidparts(final, 6, "255, 255, 255"))

irit.interact(finalsplit)

irit.save("solid7", finalsplit)
irit.free(finalsplit)

smooth_final = irit.smoothnrml(final, 190)
コード例 #11
0
c1 = irit.cone((0, 0, (-0.6)),
               (0, 0, 0.6001), 0.6 * math.sqrt(2), 1) * irit.rotz(45)
c2 = irit.cone((0, 0, 0.6),
               (0, 0, (-0.6)), 0.6 * math.sqrt(2), 1) * irit.rotz(45)

a = (a - c1 - c2)
irit.free(c1)
irit.free(c2)
irit.view(irit.list(irit.GetViewMatrix(), a), irit.ON)

b = irit.box(((-0.3), (-0.3), (-1)), 0.6, 0.6, 2)
c = (a - b)
irit.free(a)
irit.free(b)

final = irit.convex(c)
irit.free(c)

irit.beep()
irit.interact(final)
irit.save("ambiguit", final)

f1 = final * irit.rx(90) * irit.tx(2)
f2 = final * irit.ry(90) * irit.tx((-2))

irit.SetViewMatrix(
    irit.scale(
        (0.3, 0.3, 0.3)) * irit.rotx(40) * irit.rotz(10) * irit.roty(20))
irit.interact(irit.list(irit.GetViewMatrix(), final, f1, f2))
irit.save("ambigui2", irit.list(final, f1, f2))
コード例 #12
0
save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.GetViewMatrix() * irit.scale((0.2, 0.2, 0.2)))
save_res = irit.GetResolution()

irit.SetResolution(32)
cone1 = irit.cone((0, 0, (-1)), (0, 0, 4), 2, 1)
cylin1 = irit.cylin((0, 3, 0.3), (0, (-6), 0), 1, 3)
cube1 = irit.box(((-2), (-2), (-2)), 4, 4, 3.6)

s1 = (cone1 - cylin1) * cube1
irit.view(irit.list(irit.GetViewMatrix(), s1), irit.ON)
irit.free(cylin1)
irit.free(cone1)
irit.free(cube1)

irit.SetResolution(16)
cylin2 = irit.cylin((0, 0, (-2)), (0, 0, 6), 0.5, 3)
s2 = (s1 - cylin2)

irit.interact(s2)
irit.free(cylin2)
irit.free(s1)

s2 = irit.convex(s2)

irit.save("cone2cyl", s2)

irit.SetResolution(save_res)
irit.SetViewMatrix(save_mat)
コード例 #13
0
        irit.list(cross, cross * irit.ty(0.4),
                  cross * irit.ty(0.6) * irit.tz((-0.1))), 3, irit.KV_OPEN), 1)
irit.free(cross)

srf6 = srf4 * srf5 * srf5 * irit.ry(180)
irit.free(srf4)
irit.free(srf5)

irit.SetResolution(res * 7)
srf7 = irit.sphere((0, 0, 0), 1.4) * irit.tx(0.65) * irit.ty((-1.305))

srf8 = (srf6 - srf7)
irit.free(srf6)
irit.free(srf7)

irit.SetResolution(res * 7)
srf9 = irit.sphere((0, 0, 0), 1.4) * irit.tx((-0.65)) * irit.ty((-1.305))

handset = irit.convex(srf8 - srf9)
irit.free(srf8)
irit.free(srf9)

irit.color(handset, irit.WHITE)

irit.interact(irit.list(irit.GetAxes(), handset))
irit.save("handset", handset)

irit.free(handset)

irit.SetResolution(save_res)
コード例 #14
0
#

t = irit.time(1)

save_res = irit.GetResolution()

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

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

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

s4 = (s1 + s2 + s3)
irit.free(s1)
irit.free(s2)
irit.free(s3)
irit.view(s4, irit.ON)

irit.SetResolution(64)
t4 = irit.sphere((0, 0, 0), 1)
コード例 #15
0
        retval = textgeom3daux(txt, wdth, dpth)
    return retval


txtu = irit.textgeom("ABCDEFGHIJKLMNOPQRSTUVWXYZ", (0.02, 0, 0), 0.1)
txtl = irit.textgeom("a bcdefghijklmnopqrstuvwxyz", (0.02, 0, 0), 0.1)
txtn = irit.textgeom("0 1  2   34567890#$&*()+-=;:/?.,", (0.02, 0, 0), 0.1)

irit.SetViewMatrix(irit.sc(0.8) * irit.tx((-0.9)))
all = irit.list(txtu, txtl * irit.ty((-0.2)), txtn * irit.ty((-0.4)))
irit.interact(irit.list(irit.GetViewMatrix(), all))
irit.save("textgm1", irit.list(irit.GetViewMatrix(), all))

txtu3d = textgeom3d(txtu, 0.01, 0.1)
txtl3d = textgeom3d(txtl, 0.01, 0.1)
txtn3d = textgeom3d(txtn, 0.01, 0.1)
all = irit.convex(
    irit.list(txtu3d, txtl3d * irit.ty((-0.2)), txtn3d * irit.ty((-0.4))))
irit.interact(irit.list(irit.GetViewMatrix(), all))
irit.save("textgm2", irit.list(irit.GetViewMatrix(), all))

irit.free(txtu)
irit.free(txtl)
irit.free(txtn)
irit.free(txtu3d)
irit.free(txtl3d)
irit.free(txtn3d)
irit.free(all)

irit.SetViewMatrix(save_mat)
コード例 #16
0
irit.free(t7)
irit.view(s4, irit.ON)

irit.SetResolution(32)
t8 = irit.cylin((0, 0, (-0.2)), (0, 0, 0.9), 0.3, 3)
t9 = irit.box(((-0.6), (-0.15), (-0.1)), 1.2, 0.3, 0.7)
s5 = (t8 + t9)
irit.free(t8)
irit.free(t9)
irit.view(s5, irit.OFF)

s6 = (s4 - s5)
irit.free(s4)
irit.free(s5)

final = irit.convex(s6)
irit.free(s6)

irit.printf("total time = %f\n", irit.list(irit.time(0)))
#  In Seconds

irit.save("solid2h", final)
irit.interact(final)

final2 = irit.triangl(final, 1)
#  Convert to triangles

irit.save("solid2ht", final2)
irit.interact(final2)

irit.free(final)
コード例 #17
0
# 
#  Intersection of cone and a cylinder:
#  Try this one with resolution equal 20 - slower, but much nicer!
# 
#                        Created by Gershon Elber,       Jan. 89
# 

save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(  irit.GetViewMatrix() * irit.scale( ( 0.2, 0.2, 0.2 ) ))
save_res = irit.GetResolution()
irit.SetResolution(  32)

cone1 = irit.con2( ( 0, 0, (-1 ) ), ( 0, 0, 4 ), 2, 1, 3 )
cylin1 = irit.cylin( ( 0, 3, 1 ), ( 0, (-6 ), 0 ), 0.7, 3 )

a1 = irit.convex( cone1 + cylin1 )
irit.interact( irit.list( irit.GetViewMatrix(), a1 ) )

a2 = irit.convex( cone1 * cylin1 )
irit.interact( a2 )

a3 = irit.convex( cone1 - cylin1 )
irit.interact( a3 )

a4 = irit.convex( cylin1 - cone1 )
irit.interact( a4 )

intrcrv = irit.iritstate( "intercrv", irit.GenRealObject(1 ))
a5 = cone1 * cylin1
irit.interact( irit.list( a5, cylin1, cone1 ) )
dummy = irit.iritstate( "intercrv", intrcrv )