Ejemplo n.º 1
0
# ############################################################################
#
#  Prism's puzzle.
#

eps = 0.025
an = 71
ca = math.cos(an * math.pi / 180)
sa = math.sin(an * math.pi / 180)
vec1 = irit.vector(1, 0, 0)
vec2 = irit.vector((-ca), sa, 0)
vec3 = irit.coerce(
    irit.normalizeVec(irit.normalizeVec(vec1 + vec2) + irit.vector(0, 0, 1.4))
    * 0.5, irit.VECTOR_TYPE)
prism1 = irit.gbox((0, 0, 0), irit.Fetch3TupleObject(vec1),
                   irit.Fetch3TupleObject(vec2), irit.Fetch3TupleObject(vec3))

rvec = vec2 ^ vec3

prism2 = prism1 * \
   irit.rotvec( irit.Fetch3TupleObject(rvec), \
       180 *  math.acos( irit.FetchRealObject(irit.normalizeVec( vec2 ) * irit.normalizeVec( vec3 )) )/ math.pi ) * \
   irit.trans( irit.Fetch3TupleObject(-vec2 ) ) * \
   irit.rotvec( irit.Fetch3TupleObject(vec2), (-60 ) ) * \
   irit.trans( irit.Fetch3TupleObject((-vec1 ) + irit.normalizeVec( vec1 + vec2 )*0.6 + irit.vector( 0, 0, 0.81 )) )

item1 = prism1 ^ prism2
irit.color(item1, irit.RED)

prism2a = prism2 * \
    irit.rotz( an ) * \
Ejemplo n.º 2
0
        pillarsqr * m3 * irit.tx(1 - w) * irit.ty(1 - w) * irit.tz((-w)) * m2,
        pillarsqr * m3 * irit.tx(1 - w) * irit.ty(1 - w) * m2), 3,
    irit.KV_OPEN)

all = irit.list(basebot, basetop, pillar1, pillar2, pillar3, pillar4)
irit.interact(irit.list(all, view_mat1))

#
#  Escher's circular stairs,
#

irit.SetResolution(50)
cyl1 = (irit.cylin((0, 0, 0), (0, 0, 1), 0.5, 3) - irit.cylin(
    (0, 0, 0.5), (0, 0, 1), 0.4, 3))

b = irit.gbox((0.3, (-0.1), 0.9), (0.3, 0, 0), (0, 0.2, 0.02), (0, 0, 0.3))

i = 0
while (i <= 19):
    cyl1 = cyl1 - b * irit.rz(i * 360 / 20)
    i = i + 1

all = irit.list(cyl1) * irit.tz((-0.3))
irit.interact(irit.list(all, irit.GetViewMatrix()))
irit.free(cyl1)
irit.free(b)

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

irit.SetResolution(save_res)
Ejemplo n.º 3
0
save_mat = irit.GetViewMatrix()
save_res = irit.GetResolution()

irit.SetResolution(48)

b1 = irit.box(((-0.3), (-0.3), 0), 0.6, 0.6, 0.15)
c1 = irit.cylin((0, 0, 0.1), (0, 0, 0.65), 0.14, 3)
s1 = irit.sphere((0, 0, 0.65), 0.3)
obj = (b1 + c1 + s1)
irit.free(b1)
irit.free(c1)
irit.free(s1)
irit.interact(irit.list(irit.GetViewMatrix(), obj))

b2 = irit.box(((-0.1), (-0.4), 0.55), 0.2, 0.8, 0.5)
b3 = irit.gbox((0, (-0.35), 0.63), (0.5, 0, 0.5), ((-0.5), 0, 0.5),
               (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)
Ejemplo n.º 4
0
import irit
#

#
#  Display of all primitives of the system:
#  BOX, GBOX, CONE, CYLIN, SPHERE, TORUS
#
#                                Created by Gershon Elber,       Dec. 88
#

save_mat = irit.GetViewMatrix()
irit.SetViewMatrix(irit.GetViewMatrix() * irit.scale((0.5, 0.5, 0.5)))
axes15 = irit.GetAxes() * irit.scale((1.5, 1.5, 1.5))

irit.interact( irit.list( irit.GetViewMatrix(), axes15, irit.box( ( (-0.5 ), (-0.5 ), (-0.5 ) ), 1, 1, 1 ),\
irit.gbox( ( (-0.25 ), (-0.25 ), (-0.25 ) ), ( 1.1, 0.1, 0.2 ), ( 0.4, 0.9, 0.2 ), ( 0.3, 0.05, 1.4 ) ) ) )

irit.interact(
    irit.list(irit.GetViewMatrix(), axes15,
              irit.cone(((-0.5), 0, 0), ((-0.5), 0, 0), 0.5, 0),
              irit.cone((0.5, 0, 0), (0.5, 0, 0), 0.5, 0),
              irit.cone((0, (-0.5), 0), (0, (-0.5), 0), 0.5, 0),
              irit.cone((0, 0.5, 0), (0, 0.5, 0), 0.5, 0),
              irit.cone((0, 0, (-0.5)), (0, 0, (-0.5)), 0.5, 0),
              irit.cone((0, 0, 0.5), (0, 0, 0.5), 0.5, 0)))

irit.interact(
    irit.list(irit.GetViewMatrix(), axes15,
              irit.cone(((-0.5), 0, 0), ((-0.5), 0, 0), 0.5, 1),
              irit.cone((0.5, 0, 0), (0.5, 0, 0), 0.5, 1),
              irit.cone((0, (-0.5), 0), (0, (-0.5), 0), 0.5, 1),