+1 to Gilbert's idea of not going to global frame. That's what I was doing
initially, but we can get rid of that method by using a _frame_path
function which will give the tree 'path' between any two frames. In this
'path', the pos vector and DCM of every frame wrt its former will be
defined (as every ith frame will be a parent or child of the i-1th frame),
so they can just be added. Refer to my code _frame_path and pos_vector_in
methods.


On Wed, Jul 10, 2013 at 11:03 AM, Gilbert Gede <gilbertg...@gmail.com>wrote:

> Prasoon,
> My first question is this - can position vectors be written using
> coordinate variables (base scalars in your codebase, I believe) - i.e. if
> the user has CoordSys "A" with coordinates ax, ay, az, can they define a
> new coordinate system using the position vector p = ax * e_A_x + ay * e_A_y
> + az * e_A_z? If the answer is no, the following should apply. If the
> answer is yes.... the second part won't work.
>
> For the algorithm - I would recommend splitting it into 2 parts: basis
> vectors and basis scalars (coordinates). Your function/method would
> probably invoke both, unless a keyword is supplied indicating the user only
> wants to change one part.
>
> For the first part, the code would be very similar to mechanics - you
> would iterate through every term in the vector, where each term will have a
> basis vector. Consider going from coordinate system B to coordinate system
> A with the DCM {^A}C{^B} (which I'll shorten to C): for a vector term which
> can be written as v1 * e_B_x, this would be expressed in the A coordinate
> system as v1 * (C(1,1)*e_A_x + C(2,1)*e_A_y + C(3,1)*e_A_z). This is pretty
> much the same as what mechanics does now, just not with matrix
> multiplications.
> An alternative way to do this for a vector v is:
> v = dot(v, e_A_x)*e_A_x + dot(v, e_A_y)*e_A_y + dot(v, e_A_z)*e_A_z
> However, I'm not sure which method is faster/will result in cleaner
> expressions.
>
> For the second part, you can do something similar. In the above example,
> lets use coordinates ax, ay, az and bx, by, by. Let's also say the position
> vector from A_o to B_o is p^{AB}. You can then do:
> ax = (p^{AB}, e_A_x) + dot(e_A_x, bx*e_B_x + by*e_B_y + bz*e_B_z)
> And so forth, changing the basis vector you are using to dot with. You can
> also take a similar approach to before, using the DCM directly:
> ax = (p^{AB}, e_A_x) + {^A} C {^B}[1, :] * Matrix([bx, by, bz])
> After you have these, you can just make a dict and use subs. You'll also
> obviously have to look for all present coordinates in the vector, and
> develop this relationship for all present (e.g. B->A, C->B->A, etc...)
>
> As for just converting to rectangular coordinates as an intermediate step:
> I think it's OK to just go with that for now. Is that how the dot product
> between spherical basis vectors and rectangular basis vectors is going to
> work? Stefan, I think you have more experience with using non-rectangular
> coordinate systems than I do, what do you think?
>
> I feel it's very important to _not_ just go to the global
> coordinates/orientation when doing re-expression or other similar tasks. It
> will really hurt the functionality and performance of the code. Try and
> just work with relative DCMs and coordinate transforms; e.g. for series of
> coordinate systems A -> B -> C -> D, find the DCM between each parent and
> child and multiply all the DCMs together to get the DCM from A to D, rather
> then going from D -> global -> A. Same for the coordinate transformations.
> Remember, users are going to be defining these positions/orientations
> relative to the parent CoordSys anyways, not to the global frame.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sympy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sympy/t-Je0beTIIU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to