Esempio n. 1
0
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)

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

allcntrs = irit.nil()
l = (-1.05)
while (l <= 1.1):
    c = irit.contour(
Esempio n. 2
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 ) )
    ln2 = \
           irit.ctlpt( irit.E2, irit.random( (-1 ), 1 ), irit.random( (-1 ), 1 ) ) + \
           irit.ctlpt( irit.E2, irit.random( (-1 ), 1 ), irit.random( (-1 ), 1 ) )
    ln3 = \
Esempio n. 3
0
crvs = irit.cmorph( crv1a, crv1b, 2, 0.03 )
irit.snoc( crv1b, crvs )
i = 1
while ( i <= irit.SizeOf( crvs ) ):
    c = irit.nth( crvs, i )
    irit.color( c, irit.YELLOW )
    irit.view( irit.list( crv1a, crv1b, c ), irit.ON )
    i = i + 1

crvs = irit.cmorph( crv1a, crv1b, 4, 0.1 )
irit.snoc( crv1b, crvs )
i = 1
while ( i <= irit.SizeOf( crvs ) ):
    c = irit.nth( crvs, i )
    irit.color( c, irit.YELLOW )
    irit.milisleep( 20 )
    irit.view( irit.list( crv1a, crv1b, c ), irit.ON )
    i = i + 1

crvs = irit.cmorph( crv1a, crv1b, 5, 0.003 )
irit.snoc( crv1b, crvs )
i = 1
while ( i <= irit.SizeOf( crvs ) ):
    c = irit.nth( crvs, i )
    irit.color( c, irit.YELLOW )
    irit.view( irit.list( crv1a, crv1b, c ), irit.ON )
    i = i + 1


irit.pause(  )
# ############################################################################
Esempio n. 4
0
#  Map circles using the inverse of Map3Pt2Eql, creating an bounding ellipse.
#

n = 40

i = 1
while (i <= n):
    pt1 = irit.point(irit.random((-1), 1), irit.random((-1), 1), 0)
    pt2 = irit.point(irit.random((-1), 1), irit.random((-1), 1), 0)
    pt3 = irit.point(irit.random((-1), 1), irit.random((-1), 1), 0)
    pl = irit.poly(irit.list(pt1, pt2, pt3), irit.FALSE)
    irit.color(pl, irit.GREEN)
    ell = boundingellipse(pt1, pt2, pt3)
    all = irit.list(pl, ell)
    irit.view(all, irit.ON)
    irit.milisleep(200)
    i = i + 1

irit.save("ellips1", irit.list(all))

# ############################################################################
#
#  Compute the bounding ellipse as:
#
#  c = center of mass of Pi, i = 0,..,3
#
#  N = 1/3.0 sum_i (Pi - c)(Pi - c)^T, M = N^{-1}
#
#  Then, the ellipse E equal:
#
#  C = (p - c)^T M (p - c) - z = 0,  z constant