|
Hi,
let's say I have two different objects: the first one is a cylinder created with the cylinder command. Its x-y-z matrices are X1, Y1, Z1
The second one is a torus with the matrices X2, Y2, Z2, created with loops like this (just for demonstration - the loops actually do not matter now):
X2 = cos(phi) ;
Y2 = sin(phi) ;
Z2 = r * sin(phi) * ones(size(theta)) ;
I can plot each of them with surf(Xi, Yi, Zi). But I would like to plot both of them in one plot. How could I do that?
Suppose I had a combined matrices Xc, Yc, Zc. Then surf(Xc, Yc, Zc) would give me a picture of both the torus and the cylinder. Now, if I wanted to e.g. change the position or rotation of one of the object, let's say the cylinder, I would just change the approporiate coordinates within the Xc, Yc, and Zc matrices. Naturally, I would leave those coordinates which concern the torus untouched.
Just if you're interested why I'm asking this:
I would like to create a simulation of a spinning top (for simplicity, it might be won from the cylinder command) with its Cardan suspension frames (they are half-torus like). Now, the suspension moves differently from the top which it holds. I might have the big matrices Xc, Yc, and Zc containing all the data about the top and every suspension frame. Then, I would (frame by frame) rotate the top and each frame individually. I'd do that by changing the appropriate parts of the Xc, Yc, Zc matrix. Then I would update the surf plot with the new matrices Xc, Yc, Zc. This would animate my spinning top. I finished the program for the mere top already, and now I would like to implement the Cardan suspension frames.
I'm looking forward to your replies!
Alexander
|