Created
May 2, 2014 23:38
-
-
Save moorepants/c76b2e6c1ef5d1935d82 to your computer and use it in GitHub Desktop.
vector-thoughts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> R = ReferenceFrame('R') | |
>>> A = R.orientnew('A', rotation) # rotation is just the args need to set a direction cosine matrix with some method | |
>>> B = R.orientnew('B', rotation) | |
# At this point reference frame A know about R, reference frame B knows | |
# about R, but A and B don't know about each other. But each frame has unit | |
# vectors available to work with. | |
>>> v = a * A.x + b * A.y | |
# v contains A and B through the unit vector references | |
# This will work because A has a reference to R (in a tree structure). It | |
# should also store all the direction cosine matrices that relate A, B, R. | |
>>> v.express(R) | |
... * R.x + ... * R.y | |
# For the following to work, the code will have to look at the unit vectors | |
# of v and see if the associated reference frames have any reference frames | |
# common to B in their tree. Since they do, you can then compute what the | |
# measure numbers for v are with respect to reference frame B. If there are | |
# no common reference frames, then an error is raised. w will be a new | |
# vector but it will contain references to A and B plus all the reference | |
# frames that A and B referenced. Once again, this vector should contain all | |
# the reference frames and their direction cosine matrices that were | |
# involved in this computation. | |
>>> w = v.express(B) | |
>>> C = A.orientnew('C', rotation) | |
>>> x = a * C.x | |
>>> y = x + w | |
# Can reference frames have only one parent? | |
# What if I create a vector without thinking about reference frames? | |
>>> v = Vector(a, b, c) | |
>>> v | |
a * DefaultFrame.x + b * DefaultFrame.y + c * DefaultFrame.z | |
# Should we create a default reference frame? Should this return the first | |
# frame it finds in the vector? | |
>>> v.frame() | |
DefaultFrame | |
# Can we create two reference frame trees and connect them? | |
A = ReferenceFrame('A') | |
B = A.orientnew('B', rotation) | |
C = A.orientnew('C', rotation) | |
""" | |
A | |
/ \ | |
B C | |
On creation of C, should the relationship between B and C be built and | |
stored in C? | |
A | |
/ \ | |
B---C | |
This shows that we aren't forming trees, but graphs that have nodes which | |
are reference frames and links between each pair of frames which are the | |
direction cosine matrices. But only some of these links are explicitly | |
defined by the user, the remainder are computed. | |
""" | |
D = ReferenceFrame('D') | |
E = A.orientnew('E', rotation) | |
F = A.orientnew('F', rotation) | |
# Now if I want to define the orientation of F with respect to C, how do I | |
# do that? | |
""" | |
A D | |
/ \ / \ | |
B C E F | |
to | |
A | |
/ \ | |
B C | |
\ | |
E | |
/ | |
D | |
/ | |
F | |
""" | |
# I guess you could imagine a function that rebuilds the tree. | |
tree = orient(C, E, rotation) | |
# Tree would be a tuple of all the reference frames, with direction cosine | |
# matrices recomputed for all the relationships among A, B, C, D, E, and F. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment