Пример #1
0
def cornerunitbars( w, h, legw, legd ):
    sbar = irit.box( ( legw, 0, 0 ), w - 2 * legw, legd, legw )
    lbar = irit.box( ( legd, 0, 0 ), 2 * w - legd - legw, legd, legw )
    arcbar1 = irit.arc( ( w, 0, 0 ), ( w, w, 0 ), ( 2 * w, w, 0 ) )
    arcbar2 = irit.offset( arcbar1, (-legd ), 0.1, 0 )
    arcbar = irit.list( irit.extrude( arcbar1 + (-arcbar2 ) + irit.ctlpt( irit.E3, w, 0, 0 ), ( 0, 0, legw ), 0 ), irit.ruledsrf( arcbar1, arcbar2 ), irit.ruledsrf( arcbar1, arcbar2 ) * irit.tz( legw ) )
    barframe = irit.list( arcbar, sbar, sbar * irit.tx( w ) * irit.rz( 90 ) * irit.tx( 2 * w ), lbar * irit.rz( 90 ) * irit.tx( legd ), lbar * irit.tx( legw - legd ) * irit.ty( 2 * 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
Пример #2
0
def cornerunitshelf( w, h, legw, legd ):
    prof1 = ( irit.ctlpt( irit.E3, legd, legd, 0 ) + \
               irit.ctlpt( irit.E3, legd, 2 * w - legd, 0 ) + \
               irit.ctlpt( irit.E3, 2 * w - legd, 2 * w - legd, 0 ) )
    prof2 = ( \
               irit.ctlpt( irit.E3, legd, legd, 0 ) + irit.arc( ( w - legd, legd, 0 ), ( w, w, 0 ), ( 2 * w - legd, w - legd, 0 ) ) + \
               irit.ctlpt( irit.E3, 2 * w - legd, 2 * w - legd, 0 ) )
    shelfframe = irit.list( irit.extrude( prof1 + (-prof2 ), ( 0, 0, 0.03 ), 0 ), irit.ruledsrf( prof1, prof2 ), irit.ruledsrf( prof1, prof2 ) * irit.tz( 0.03 ) )
    irit.attrib( shelfframe, "ptexture", woodtext )
    irit.attrib( shelfframe, "rgb", woodclr )
    retval = irit.list( shelfframe ) * irit.tz( h )
    return retval
Пример #3
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
Пример #4
0
#  too slow for regular testing.

#spr = coerce( sregion( sregion( sphereSrf( 1 ), row, 0.1, 1 ), col, 0, 1 ),
#              BEZIER_TYPE ) * sc( 0.99 ) * tx( 1.1 ) * ty( 2.2 ) * tz( -3.3 );
#PrintTest( "Sphere", isgeom( spr, irit.GEOM_SPHERICAL, 1e-10 ), 1 );
#

irit.free(spr)

#
#  Ruled surface.
#
printtest("ruled", irit.isgeom(irit.spheresrf(1), 13, 1e-010), 0)

arc3 = irit.arc((0, 0, 1), (0.5, (-0.2), 1), (1, 0, 1))
ruled = irit.ruledsrf( arc3, irit.ctlpt( irit.E2, 0, 0 ) + \
                             irit.ctlpt( irit.E2, 1, 0 ) )
irit.free(arc3)
printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2)
printtest("ruled",
          irit.isgeom(irit.sreverse(ruled), irit.GEOM_RULED_SRF, 1e-010), 1)

circ = irit.circle((0, 0, 0), 0.25)
ruled = irit.ruledsrf(circ, circ * irit.rx(10) * irit.sc(0.5) * irit.tz(1))
printtest("ruled", irit.isgeom(ruled, irit.GEOM_RULED_SRF, 1e-010), 2)
printtest("ruled",
          irit.isgeom(irit.sreverse(ruled), irit.GEOM_RULED_SRF, 1e-010), 1)

ruled = irit.ruledsrf(circ * irit.rotx(20),
                      circ * irit.rotx((-20)) * irit.tz(1))
Пример #5
0
circ = irit.circle((0, 0, 0), 1)
cyl = irit.extrude(circ, (0, 0, 1), 3)
irit.interact(irit.list(cyl, circ))

circply = irit.cnvrtcrvtopolygon(circ, 25, 0)
cyl = irit.extrude(circply, (0, 0, 1), 3)
irit.interact(irit.list(cyl, circply, circ))

irit.save("macros5", irit.list(cyl, circply, circ))

irit.free(circ)
irit.free(circply)
irit.free(cyl)

cross = (irit.arc((0.2, 0, 0), (0.2, 0.2, 0), (0, 0.2, 0)) + irit.arc(
    (0, 0.4, 0), (0.1, 0.4, 0), (0.1, 0.5, 0)) + irit.arc(
        (0.8, 0.5, 0), (0.8, 0.3, 0), (1, 0.3, 0)) + irit.arc(
            (1, 0.1, 0), (0.9, 0.1, 0),
            (0.9, 0, 0)) + irit.ctlpt(irit.E2, 0.2, 0))
crossply = irit.cnvrtcrvtopolygon(cross, 50, 0)
cyl = irit.extrude(crossply, (0, 0, 1), 3)
irit.interact(irit.list(cyl, crossply, cross))

irit.save("macros6", irit.list(cyl, crossply, cross))

irit.free(crossply)
irit.free(cross)
irit.free(cyl)

s = irit.planesrf((-1), (-1), 1, 1)
Пример #6
0
import irit
#


# 
#  A four identical pieces puzzle.
# 
#                                        Gershon Elber, Oct 1998
# 

save_res = irit.GetResolution()

irit.SetResolution(  10)

arc1a = irit.arc( ( (-0.19 ), 0, 0 ), 
					( (-0.2 ), 0.1, 0 ), 
					( (-0.19 ), 0.2, 0 ) )
arc1b = irit.arc( ( (-0.19 ), (-0.04 ), 0 ), 
					( (-0.2 ), 0.08, 0 ), 
					( (-0.19 ), 0.2, 0 ) )
arc2a = irit.arc( ( (-0.4 ), 0.2, 0 ), 
					( (-0.39 ), 0.3, 0 ), 
					( (-0.4 ), 0.4, 0 ) )
arc2b = irit.arc( ( (-0.25 ), 0.2, 0 ), 
					( (-0.24 ), 0.25, 0 ), 
					( (-0.25 ), 0.3, 0 ) )
arc2c = irit.arc( ( (-0.22 ), 0.2, 0 ), 
					( (-0.21 ), 0.25, 0 ), 
					( (-0.22 ), 0.3, 0 ) )
arc2d = irit.arc( ( (-0.37 ), 0.2, 0 ), 
					( (-0.36 ), 0.28, 0 ), 
Пример #7
0
as1 = irit.algsum(c2, circ)
irit.color(as1, irit.YELLOW)
irit.interact(irit.list(as1, circ, c2))

as2 = irit.swungasum(c2 * irit.ry(90), circ)
irit.color(as2, irit.YELLOW)
irit.interact(irit.list(as2, circ, c2))

irit.free(circ)
irit.free(c2)

#
#  A circle and an arc.
#
circ = irit.circle((0, 0, 0), 1.5) * irit.ry(90)
arc1 = irit.arc((0, 1, 0), (0, 0, 0), (1, 0, 0))
irit.color(circ, irit.MAGENTA)
irit.color(arc1, irit.GREEN)

as1 = irit.algsum(circ, arc1)
irit.color(as1, irit.YELLOW)
irit.interact(irit.list(as1, circ, arc1))

as2 = irit.swungasum(circ * irit.ry((-90)), arc1)
irit.color(as2, irit.YELLOW)
irit.interact(irit.list(as2, circ, arc1))

as1 = irit.algsum(arc1, circ)
irit.color(as1, irit.YELLOW)
irit.interact(irit.list(as1, circ, arc1))
Пример #8
0
#


# 
#  Playground model.
# 
#                                Gershon Elber, December 1993
# 

# 
#  A chair base, to be used by most games below.
# 
chairbasecrv = irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.6, 0, 0 ), \
                                            irit.ctlpt( irit.E3, 0.3, 0, 0.05 ), \
                                            irit.ctlpt( irit.E3, 0, 0, 0 ) ), irit.list( irit.KV_OPEN ) )
chairbasecross = ( irit.arc( ( 0.25, 0.05, 0 ), ( 0.25, 0, 0 ), ( 0.3, 0, 0 ) ) + \
				   irit.arc( ( 0.3, 0, 0 ), ( 0.25, 0, 0 ), ( 0.25, (-0.05 ), 0 ) ) + \
				   irit.cbspline( 3, irit.list( irit.ctlpt( irit.E3, 0.25, (-0.05 ), 0 ), \
										  irit.ctlpt( irit.E3, 0.22, (-0.05 ), 0 ), \
										  irit.ctlpt( irit.E3, 0, 0, 0 ), \
										  irit.ctlpt( irit.E3, (-0.22 ), (-0.05 ), 0 ), \
										  irit.ctlpt( irit.E3, (-0.25 ), (-0.05 ), 0 ) ), irit.list( irit.KV_OPEN ) ) + irit.arc( ( (-0.25 ), (-0.05 ), 0 ), ( (-0.25 ), 0, 0 ), ( (-0.3 ), 0, 0 ) ) + irit.arc( ( (-0.3 ), 0, 0 ), ( (-0.25 ), 0, 0 ), ( (-0.25 ), 0.05, 0 ) ) + \
										  irit.ctlpt( irit.E3, 0.25, 0.05, 0 ) )
chairbasemain = (-irit.sweepsrf( chairbasecross * irit.rotz( 90 ), chairbasecrv, irit.GenRealObject(0) ) )

chaircrv1 = irit.cmesh( chairbasemain, irit.ROW, 0 )
chaircrv1a = chaircrv1 * irit.trans( ( 0.06, 0, (-0.02 ) ) )
chaircrv1b = chaircrv1 * irit.scale( ( 0, 0.83, 0 ) ) * irit.trans( ( 0.66, 0, (-0.02 ) ) )
chairbasecover1 = (-irit.sfromcrvs( irit.list( chaircrv1, chaircrv1a, chaircrv1b ), 3, irit.KV_OPEN ) )
irit.free( chaircrv1 )
irit.free( chaircrv1a )