rahmen.py
rahmen.py — text/python-source, 1 KB (1505 bytes)
Dateiinhalt
#frames, verschachtelt, aber ohne OO # SH 20103030 from visual import * nullpunkt=sphere(radius=0.1, opacity=0.3) label(pos=nullpunkt.pos, text="Nullpunkt", xoffset=8, yoffset=4, height=8, border=2, \ box=False, line=True, linecolor=color.magenta,opacity=0.33) rahmen_i=frame() arm1 = cylinder(frame=rahmen_i, pos=(-1,0,0), axis=(2,0,0), radius=0.2, color=color.yellow) sitz = box(frame=rahmen_i, pos=(-1,0,0), color=color.cyan) rahmen_a=frame() arm1 = cylinder(frame=rahmen_a, pos=(-1,0,0), axis=(2,0,0), radius=0.2, color=color.yellow) arm2 = cylinder(frame=rahmen_a, pos=(0,0,-1), axis=(0,0,2), radius=0.2, color=color.red ) rahmen_i.frame=rahmen_a rahmen_s=frame() stange=cylinder(frame=rahmen_s, pos=(0,0,0), axis=(0,5,0), radius=0.1, color=color.green) rahmen_a.frame=rahmen_s label(pos=(0,2.5,0), text="Drehachse", xoffset=32, yoffset=0, height=8, border=2, \ box=False, line=True, linecolor=color.magenta,opacity=0.33) z=0 while True: rate(25) rahmen_i.rotate(angle=radians(10), axis=(1,0,0), origin=(-1,0,0)) rahmen_a.rotate(angle=radians(5), axis=(0,1,0), origin=(0,0,0)) rahmen_s.rotate(angle=radians(-1), axis=(-1,0,0), origin=(0,2.5,0)) if not z%100: print "sc.forward %4.2f: <%4.2f,%4.2f,%4.2f> sc.m.camera %4.2f: <%4.2f,%4.2f,%4.2f>"%(mag(scene.forward), scene.forward[0],scene.forward[1],scene.forward[2], \ mag(scene.mouse.camera),scene.mouse.camera[0],scene.mouse.camera[1],scene.mouse.camera[2],) z+=1