Skip to content

Commit

Permalink
Fix assignment of translation component of transform
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlee committed Oct 14, 2015
1 parent d8c273b commit 28d0f94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pydy/viz/visualization_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,17 @@ def generate_transformation_matrix(self, reference_frame, point):
"""
rotation_matrix = self.reference_frame.dcm(reference_frame)
self._transform = Identity(4).as_mutable()
self._transform[0:3, 0:3] = rotation_matrix
self._transform[:3, :3] = rotation_matrix

point_vector = self.origin.pos_from(point)
self._transform[3, :3] = point_vector.to_matrix(reference_frame).T
try:
self._transform[3, :3] = point_vector.to_matrix(reference_frame).T
except AttributeError:
# In earlier versions of sympy, 'Vector' object has no attribute
# 'to_matrix'.
self._transform[3, 0] = point_vector.dot(reference_frame.x)
self._transform[3, 1] = point_vector.dot(reference_frame.y)
self._transform[3, 2] = point_vector.dot(reference_frame.z)
return self._transform

def generate_numeric_transform_function(self, dynamic_variables,
Expand Down

0 comments on commit 28d0f94

Please sign in to comment.