Exemplo n.º 1
0
from canvas3d import Canvas3D, Frame3D, roty
from scene import Thing3D as dot


root = Tk()
root.title("Rotating Cube Demo")
c = Canvas3D(root)
c.pack(expand=1, fill='both')


# Zoom out a little.
c.frame.T.z += -300.0


# Create a dot at world origin (0, 0, 0).
origin = dot(c, width=4)
c.frame.things.append(origin)


# Make a frame for some objects to be in.
cube_frame = Frame3D()
c.frame.subframes.append(cube_frame)


# Add a Z component to the cube frame's translation to offset the cube
# from the world frame.
cube_frame.T.z += 300.0


# Make a cube.
F = -100.0, 100.0
Exemplo n.º 2
0
    from scene import Thing3D as dot

    root = Tk()
    root.title("Rotating Cube Demo")
    c = Canvas3D(root)
    c.pack(expand=1, fill='both')

    ## Changing the frustum's "frame".
    #    c._frustum.T.z += 100.0
    #    c._frustum._reset()

    # Zoom out a little.
    c.frame.T.z += -200.0

    # Create a dot at world origin (0, 0, 0).
    origin = dot(c)
    c.frame.things.append(origin)

    # Make a cube.
    cube_frame = Frame3D()
    c.frame.subframes.append(cube_frame)
    coords = -1, 1
    for x in coords:
        for y in coords:
            for z in coords:
                d = dot(c, 100.0 * x, 100.0 * y, 100.0 * z)
                cube_frame.things.append(d)

    # Apply a rotation repeatedly to our cube.
    N = roty(360 / 30 / 3)  # 4 degrees.
Exemplo n.º 3
0
#    along with Tkinter3D.  If not, see <http://www.gnu.org/licenses/>.
#
from tkinter import Tk
from canvas3d import Canvas3D, Frame3D, roty
from scene import Thing3D as dot

root = Tk()
root.title("Rotating Cube Demo")
c = Canvas3D(root)
c.pack(expand=1, fill='both')

# Zoom out a little.
c.frame.T.z += -300.0

# Create a dot at world origin (0, 0, 0).
origin = dot(c, width=4)
c.frame.things.append(origin)

# Make a frame for some objects to be in.
cube_frame = Frame3D()
c.frame.subframes.append(cube_frame)

# Add a Z component to the cube frame's translation to offset the cube
# from the world frame.
cube_frame.T.z += 300.0

# Make a cube.
F = -100.0, 100.0
for x, y, z in ((x, y, z) for x in F for y in F for z in F):
    cube_frame.things.append(dot(c, x, y, z, width=6))
Exemplo n.º 4
0
    from scene import Thing3D as dot

    root = Tk()
    root.title("Rotating Cube Demo")
    c = Canvas3D(root)
    c.pack(expand=1, fill='both')

## Changing the frustum's "frame".
#    c._frustum.T.z += 100.0
#    c._frustum._reset()

    # Zoom out a little.
    c.frame.T.z += -200.0

    # Create a dot at world origin (0, 0, 0).
    origin = dot(c)
    c.frame.things.append(origin)

    # Make a cube.
    cube_frame = Frame3D()
    c.frame.subframes.append(cube_frame)
    coords = -1, 1
    for x in coords:
        for y in coords:
            for z in coords:
                d = dot(c, 100.0 * x, 100.0 * y, 100.0 * z)
                cube_frame.things.append(d)

    # Apply a rotation repeatedly to our cube.    
    N = roty(360/30/3) # 4 degrees.
    def delta():