41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
try:
|
|
import visual as vs
|
|
from visual import vector as vv
|
|
except ImportError:
|
|
from vector import Vector as vv
|
|
# from vector import Vector as vector
|
|
pass
|
|
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))
|
|
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 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=[vv(position), vv(position)+vv(direction).norm()*length],
|
|
color = color)
|
|
|
|
|
|
|
|
|
|
|
|
|