made a few fixes
This commit is contained in:
parent
67123bb970
commit
ec2a98b843
5 changed files with 52 additions and 30 deletions
17
code/svis.py
17
code/svis.py
|
@ -3,24 +3,29 @@ This is the visualization backend for bare_sim module
|
|||
'''
|
||||
try:
|
||||
import visual as vs
|
||||
from visual import vector as v
|
||||
from visual import vector as vv
|
||||
except ImportError:
|
||||
from vector import Vector as v
|
||||
from vector import Vector as vv
|
||||
# from vector import Vector as vector
|
||||
pass
|
||||
from vector import Vector as v
|
||||
|
||||
from geom import Camera
|
||||
|
||||
from util import drawAxes
|
||||
# converts a vector object into a visual vector object
|
||||
v_to_vv = lambda vec: vv(vec.x, vec.y, vec.z)
|
||||
|
||||
def drawCameraFrame(cam): # create frame and draw its contents
|
||||
c = v(cam.t)
|
||||
cam.center = vs.sphere(pos=c,
|
||||
cam.center = vs.sphere(pos=v_to_vv(c),
|
||||
radius=Camera.default_radius,
|
||||
color=vs.color.green)
|
||||
cam.dir = vs.arrow(pos=c,
|
||||
axis=v(cam.direction) * cam.f,
|
||||
cam.dir = vs.arrow(pos=v_to_vv(c),
|
||||
axis=v_to_vv(v(cam.direction)) * cam.f,
|
||||
shaftwidth=1.0)
|
||||
# TODO: check for orientation of the camera, rotate plane accordingly
|
||||
cam.img_plane = vs.box(pos=c + cam.dir.axis,
|
||||
cam.img_plane = vs.box(pos=v_to_vv(c) + v_to_vv(cam.dir.axis),
|
||||
length=cam.image_width,
|
||||
width=0.5,
|
||||
height=cam.image_width,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue