You should get familiar with linear algebra. This becomes a fairly trivial with vectors and matrices.
Each bone can simply be defined as having location in the coordinate frame of its parent bone and a transformation that this bone applies. That will uniquely define the entire bone structure. In addition to that, you can add any information you want to the bones, of course.
Your choice of bone names is a little bit off for the sake of explaining the situation and to extend the explanation to more bones, so let's say instead that bone A is the first bone, bone B is attached to bone A, and bone C is attached to bone B, and so on. Each bone has a position p (a vector) and an orientation R (a rotation matrix). Let's say that each bone also has a translation matrix T that simply corresponds to a translation matrix by its position p. For example, A.R is the rotation matrix of bone A, and B.T is the translation matrix for bone B, and so on.
At this point, finding the orientation and location of any bone in an arbitrary chain of bones becomes fairly trivial. To determine a bone's parent transformations, you simply multiply all its parent transformations.
- The bone A is the parent bone and is thus not subject to any prior transformations. Its location is A.p and its orientation is A.R, so you can use these matrices to draw the bone itself.
- The bone B has the bone A as its parent. Its location is B.p in A's coordinate frame, and so its location becomes (A.T * A.R) * B.p.
- The bone C has the bone B as its parent. Its location is C.p in B's coordinate frame, and so its location becomes ((A.T * A.R) * B.T * B.R) * C.p.
- The bone D has the bone C as its parent. Its location is D.p in C's coordinate frame, and so its location becomes (((A.T * A.R) * B.T * B.R) * C.T * C.R) * D.p.
- And so on...
In your case, you would have defined the bones as follows:
- A.p = (0,0,30)
- A.R = rotation matrix of 45 degrees
- B.p = (0,0,15)
- B.R = rotation matrix of 0 degrees
Note that bone B (which is bone A in your picture) does not have any rotation on its own; its rotation comes from its parent bone A (bone B in your picture).
Note that, depending on which conventions you choose for your linear algebra, you may have to change the order of the translation and the rotation matrices, multiply child bones on the left side, and/or multiply the position vector on the left side instead.
Ok thanks for the info,Trying Linear Algebra now thanks.
EDIT:it's now make sense,I'm learning from it thanks....