updated code with more comments

This commit is contained in:
mohsen-mansouryar 2016-04-28 18:14:38 +02:00
parent 460a71d2b3
commit 67123bb970
11 changed files with 262 additions and 1116 deletions

View file

@ -1,12 +1,12 @@
import visual as vs
# from visual import vector as v
from vector import Vector as v
try:
import visual as vs
from visual import vector as v
except ImportError:
from vector import Vector as vector
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))
@ -21,24 +21,16 @@ def drawAxes(frame, color, size, position):
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)
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)