Example #1
0
#!/usr/bin/env python

import sys
import rubik.view as rv
from rubik import *

if __name__ == "__main__":
    p = box([8, 8, 8])
    p.tile([1])
    rv.color(p)

    q = box([8, 8, 8])
    q.tile([4, 4, 4])
    q.map(p)

    for child in q:
        child.tilt(0, 1, 1)
        child.tilt(0, 2, 1)

    rv.viewbox(p, q)
Example #2
0
#!/usr/bin/env python

from rubik import *
import rubik.view as rv

Z, Y, X = 0, 1, 2  # Assign names to dimensions
t0 = box([4, 4, 4]) # Create a box
t0.tile([4, 4, 1])
for child in t0:
    child.tile([4, 1, 1])
rv.color(t0)

t1 = t0.copy()
t1.tilt(X, Z, 1)  # Tilt X (YZ) planes along Z

t2 = t1.copy()
t2.tilt(Y, Z, 1)  # Tilt Y (XZ) planes along Z

rv.viewbox(t0, t1, t2)
Example #3
0
#!/usr/bin/env python

import sys
import rubik.view as rv
from rubik import *

if __name__ == "__main__":
    p = box([8, 8, 8])
    rv.color(p, start_color=2)
    p.zorder()

    rv.viewbox(p)
Example #4
0
# We show a series of progressively deeper div operations and
# how the Partitions are structured after each operation.
#
from rubik import *
import rubik.view as rv
import pickle

# Basic 4x4x4 box
p1 = box([4,4,4])

# Same box divided in two along z axis.
p2 = p1.copy()
p2.div([1,1,2])

# p2, but with each child divided into 3 parts.
p3 = p2.copy()
for child in p3:
    child.div([2,1,2])

# Now divide each of THOSE children into 4 parts.
p4 = p3.copy()
for child in p4:
    for grandchild in child:
        grandchild.div([1,2,1])

# Color each partitioned box
for p in (p1, p2, p3, p4):
    rv.color(p, level=-1)

rv.viewbox(p1, p2, p3, p4, transparent=True)
Example #5
0
#!/usr/bin/env python

from rubik import *
import rubik.view as rv

Z, Y, X = 0, 1, 2  # Assign names to dimensions
t0 = box([4, 4, 4])  # Create a box
t0.tile([4, 4, 1])
for child in t0:
    child.tile([4, 1, 1])
rv.color(t0)

t1 = t0.copy()
t1.tilt(X, Z, 1)  # Tilt X (YZ) planes along Z

t2 = t1.copy()
t2.tilt(Y, Z, 1)  # Tilt Y (XZ) planes along Z

rv.viewbox(t0, t1, t2)