diff --git a/trep/forces/bodywrench.py b/trep/forces/bodywrench.py index d558cb7..c634cf4 100644 --- a/trep/forces/bodywrench.py +++ b/trep/forces/bodywrench.py @@ -17,7 +17,7 @@ def __init__(self, system, frame, wrench=tuple(), name=None): self._frame = None self._wrench_vars = (None,)*6 self._wrench_cons = (0.0, )*6 - + if not system.get_frame(frame): raise ValueError("Could not find frame %r" % frame) self._frame = system.get_frame(frame) @@ -78,17 +78,17 @@ def wrench(self): @property def wrench_val(self): - return [V.q if V else C for (V,C) in zip(self._wrench_vars, self._wrench_cons)] + return [V.u if V else C for (V,C) in zip(self._wrench_vars, self._wrench_cons)] @wrench_val.setter def wrench_val(self, wrench): for i,v in enumerate(wrench[:6]): if self._wrench_vars[i]: - self._wrench_vars[i].q = v + self._wrench_vars[i].u = v else: self._wrench_cons[i] = v - @property + @property def frame(self): return self._frame @@ -101,7 +101,7 @@ def opengl_draw(self): glDisable(GL_LIGHTING) glBegin(GL_LINES) glVertex3f(0.0, 0.0, 0.0) - glVertex3f(float(self.wrench[0]), float(self.wrench[1]), float(self.wrench[2])) + glVertex3f(float(self.wrench_val[0]), float(self.wrench_val[1]), float(self.wrench_val[2])) glEnd() glPopAttrib() glPopMatrix() diff --git a/trep/forces/hybridwrench.py b/trep/forces/hybridwrench.py index 0661e49..285de49 100644 --- a/trep/forces/hybridwrench.py +++ b/trep/forces/hybridwrench.py @@ -18,7 +18,7 @@ def __init__(self, system, frame, wrench=tuple(), name=None): self._frame = None self._wrench_vars = (None,)*6 self._wrench_cons = (0.0, )*6 - + if not system.get_frame(frame): raise ValueError("Could not find frame %r" % frame) self._frame = system.get_frame(frame) @@ -100,7 +100,7 @@ def frame(self): if _opengl: def opengl_draw(self): - glPushMatrix() + glPushMatrix() mat = np.zeros((4,4)) mat[0,0] = 1.0 mat[1,1] = 1.0 diff --git a/trep/forces/spatialwrench.py b/trep/forces/spatialwrench.py index 9613104..7501bd0 100644 --- a/trep/forces/spatialwrench.py +++ b/trep/forces/spatialwrench.py @@ -18,7 +18,7 @@ def __init__(self, system, frame, wrench=tuple(), name=None): self._frame = None self._wrench_vars = (None,)*6 self._wrench_cons = (0.0, )*6 - + if not system.get_frame(frame): raise ValueError("Could not find frame %r" % frame) self._frame = system.get_frame(frame) @@ -51,7 +51,7 @@ def _set_wrench_vars(self, vars): self._wrench_var4 = vars[4] self._wrench_var5 = vars[5] _wrench_vars = property(_get_wrench_vars, _set_wrench_vars) - + def _get_wrench_cons(self): return (self._wrench_con0, self._wrench_con1, @@ -59,6 +59,7 @@ def _get_wrench_cons(self): self._wrench_con3, self._wrench_con4, self._wrench_con5) + def _set_wrench_cons(self, cons): self._wrench_con0 = cons[0] self._wrench_con1 = cons[1] @@ -67,17 +68,18 @@ def _set_wrench_cons(self, cons): self._wrench_con4 = cons[4] self._wrench_con5 = cons[5] _wrench_cons = property(_get_wrench_cons, _set_wrench_cons) - + def get_wrench(self): return [V if V else C for (V,C) in zip(self._wrench_vars, self._wrench_cons)] wrench = property(get_wrench) def get_wrench_val(self): - return [V.q if V else C for (V,C) in zip(self._wrench_vars, self._wrench_cons)] + return [V.u if V else C for (V,C) in zip(self._wrench_vars, self._wrench_cons)] + def set_wrench_val(self, wrench): for i,v in enumerate(wrench[:6]): if self._wrench_vars[i]: - self._wrench_vars[i].q = v + self._wrench_vars[i].u = v else: self._wrench_cons[i] = v wrench_val = property(get_wrench_val, set_wrench_val) @@ -87,7 +89,7 @@ def get_frame(self): return self._frame if _opengl: def opengl_draw(self): - glPushMatrix() + glPushMatrix() mat = np.zeros((4,4)) mat[0,0] = 1.0 mat[1,1] = 1.0 @@ -102,7 +104,7 @@ def opengl_draw(self): glDisable(GL_LIGHTING) glBegin(GL_LINES) glVertex3f(0.0, 0.0, 0.0) - glVertex3f(self.wrench[0], self.wrench[1], self.wrench[2]) + glVertex3f(self.wrench_val[0], self.wrench_val[1], self.wrench_val[2]) glEnd() glPopAttrib() glPopMatrix() diff --git a/trep/visual/visualitem.py b/trep/visual/visualitem.py index 6c2cb5d..0af9d73 100644 --- a/trep/visual/visualitem.py +++ b/trep/visual/visualitem.py @@ -26,7 +26,7 @@ def __init__(self, system, time=None, q=None, u=None): self._q_interp = None if len(self._u): - self._u_interp = interp1d(self._time[:-1], self._u, axis=0) + self._u_interp = interp1d(self._time, self._u, axis=0) else: self._u_interp = None