sympy.vector

Sachin Joglekar edited this page Jul 20, 2014 · 15 revisions
Clone this wiki locally

Rough sketch of Rotator classes

Questions

  1. Do the orient classes have to be immutable? Since they are more of 'helpers' than any actual SymPy entities? Would there be any SymPy related operations on them?

API

AxisOrienter

axis_orient = AxisOrienter(angle, axis)

axis_orient.change_axis(new_axis)

axis_orient.change_angle(new_angle)

new_axis_orient = -axis_orient #new_axis_orient will rotate by negative of original angle, about same axis

orientation_angle = axis_orient.angle

orientation_axis = axis_orient.axis

rotation_matrix = axis_orient.rotation_matrix

BodyOrienter

body_orient = BodyOrienter(angle1, angle2, angle3, rotation_order)

body_orient.change_angle1(new_angle1)

body_orient.changle_rotation_order(new_order)

angle1 = body_orient.angle1

rotation_matrix = body_orient.rotation_matrix

SpaceOrienter

(similar to body orienter)

QuaternionOrienter

q_orient = QuaternionOrienter(q0, q1, q2, q3)

q_orient.change_quaternion0(new_q0)

rotation_matrix = q_orient.rotation_matrix

How will orientations be applied?

Using a CoordSysCartesian's orient_new method. The methods of type 'orient_new_<orientation_type>' will be scraped.The user would be able to provide as many orienters as he wants, in one call of 'orient_new'. This would mean an easy API for multiple rotations at a single go, without having to initialize intermediate coordinate systems. This not only reduces the code length, but also shortens the length of the frame tree, which would otherwise be filled with unnecessary 'intermediate' systems.

>>> some_system.orient_new('new_name', orienter1, orienter2, orienter3, ..., location = some_position_vector)

(some_position_vector is Vector.zero by default)

Moreover, the same orienter could be used by a user for orienting different system - either by coupling different combinations of orienters together, or by modifying the axis/angle/etc. and reapplying. THe same orienter could also be applied on different systems to get different new coordinate systems.