Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vectorized operations to compute transformations #266

Merged
merged 2 commits into from
Oct 14, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix assignment of translation component of transform
  • Loading branch information
oliverlee committed Oct 14, 2015
commit 28d0f943f42be6519252c7aef2ed7310e9d1407e
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