import visual as vs # from visual import vector as v from vector import Vector as v import wx def drawAxes(frame, color, size, position): # directions = (vs.vector(size, 0, 0), # vs.vector(0, size, 0), # vs.vector(0, 0, size)) directions = (vs.vector(size, 0, 0), vs.vector(0, size, 0), vs.vector(0, 0, size)) labels = 'X', 'Y', 'Z' origin = vs.vector(position) for i in xrange(3): # vs.curve(frame=frame, color=color, # pos=[origin, origin+directions[i]]) vs.arrow(frame=frame, color=color, pos=origin, axis=directions[i], shaftwidth=0.5) vs.label(frame=frame, color=color, box=False, text=labels[i], pos=origin+directions[i]) # def wCoords(x, y, z): # return wCoords(v(x, y, z)) # def wCoords(p): # return v(-p.x, p.y, -p.z) def drawLine(frame, position, length, direction, color = vs.color.white): ''' Draws a straight line from given position, with given length and direction (all are relative to given frame) ''' return vs.curve(frame=frame, pos=[v(position), v(position)+v(direction).norm()*length], color = color) # def reDrawLine(line, position, length, direction): # line.pos = [position, position+direction.norm()*length] def Button(label, x, y, func, size, pan): btn = wx.Button(pan, label=label, pos=(x, y), size=size) btn.Bind(wx.EVT_BUTTON, func)